gemm

arrayfire.gemm(lhs: Array, rhs: Array, /, lhs_opts: MatProp = MatProp.NONE, rhs_opts: MatProp = MatProp.NONE, alpha: int | float = 1.0, beta: int | float = 0.0, accum: Array = None) Array

Performs BLAS general matrix multiplication (GEMM) on two Array instances.

The operation is defined as: C = alpha * op(lhs) * op(rhs) + beta * C, where op(X) is one of no operation, transpose, or Hermitian transpose, determined by lhs_opts and rhs_opts.

Parameters

lhsArray

A 2-dimensional, real or complex array representing the left-hand side matrix.

rhsArray

A 2-dimensional, real or complex array representing the right-hand side matrix.

lhs_optsMatProp, optional
Operation to perform on lhs before multiplication. Default is MatProp.NONE. Options include:
  • MatProp.NONE: No operation.

  • MatProp.TRANS: Transpose.

  • MatProp.CTRANS: Hermitian transpose.

rhs_optsMatProp, optional
Operation to perform on rhs before multiplication. Default is MatProp.NONE. Options include:
  • MatProp.NONE: No operation.

  • MatProp.TRANS: Transpose.

  • MatProp.CTRANS: Hermitian transpose.

alphaint | float, optional

Scalar multiplier for the product of lhs and rhs. Default is 1.0.

betaint | float, optional

Scalar multiplier for the existing matrix C in the accumulation. Default is 0.0.

accum: Array, optional

A 2-dimensional, real or complex array representing the matrix C in the accumulation. Default is None (no accumulation).

Returns

Array

The result of the matrix multiplication operation.

Note

  • The data types of lhs and rhs must be compatible.

  • Batch operations are not supported in this version.