?imatadd
Perform scaling and sum of two matrices including their in-place transposition/copying.
That is,
.

Interface Definition
C interface:
void cblas_simatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);
void cblas_dimatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);
void cblas_cimatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float *alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);
void cblas_zimatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double *alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);
Fortran interface:
CALL SIMATADD(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL DIMATADD(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL CIMATADD(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL ZIMATADD(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
order |
Enumeration type CBLAS_ORDER |
Indicates whether the matrix is in row- or column-major order. |
Input |
TransA |
Enumeration type CBLAS_TRANSPOSE |
Indicates whether matrix A is a conventional matrix, a transpose matrix, a conjugate matrix, or a conjugate transpose matrix.
|
Input |
M |
Integer |
Number of rows of matrices op(A) and BC. |
Input |
N |
Integer |
Number of columns of matrices op(A) and BC. |
Input |
alpha |
|
Multiplication coefficient. |
Input |
A |
|
Matrix A. |
Input |
lda |
Integer |
|
Input |
BC |
|
Matrix BC. |
Input |
ldb |
Integer |
|
Input |
Dependency
#include "kblas.h"
Examples
C interface:
int m = 4;
int n = 3;
int lda = 4;
int ldb = 4;
float alpha = 2.0;
/**
* A:
* 0.558402, 0.691866, 0.533786,
* 0.670904, 0.655601, 0.542604,
* 0.743670, 0.965085, 0.993501,
* 0.623749, 0.587617, 0.966428
* BC:
* 0.730575, 0.624083, 0.526782,
* 0.804889, 0.677061, 0.529442,
* 0.785305, 0.802311, 0.508981,
* 0.574068, 0.646785, 0.717143
*/
float a[12] = {0.558402, 0.691866, 0.533786,
0.670904, 0.655601, 0.542604,
0.743670, 0.965085, 0.993501,
0.623749, 0.587617, 0.966428
};
float bc[12] = {0.730575, 0.624083, 0.526782,
0.804889, 0.677061, 0.529442,
0.785305, 0.802311, 0.508981,
0.574068, 0.646785, 0.717143,
};
cblas_simatadd(CblasColMajor, CblasNoTrans, m, n, alpha, a, lda, bc, ldb);
/**
* Output BC:
* 1.847379, 2.007814, 1.594354,
* 2.146696, 1.988263, 1.614650,
* 2.272644, 2.732482, 2.495982,
* 1.821566, 1.822019, 2.649999
*/
Fortran interface:
PROGRAM IMATADD
INTEGER :: M=4, N=3
INTEGER :: LDA=4, LDB=4
REAL(4) :: ALPHA=2.0
REAL(4) :: A(4, 3), BC(4, 3)
DATA A/0.558402, 0.691866, 0.533786,
0.670904, 0.655601, 0.542604,
0.743670, 0.965085, 0.993501,
0.623749, 0.587617, 0.966428/
DATA BC/0.730575, 0.624083, 0.526782,
0.804889, 0.677061, 0.529442,
0.785305, 0.802311, 0.508981,
0.574068, 0.646785, 0.717143/
EXTERNAL SIMATADD
CALL SIMATADD('C', 'N', M, N, ALPHA, A, LDA, BC, LDB)
END
* Output BC:
* 1.847379, 2.007814, 1.594354,
* 2.146696, 1.988263, 1.614650,
* 2.272644, 2.732482, 2.495982,
* 1.821566, 1.822019, 2.649999