|
|
Functions | |
| array | T () const |
| Transpose matrix or vector. | |
| array | H () const |
Conjugate transpose (1+2i becomes 1-2i). | |
| array | lower (const array &input, int diagonal=0) |
| Extract lower triangular matrix. | |
| array | upper (const array &input, int diagonal=0) |
| Extract upper triangular matrix. | |
| array | diag (const array &input) |
| Extract or form diagonal matrix. | |
| array | join (int dim, const array &A, const array &B) |
Join two arrays along dimension dim. | |
| array | join (int dim, const array &A, const array &B, const array &C) |
| array | join (int dim, const array &A, const array &B, const array &C, const array &D) |
| array | flip (const array &in, unsigned dim) |
| Flip array along a given dimension (base-zero index). | |
| array | tile (const array &A, unsigned d0, unsigned d1=1, unsigned d2=1) |
| tile (repeat) array along specified dimensions | |
| array | tile (const array &A, const dim4 &dims) |
| tile (repeat) array along specified dimensions | |
| array | flat (const array &A) |
| Flatten an array into column vector. | |
| array | shift (const array &in, int dim0=0, int dim1=0, int dim2=0, int dim3=0) |
| Shift the values of an array around dimension (wrap around). | |
| array | shift (const array &in, const array &shift) |
| Shift the values of an array around dimension (wrap around). | |
| array | reorder (const array &in, int dim0=-1, int dim1=-1, int dim2=-1, int dim3=-1) |
| Reorder dimensions of array. | |
| array T | ( | ) | const [inherited] |
Transpose matrix or vector.
X =
0.5434 -1.4913 0.1374
-0.7168 1.4805 -1.2208
X.T() =
0.5434 -0.7168
-1.4913 1.4805
0.1374 -1.2208
| array H | ( | ) | const [inherited] |
Conjugate transpose (1+2i becomes 1-2i).
Real arrays are simply transposed.
X =
0.2925 - 0.7184i 2.5470 - 0.0034i 0.1290 + 0.3728i
0.1000 - 0.3932i 0.0083 - 0.2510i 1.0822 - 0.6650i
X.H() =
0.2925 + 0.7184i 0.1000 + 0.3932i
2.5470 + 0.0034i 0.0083 + 0.2510i
0.1290 - 0.3728i 1.0822 + 0.6650i
| array af::lower | ( | const array & | input, |
| int | diagonal = 0 |
||
| ) |
Extract lower triangular matrix.
| [in] | input | matrix |
| [in] | diagonal | to include in extraction: diagonal==0 is the center diagonal (default), diagonal>0 is above, and diagonal<0 is below. |
| array af::upper | ( | const array & | input, |
| int | diagonal = 0 |
||
| ) |
Extract upper triangular matrix.
| [in] | input | matrix |
| [in] | diagonal | to include in extraction: diagonal==0 is the center diagonal (default), diagonal>0 is above, and diagonal<0 is below. |
| array af::diag | ( | const array & | input | ) |
Extract or form diagonal matrix.
| [in] | input | if vector then produce diagonal matrix, if matrix then extract diagonal vector |
| array af::join | ( | int | dim, |
| const array & | A, | ||
| const array & | B | ||
| ) |
Join two arrays along dimension dim.
| [in] | dim | along which to join |
| [in] | A | |
| [in] | B |
array a = constant(1,2,3), b = constant(0,2,3); print(join(0,a,b)); print(join(1,a,b)); print(join(0, a, a, b, b)); // You can cascade up to four matrices
join(0,a,b) =
1.0000 1.0000 1.0000
1.0000 1.0000 1.0000
0.0000 0.0000 0.0000
0.0000 0.0000 0.0000
join(1,a,b) =
1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
| array af::join | ( | int | dim, |
| const array & | A, | ||
| const array & | B, | ||
| const array & | C | ||
| ) |
| array af::join | ( | int | dim, |
| const array & | A, | ||
| const array & | B, | ||
| const array & | C, | ||
| const array & | D | ||
| ) |
| array af::flip | ( | const array & | in, |
| unsigned | dim | ||
| ) |
Flip array along a given dimension (base-zero index).
float f[] = {1,2,3,4}; array a(2,2,f); //a=[1 3] // [2 4] array b = flip(a,0); //b=[2 4] // [1 3] array b = flip(a,1); //b=[3 1] // [4 2]
| [in] | in | (vector or matrix) |
| [in] | dim | dimension along which to flip |
| array af::tile | ( | const array & | A, |
| unsigned | d0, | ||
| unsigned | d1 = 1, |
||
| unsigned | d2 = 1 |
||
| ) |
tile (repeat) array along specified dimensions
array a(seq(5)); //a=[1 2 3 4 5] a = tile(a, 2); //a=[1 2 3 4 5] // [1 2 3 4 5]
| [in] | A | |
| [in] | d0 | repetitions along first dimension (1 indicates no repeat) |
| [in] | d1 | repetitions along second dimension (default: 1, no repeat) |
| [in] | d2 | repetitions along third dimension (default: 1, no repeat) |
A repeated according to specified repetitions | array af::tile | ( | const array & | A, |
| const dim4 & | dims | ||
| ) |
tile (repeat) array along specified dimensions
array a(seq(5)); //a=[0] // [1] // [2] // [3] // [4] a = tile(a, dim4(1,2)); //a=[0 0] // [1 1] // [2 2] // [3 3] // [4 4]
| [in] | A | |
| [in] | dims | specifications of number of times to repeat |
A repeated according to specified repetitions | array af::flat | ( | const array & | A | ) |
Flatten an array into column vector.
No work is done (data is simply shared) so this is effectively a noop.
array a; //a=[1 3] // [2 4] a = flat(a); //a=[1 2 3 4]
| [in] | A |
| array af::shift | ( | const array & | in, |
| int | dim0 = 0, |
||
| int | dim1 = 0, |
||
| int | dim2 = 0, |
||
| int | dim3 = 0 |
||
| ) |
Shift the values of an array around dimension (wrap around).
array a(seq(5)); //a=[0 1 2 3 4] a = shift(a,2); //a=[3 4 0 1 2]
| [in] | in | |
| [in] | dim0 | Shift along first dimension |
| [in] | dim1 | Shift along second dimension |
| [in] | dim2 | Shift along third dimension |
| [in] | dim3 | Shift along fourth dimension |
| array af::shift | ( | const array & | in, |
| const array & | shift | ||
| ) |
| array af::reorder | ( | const array & | in, |
| int | dim0 = -1, |
||
| int | dim1 = -1, |
||
| int | dim2 = -1, |
||
| int | dim3 = -1 |
||
| ) |
Reorder dimensions of array.
array a(seq(3)); a = tile(a,1,3); //a = [0 0 0] // [1 1 1] // [2 2 2] a = reorder(a, 1, 0); //Switch first and second dimension //a = [0 1 2] // [0 1 2] // [0 1 2]
| [in] | in | |
| [in] | dim0 | first reordering dimension (-1 indicates leave in place, default) |
| [in] | dim1 | second reordering dimension (-1 indicates leave in place, default) |
| [in] | dim2 | third reordering dimension (-1 indicates leave in place, default) |
| [in] | dim3 | fourth reordering dimension (-1 indicates leave in place, default) |