Extract diagonal from a matrix when extract
is set to true.
More...
Extract diagonal from a matrix when extract
is set to true.
Create a diagonal marix from input array when extract
is set to false
AFAPI array diag(const array &in, const int num=0, const bool extract=true)
AFAPI array randu(const dim4 &dims, const dtype ty=f32)
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:329
◆ af_diag_create()
- Parameters
-
[out] | out | is the array created from the input array in |
[in] | in | is the input array which is the diagonal |
[in] | num | is the diagonal index |
◆ af_diag_extract()
- Parameters
-
[out] | out | is the num -th diagonal of in |
[in] | in | is the input matrix |
[in] | num | is the diagonal index |
◆ diag()
AFAPI array diag |
( |
const array & |
in, |
|
|
const int |
num = 0 , |
|
|
const bool |
extract = true |
|
) |
| |
- Parameters
-
[in] | in | is the input array |
[in] | num | is the diagonal index |
[in] | extract | when true returns an array containing diagonal of tha matrix and when false returns a matrix with in as diagonal |
- Returns
- an array with either the diagonal or the matrix based on
extract
- Examples
- lin_algebra/svd.cpp.