typedef enum _vsip_mat_op { VSIP_MAT_NTRANS = 0, // op(A) = A VSIP_MAT_TRANS = 1, // op(A) = A^T VSIP_MAT_HERM = 2, // op(A) = A^H (complex only) VSIP_MAT_CONJ = 3 // op(X) = A^* (complex only) } vsip_mat_op; void vsip_gemp_f(vsip_scalar_f alpha, const vsip_mview_f *a, vsip_mat_op OpA, const vsip_mview_f *b, vsip_mat_op OpB, vsip_scalar_f beta, const vsip_mview_f *r); void vsip_cgemp_f(vsip_cscalar_f alpha, const vsip_cmview_f *a, vsip_mat_op OpA, const vsip_cmview_f *b, vsip_mat_op OpB, vsip_cscalar_f beta, const vsip_cmview_f *r);
This function performs a generalized matrix-matrix operation of the form:

where
can be
,
, or
.
vsip_dscalar_f alpha: Scalar multiplier for the matrix product.
const vsip_dmview_p* a: First input matrix.
vsip_mat_op OpA: Operation to perform on matrix A:
VSIP_MAT_NTRANS: Use
as is
VSIP_MAT_TRANS: Use the transpose of,
VSIP_MAT_HERM: Use the conjugate transpose of
VSIP_MAT_CONJ: Use the conjugate of 
const vsip_dmview_p* b: Second input matrix.
vsip_mat_op OpB: Operation to perform on matrix B.
VSIP_MAT_NTRANS: Use
as is
VSIP_MAT_TRANS: Use the transpose of,
VSIP_MAT_HERM: Use the conjugate transpose of
VSIP_MAT_CONJ: Use the conjugate of 
vsip_dscalar_p beta: Scalar multiplier for matrix
.
const vsip_dmview_p* r: Input/output matrix that contains the initial values and will store the result.
vsip_mview_f *A, *B, *R; vsip_length m = 3, n = 2, p = 4; // Create matrices A = vsip_mcreate_f(m, n, VSIP_ROW, VSIP_MEM_NONE); B = vsip_mcreate_f(n, p, VSIP_ROW, VSIP_MEM_NONE); R = vsip_mcreate_f(m, p, VSIP_ROW, VSIP_MEM_NONE); // Initialize matrices with some values // Basic matrix multiplication: R = A * B vsip_gemp_f(1.0f, A, VSIP_MAT_NTRANS, B, VSIP_MAT_NTRANS, 0.0f, R); // Matrix multiplication with scaling: R = 2.0*A*B + R vsip_gemp_f(2.0f, A, VSIP_MAT_NTRANS, B, VSIP_MAT_NTRANS, 1.0f, R); // Transpose operations: R = A^T * B vsip_gemp_f(1.0f, A, VSIP_MAT_TRANS, B, VSIP_MAT_NTRANS, 0.0f, R); // Both transposed: R = A^T * B^T vsip_gemp_f(1.0f, A, VSIP_MAT_TRANS, B, VSIP_MAT_TRANS, 0.0f, R); // Clean up vsip_malldestroy_f(A); vsip_malldestroy_f(B); vsip_malldestroy_f(R);
The dimensions of the matrices must be compatible with the operation:
If OpA = VSIP_MAT_NTRANS, rows of
must match rows of
.
If OpA = VSIP_MAT_TRANS or VSIP_MAT_HERM, columns of
must match rows of
.
The result matrix
must have dimensions compatible with the operation.
The operation is not commutative:
in general.
Setting
results in
being overwritten with the matrix product.
Setting
results in the matrix product being added to
.