Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

This manual is preliminary and incomplete.
While our Core implementation implements all functions given in the standard we are still working on completing this documentation.

Please refer to the VSIPL standard for a complete function reference of the Core profile until we have completed work on this documentation.

6.1.7 vsip_dgems_p - General Matrix Scaling and Addition

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_gems_f(vsip_scalar_f alpha, const vsip_mview_f *a, vsip_mat_op OpA, vsip_scalar_f beta, const vsip_mview_f *r); 
void vsip_cgems_f(vsip_cscalar_f alpha, const vsip_cmview_f *a, vsip_mat_op OpA, vsip_cscalar_f beta, const vsip_cmview_f *r);
Description

This function performs a generalized matrix scaling and addition operation of the form:

R =α ·op(A)+ β·R

where op(A) can be A, AT, or AH.

Parameters
Example

vsip_mview_f *A, *R; 
vsip_length m = 3, n = 3; 
 
// Create matrices 
A = vsip_mcreate_f(m, n, VSIP_ROW, VSIP_MEM_NONE); 
R = vsip_mcreate_f(m, n, VSIP_ROW, VSIP_MEM_NONE); 
 
// Initialize matrices with some values 
 
// Basic scaling: R = 2.0 * A 
vsip_gems_f(2.0f, A, VSIP_MAT_NTRANS, 0.0f, R); 
 
// Scale and add: R = 1.5*A + R 
vsip_gems_f(1.5f, A, VSIP_MAT_NTRANS, 1.0f, R); 
 
// Transpose operation: R = A^T 
vsip_gems_f(1.0f, A, VSIP_MAT_TRANS, 0.0f, R); 
 
// Linear combination: R = 0.5*A + 0.5*R 
vsip_gems_f(0.5f, A, VSIP_MAT_NTRANS, 0.5f, R); 
 
// Overwrite with scaled transpose: R = 3.0*A^T 
vsip_gems_f(3.0f, A, VSIP_MAT_TRANS, 0.0f, R); 
 
// Clean up 
vsip_malldestroy_f(A); 
vsip_malldestroy_f(R);
Notes