|
kusano |
2b45e8 |
/*
|
|
kusano |
2b45e8 |
* Written by D.P. Manley, Digital Equipment Corporation.
|
|
kusano |
2b45e8 |
* Prefixed "C_" to BLAS routines and their declarations.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Modified by T. H. Do, 4/15/98, SGI/CRAY Research.
|
|
kusano |
2b45e8 |
*/
|
|
kusano |
2b45e8 |
#include <stdlib.h></stdlib.h>
|
|
kusano |
2b45e8 |
#include "common.h"
|
|
kusano |
2b45e8 |
#include "cblas_test.h"
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define TEST_COL_MJR 0
|
|
kusano |
2b45e8 |
#define TEST_ROW_MJR 1
|
|
kusano |
2b45e8 |
#define UNDEFINED -1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_cgemm(int *order, char *transpa, char *transpb, int *m, int *n,
|
|
kusano |
2b45e8 |
int *k, CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *b, int *ldb, CBLAS_TEST_COMPLEX *beta,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B, *C;
|
|
kusano |
2b45e8 |
int i,j,LDA, LDB, LDC;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE transa, transb;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transpa, &transa);
|
|
kusano |
2b45e8 |
get_transpose_type(transpb, &transb);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (transa == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX*)malloc((*m)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
LDA = *m+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc(LDA*(*k)*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*m; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (transb == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*k)*LDB*sizeof(CBLAS_TEST_COMPLEX) );
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
LDB = *k+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc(LDB*(*n)*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDC*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_cgemm( CblasRowMajor, transa, transb, *m, *n, *k, alpha, A, LDA,
|
|
kusano |
2b45e8 |
B, LDB, beta, C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_cgemm( CblasColMajor, transa, transb, *m, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, beta, c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_cgemm( UNDEFINED, transa, transb, *m, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, beta, c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_chemm(int *order, char *rtlf, char *uplow, int *m, int *n,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *b, int *ldb, CBLAS_TEST_COMPLEX *beta,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B, *C;
|
|
kusano |
2b45e8 |
int i,j,LDA, LDB, LDC;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_SIDE side;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_side_type(rtlf,&side);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (side == CblasLeft) {
|
|
kusano |
2b45e8 |
LDA = *m+1;
|
|
kusano |
2b45e8 |
A= (CBLAS_TEST_COMPLEX* )malloc((*m)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*m; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc( (*m)*LDB*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDC*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_chemm( CblasRowMajor, side, uplo, *m, *n, alpha, A, LDA, B, LDB,
|
|
kusano |
2b45e8 |
beta, C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_chemm( CblasColMajor, side, uplo, *m, *n, alpha, a, *lda, b, *ldb,
|
|
kusano |
2b45e8 |
beta, c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_chemm( UNDEFINED, side, uplo, *m, *n, alpha, a, *lda, b, *ldb,
|
|
kusano |
2b45e8 |
beta, c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_csymm(int *order, char *rtlf, char *uplow, int *m, int *n,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *b, int *ldb, CBLAS_TEST_COMPLEX *beta,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B, *C;
|
|
kusano |
2b45e8 |
int i,j,LDA, LDB, LDC;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_SIDE side;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_side_type(rtlf,&side);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (side == CblasLeft) {
|
|
kusano |
2b45e8 |
LDA = *m+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*m; j++ )
|
|
kusano |
2b45e8 |
A[i*LDA+j]=a[j*(*lda)+i];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[i*LDA+j]=a[j*(*lda)+i];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDB*sizeof(CBLAS_TEST_COMPLEX ));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
B[i*LDB+j]=b[j*(*ldb)+i];
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDC*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
C[i*LDC+j]=c[j*(*ldc)+i];
|
|
kusano |
2b45e8 |
cblas_csymm( CblasRowMajor, side, uplo, *m, *n, alpha, A, LDA, B, LDB,
|
|
kusano |
2b45e8 |
beta, C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i]=C[i*LDC+j];
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_csymm( CblasColMajor, side, uplo, *m, *n, alpha, a, *lda, b, *ldb,
|
|
kusano |
2b45e8 |
beta, c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_csymm( UNDEFINED, side, uplo, *m, *n, alpha, a, *lda, b, *ldb,
|
|
kusano |
2b45e8 |
beta, c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_cherk(int *order, char *uplow, char *transp, int *n, int *k,
|
|
kusano |
2b45e8 |
float *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
float *beta, CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
int i,j,LDA,LDC;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *C;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (trans == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*k)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDC*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_cherk(CblasRowMajor, uplo, trans, *n, *k, *alpha, A, LDA, *beta,
|
|
kusano |
2b45e8 |
C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_cherk(CblasColMajor, uplo, trans, *n, *k, *alpha, a, *lda, *beta,
|
|
kusano |
2b45e8 |
c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_cherk(UNDEFINED, uplo, trans, *n, *k, *alpha, a, *lda, *beta,
|
|
kusano |
2b45e8 |
c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_csyrk(int *order, char *uplow, char *transp, int *n, int *k,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *beta, CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
int i,j,LDA,LDC;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *C;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (trans == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*k)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDC*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_csyrk(CblasRowMajor, uplo, trans, *n, *k, alpha, A, LDA, beta,
|
|
kusano |
2b45e8 |
C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_csyrk(CblasColMajor, uplo, trans, *n, *k, alpha, a, *lda, beta,
|
|
kusano |
2b45e8 |
c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_csyrk(UNDEFINED, uplo, trans, *n, *k, alpha, a, *lda, beta,
|
|
kusano |
2b45e8 |
c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_cher2k(int *order, char *uplow, char *transp, int *n, int *k,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *b, int *ldb, float *beta,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
int i,j,LDA,LDB,LDC;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B, *C;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (trans == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
LDB = *k+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX ));
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDB*sizeof(CBLAS_TEST_COMPLEX ));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc( LDA*(*k)*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc( LDB*(*k)*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ){
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc( (*n)*LDC*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_cher2k(CblasRowMajor, uplo, trans, *n, *k, alpha, A, LDA,
|
|
kusano |
2b45e8 |
B, LDB, *beta, C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_cher2k(CblasColMajor, uplo, trans, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, *beta, c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_cher2k(UNDEFINED, uplo, trans, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, *beta, c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_csyr2k(int *order, char *uplow, char *transp, int *n, int *k,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a, int *lda,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *b, int *ldb, CBLAS_TEST_COMPLEX *beta,
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *c, int *ldc ) {
|
|
kusano |
2b45e8 |
int i,j,LDA,LDB,LDC;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B, *C;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (trans == CblasNoTrans) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
LDB = *k+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDB*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*k; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc(LDA*(*k)*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc(LDB*(*k)*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ){
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDC = *n+1;
|
|
kusano |
2b45e8 |
C=(CBLAS_TEST_COMPLEX* )malloc( (*n)*LDC*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
C[i*LDC+j].real=c[j*(*ldc)+i].real;
|
|
kusano |
2b45e8 |
C[i*LDC+j].imag=c[j*(*ldc)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_csyr2k(CblasRowMajor, uplo, trans, *n, *k, alpha, A, LDA,
|
|
kusano |
2b45e8 |
B, LDB, beta, C, LDC );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ ) {
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].real=C[i*LDC+j].real;
|
|
kusano |
2b45e8 |
c[j*(*ldc)+i].imag=C[i*LDC+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
free(C);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_csyr2k(CblasColMajor, uplo, trans, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, beta, c, *ldc );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_csyr2k(UNDEFINED, uplo, trans, *n, *k, alpha, a, *lda,
|
|
kusano |
2b45e8 |
b, *ldb, beta, c, *ldc );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_ctrmm(int *order, char *rtlf, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *m, int *n, CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a,
|
|
kusano |
2b45e8 |
int *lda, CBLAS_TEST_COMPLEX *b, int *ldb) {
|
|
kusano |
2b45e8 |
int i,j,LDA,LDB;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B;
|
|
kusano |
2b45e8 |
enum CBLAS_SIDE side;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
get_side_type(rtlf,&side);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (side == CblasLeft) {
|
|
kusano |
2b45e8 |
LDA = *m+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*m; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDB*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_ctrmm(CblasRowMajor, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
A, LDA, B, LDB );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
b[j*(*ldb)+i].real=B[i*LDB+j].real;
|
|
kusano |
2b45e8 |
b[j*(*ldb)+i].imag=B[i*LDB+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_ctrmm(CblasColMajor, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
a, *lda, b, *ldb);
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ctrmm(UNDEFINED, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
a, *lda, b, *ldb);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_ctrsm(int *order, char *rtlf, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *m, int *n, CBLAS_TEST_COMPLEX *alpha, CBLAS_TEST_COMPLEX *a,
|
|
kusano |
2b45e8 |
int *lda, CBLAS_TEST_COMPLEX *b, int *ldb) {
|
|
kusano |
2b45e8 |
int i,j,LDA,LDB;
|
|
kusano |
2b45e8 |
CBLAS_TEST_COMPLEX *A, *B;
|
|
kusano |
2b45e8 |
enum CBLAS_SIDE side;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
get_side_type(rtlf,&side);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
if (side == CblasLeft) {
|
|
kusano |
2b45e8 |
LDA = *m+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc( (*m)*LDA*sizeof(CBLAS_TEST_COMPLEX ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*m; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else{
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A=(CBLAS_TEST_COMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
A[i*LDA+j].real=a[j*(*lda)+i].real;
|
|
kusano |
2b45e8 |
A[i*LDA+j].imag=a[j*(*lda)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
LDB = *n+1;
|
|
kusano |
2b45e8 |
B=(CBLAS_TEST_COMPLEX* )malloc((*m)*LDB*sizeof(CBLAS_TEST_COMPLEX));
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ ) {
|
|
kusano |
2b45e8 |
B[i*LDB+j].real=b[j*(*ldb)+i].real;
|
|
kusano |
2b45e8 |
B[i*LDB+j].imag=b[j*(*ldb)+i].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_ctrsm(CblasRowMajor, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
A, LDA, B, LDB );
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
b[j*(*ldb)+i].real=B[i*LDB+j].real;
|
|
kusano |
2b45e8 |
b[j*(*ldb)+i].imag=B[i*LDB+j].imag;
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(B);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_ctrsm(CblasColMajor, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
a, *lda, b, *ldb);
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ctrsm(UNDEFINED, side, uplo, trans, diag, *m, *n, alpha,
|
|
kusano |
2b45e8 |
a, *lda, b, *ldb);
|
|
kusano |
2b45e8 |
}
|