matmul

- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

Functions
matmul
Complete List of ArrayFire Functions ArrayFire Functions by Category » Linear Algebra » | BLAS operations

Matrix multiplication using array. More...

## Functions
AFAPI array | matmul (const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
| Matrix multiply of two arrays. More...
AFAPI array | matmulNT (const array &lhs, const array &rhs)
| Matrix multiply of two arrays. More...
AFAPI array | matmulTN (const array &lhs, const array &rhs)
| Matrix multiply of two arrays. More...
AFAPI array | matmulTT (const array &lhs, const array &rhs)
| Matrix multiply of two arrays. More...
AFAPI array | matmul (const array &a, const array &b, const array &c)
| Chain 2 matrix multiplications. More...
AFAPI array | matmul (const array &a, const array &b, const array &c, const array &d)
| Chain 3 matrix multiplications. More...
AFAPI af_err | af_matmul (af_array *out, const af_array lhs, const af_array rhs, const af_mat_prop optLhs, const af_mat_prop optRhs)
| Matrix multiply of two af_array. More...

## Detailed Description

Matrix multiplication using array.

Performs a matrix multiplication on the two input arrays after performing the operations specified in the options. The operations are done while reading the data from memory. This results in no additional memory being used for temporary buffers.

## Function Documentation

AFAPI af_err af_matmul | ( | af_array * | out,
|  | const af_array | lhs,
|  | const af_array | rhs,
|  | const af_mat_prop | optLhs,
|  | const af_mat_prop | optRhs
| ) |  |

Matrix multiply of two af_array.

Performs a matrix multiplication on two arrays (lhs, rhs).

Parameters

  [out] | out | Pointer to the output af_array
  [in] | lhs | A 2D matrix af_array object
  [in] | rhs | A 2D matrix af_array object
  [in] | optLhs | Transpose left hand side before the function is performed
  [in] | optRhs | Transpose right hand side before the function is performed

Returns
  AF_SUCCESS if the process is successful.

Examples:
  blas.cpp.

AFAPI array af::matmul | ( | const array & | lhs,
|  | const array & | rhs,
|  | const matProp | optLhs = `AF_MAT_NONE`,
|  | const matProp | optRhs = `AF_MAT_NONE`
| ) |  |

Matrix multiply of two arrays.

Performs a matrix multiplication on the two input arrays after performing the operations specified in the options. The operations are done while reading the data from memory. This results in no additional memory being used for temporary buffers.

Parameters

  [in] | lhs | The array object on the left hand side
  [in] | rhs | The array object on the right hand side
  [in] | optLhs | Transpose left hand side before the function is performed
  [in] | optRhs | Transpose right hand side before the function is performed

Returns
  The result of the matrix multiplication of lhs, rhs

Note
  optLhs and optRhs can only be one of AF_MAT_NONE, AF_MAT_TRANS, AF_MAT_CTRANS
  This function is not supported in GFOR

Examples:
  blas.cpp, deep_belief_net.cpp, heston_model.cpp, logistic_regression.cpp, neural_network.cpp, perceptron.cpp, rbm.cpp, softmax_regression.cpp, and svd.cpp.

AFAPI array af::matmul | ( | const array & | a,
|  | const array & | b,
|  | const array & | c
| ) |  |

Chain 2 matrix multiplications.

The matrix multiplications are done in a way to reduce temporary memory

Parameters

  [in] | a | The first array
  [in] | b | The second array
  [in] | c | The third array

Returns
  out = a x b x c

Note
  This function is not supported in GFOR

AFAPI array af::matmul | ( | const array & | a,
|  | const array & | b,
|  | const array & | c,
|  | const array & | d
| ) |  |

Chain 3 matrix multiplications.

The matrix multiplications are done in a way to reduce temporary memory

Parameters

  [in] | a | The first array
  [in] | b | The second array
  [in] | c | The third array
  [in] | d | The fourth array

Returns
  out = a x b x c x d

Note
  This function is not supported in GFOR

AFAPI array af::matmulNT | ( | const array & | lhs,
|  | const array & | rhs
| ) |  |

Matrix multiply of two arrays.

Performs a matrix multiplication on the two input arrays after performing the operations specified in the options. The operations are done while reading the data from memory. This results in no additional memory being used for temporary buffers.

Parameters

  [in] | lhs | The array object on the left hand side
  [in] | rhs | The array object on the right hand side

Returns
  The result of the matrix multiplication of `lhs`, transpose(`rhs`)

Note
  This function is not supported in GFOR

Examples:
  cholesky.cpp, deep_belief_net.cpp, and rbm.cpp.

AFAPI array af::matmulTN | ( | const array & | lhs,
|  | const array & | rhs
| ) |  |

Matrix multiply of two arrays.

Performs a matrix multiplication on the two input arrays after performing the operations specified in the options. The operations are done while reading the data from memory. This results in no additional memory being used for temporary buffers.

Parameters

  [in] | lhs | The array object on the left hand side
  [in] | rhs | The array object on the right hand side

Returns
  The result of the matrix multiplication of transpose(`lhs`), `rhs`

Note
  This function is not supported in GFOR

Examples:
  deep_belief_net.cpp, logistic_regression.cpp, perceptron.cpp, rbm.cpp, and softmax_regression.cpp.

AFAPI array af::matmulTT | ( | const array & | lhs,
|  | const array & | rhs
| ) |  |

Matrix multiply of two arrays.

Performs a matrix multiplication on the two input arrays after performing the operations specified in the options. The operations are done while reading the data from memory. This results in no additional memory being used for temporary buffers.

Parameters

  [in] | lhs | The array object on the left hand side
  [in] | rhs | The array object on the right hand side

Returns
  The result of the matrix multiplication of transpose(`lhs`), transpose(`rhs`)

Note
  This function is not supported in GFOR

Examples:
  deep_belief_net.cpp, and neural_network.cpp.