void Matrix_Mul (REAL *CC, int nRows _CC, int nCols_CC,
REAI *AA, int nRows _AA, int nCols_AA,
REAL *BB.,int nRows _BBI, int nCols_BB)
{
double alpha , beta ;
/* Matrix multiplication using LibSci when matrix is stored in C format,
* notice that C=A*B must be called as C=B*A in the DGEMM routine
*
* The parameters to DGEMM have different meanings when called with data
* stored in a Fortran storage order (column first) or in C storage order
* (row first).
*
* TRANSA - Transpose Matrix A, in this case "n" is passed also requires the
* "IL" at the end of the parameter list.
* TRANSB - Transpose Matrix B, in this case "n" is passed also requires the
* second "lL" at the end of the parameter list.
* M - In Fortran storage: the number of rows of A and C, in C storage
* this specifies the number of columns of CC and columns of BB.
* N - In Fortran storage: the number of columns of B and columns
* of C, In C storage: the number of rows of AA and rows CC.
* K - In Fortran storage: the number of columns of A and the number of
* rows of B, in C storage: the number of columns of AA and rows
* of BB.
* ALPHA - The scalar alpha, In C it is passed by address.
* A - The first input matrix , in C this would be BB.
* LDA - The leading dimension of A; In Fortran this is greater than or
* equal to M (number of rows of A) , In C it is greater than or equal
* to the number of columns of AA.
* B - The second input matrix, in C this would be AA.
* LDB - The leading dimension of B; In Fortran this is greater than or
* equal to K (number of rows of B) , In C it is greater than or equal
* to the number of columns of BB.
* BETA - The scalar beta, In C it is passed by address.
* C - The output matrix
* LDC - The leading dimension of C; In Fortran this is greater than or
* equal to M (number of rows of C) , In C it is greater than or equal
* to the number of columns of CC.
*/
alpha=1.0 ;
beta=0.0 ;
dgemm_ ( "n","n", &nCols_CC, &nRows_CC, &nCols_AA, &alpha, BB. &nCols_CC,
AA, &nCols_AA, &beta, CC, &nCols_CC, IL, IL);
...
[LibSciマニュアルより]
これをコンパイルするには
cc -o test1 test1.c -lSci -lthread
とする。