Functions | |
array | operator* (const array &rhs) const |
Multiply two matrices. | |
template<typename ty > | |
ty | inner (const array &x, const array &y) |
Inner (scalar) product between two vectors. | |
array | inner (const array &X, const array &Y, int dim=-1) |
Dot product along a dimension. | |
array | dot (const array &, const double) |
array | dot (const double, const array &) |
array | dot (const array &, const array &) |
array af::dot | ( | const array & | , |
const double | |||
) |
matrix multiply
array operator* | ( | const array & | rhs | ) | const [inline, inherited] |
Multiply two matrices.
Use A*B
to multiply two matrices (or a scalar and a matrix).
In version v1.0, the *
operator defaults to matrix multiply (see dot()), but you can change this default behavior to elementwise (see mul) via macros before including arrayfire.h
:
#define AF_TIMES_ELEMENTWISE // operator*() now defaults to elementwise multiply #include <arrayfire.h> ... array A = randu(3,4), B = randu(3,4), C = randu(4,5); printf(A * B); // 3x4 matrix // printf(A * C); // failure: dimension mismatch: 3x4 * 4x5
In the upcoming version v1.1, the default behavior will change to be elementwise multiply and the macro AF_TIMES_MATMUL
will toggle back to matrix multiply. This transition will be noted in the v1.1 release notes at that time.
ty af::inner | ( | const array & | x, |
const array & | y | ||
) |
Inner (scalar) product between two vectors.
[in] | x | |
[in] | y |
array af::inner | ( | const array & | X, |
const array & | Y, | ||
int | dim = -1 |
||
) |
Dot product along a dimension.
[in] | X | |
[in] | Y | |
[in] | dim | dimension along which to operate (-1 indicates first nonsingleton dimension) |
array af::dot | ( | const double | , |
const array & | |||
) |
array af::dot | ( | const array & | , |
const array & | |||
) |