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 matrix from input array when extract
is set to false
array a = randu(dim4(4, 3));
array b = diag(a);
array c = diag(a, 1);
array a = randu(4);
array b = diag(a, 0, false);
array b = diag(a, -1, false);
◆ 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