|
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, 1/23/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 |
void F77_sgemv(int *order, char *transp, int *m, int *n, float *alpha,
|
|
kusano |
2b45e8 |
float *a, int *lda, float *x, int *incx, float *beta,
|
|
kusano |
2b45e8 |
float *y, int *incy ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp, &trans);
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*m)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_sgemv( CblasRowMajor, trans,
|
|
kusano |
2b45e8 |
*m, *n, *alpha, A, LDA, x, *incx, *beta, y, *incy );
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_sgemv( CblasColMajor, trans,
|
|
kusano |
2b45e8 |
*m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sgemv( UNDEFINED, trans,
|
|
kusano |
2b45e8 |
*m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_sger(int *order, int *m, int *n, float *alpha, float *x, int *incx,
|
|
kusano |
2b45e8 |
float *y, int *incy, float *a, int *lda ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*m)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ ) {
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
cblas_sger(CblasRowMajor, *m, *n, *alpha, x, *incx, y, *incy, A, LDA );
|
|
kusano |
2b45e8 |
for( i=0; i<*m; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
a[ (*lda)*j+i ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sger( CblasColMajor, *m, *n, *alpha, x, *incx, y, *incy, a, *lda );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_strmv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, float *a, int *lda, float *x, int *incx) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_strmv(CblasRowMajor, uplo, trans, diag, *n, A, LDA, x, *incx);
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else if (*order == TEST_COL_MJR)
|
|
kusano |
2b45e8 |
cblas_strmv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx);
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
cblas_strmv(UNDEFINED, uplo, trans, diag, *n, a, *lda, x, *incx);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_strsv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, float *a, int *lda, float *x, int *incx ) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_strsv(CblasRowMajor, uplo, trans, diag, *n, A, LDA, x, *incx );
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_strsv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
void F77_ssymv(int *order, char *uplow, int *n, float *alpha, float *a,
|
|
kusano |
2b45e8 |
int *lda, float *x, int *incx, float *beta, float *y,
|
|
kusano |
2b45e8 |
int *incy) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_ssymv(CblasRowMajor, uplo, *n, *alpha, A, LDA, x, *incx,
|
|
kusano |
2b45e8 |
*beta, y, *incy );
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ssymv(CblasColMajor, uplo, *n, *alpha, a, *lda, x, *incx,
|
|
kusano |
2b45e8 |
*beta, y, *incy );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_ssyr(int *order, char *uplow, int *n, float *alpha, float *x,
|
|
kusano |
2b45e8 |
int *incx, float *a, int *lda) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_ssyr(CblasRowMajor, uplo, *n, *alpha, x, *incx, A, LDA);
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
a[ (*lda)*j+i ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ssyr(CblasColMajor, uplo, *n, *alpha, x, *incx, a, *lda);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_ssyr2(int *order, char *uplow, int *n, float *alpha, float *x,
|
|
kusano |
2b45e8 |
int *incx, float *y, int *incy, float *a, int *lda) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
cblas_ssyr2(CblasRowMajor, uplo, *n, *alpha, x, *incx, y, *incy, A, LDA);
|
|
kusano |
2b45e8 |
for( i=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
a[ (*lda)*j+i ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ssyr2(CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, a, *lda);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_sgbmv(int *order, char *transp, int *m, int *n, int *kl, int *ku,
|
|
kusano |
2b45e8 |
float *alpha, float *a, int *lda, float *x, int *incx,
|
|
kusano |
2b45e8 |
float *beta, float *y, int *incy ) {
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,irow,j,jcol,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp, &trans);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *ku+*kl+2;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n+*kl)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
for( i=0; i<*ku; i++ ){
|
|
kusano |
2b45e8 |
irow=*ku+*kl-i;
|
|
kusano |
2b45e8 |
jcol=(*ku)-i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
i=*ku;
|
|
kusano |
2b45e8 |
irow=*ku+*kl-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
for( i=*ku+1; i<*ku+*kl+1; i++ ){
|
|
kusano |
2b45e8 |
irow=*ku+*kl-i;
|
|
kusano |
2b45e8 |
jcol=i-(*ku);
|
|
kusano |
2b45e8 |
for( j=jcol; j<(*n+*kl); j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_sgbmv( CblasRowMajor, trans, *m, *n, *kl, *ku, *alpha,
|
|
kusano |
2b45e8 |
A, LDA, x, *incx, *beta, y, *incy );
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sgbmv( CblasColMajor, trans, *m, *n, *kl, *ku, *alpha,
|
|
kusano |
2b45e8 |
a, *lda, x, *incx, *beta, y, *incy );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_stbmv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, int *k, float *a, int *lda, float *x, int *incx) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int irow, jcol, i, j, LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=(*k)-i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
i=*k;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
i=0;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
for( i=1; i<*k+1; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<(*n+*k); j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_stbmv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_stbmv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_stbsv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, int *k, float *a, int *lda, float *x, int *incx) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int irow, jcol, i, j, LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=(*k)-i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
i=*k;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
i=0;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
for( i=1; i<*k+1; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<(*n+*k); j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_stbsv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_stbsv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_ssbmv(int *order, char *uplow, int *n, int *k, float *alpha,
|
|
kusano |
2b45e8 |
float *a, int *lda, float *x, int *incx, float *beta,
|
|
kusano |
2b45e8 |
float *y, int *incy) {
|
|
kusano |
2b45e8 |
float *A;
|
|
kusano |
2b45e8 |
int i,j,irow,jcol,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *k+1;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( i=0; i<*k; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=(*k)-i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
i=*k;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
i=0;
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
for( j=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*j+i ];
|
|
kusano |
2b45e8 |
for( i=1; i<*k+1; i++ ){
|
|
kusano |
2b45e8 |
irow=*k-i;
|
|
kusano |
2b45e8 |
jcol=i;
|
|
kusano |
2b45e8 |
for( j=jcol; j<(*n+*k); j++ )
|
|
kusano |
2b45e8 |
A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_ssbmv(CblasRowMajor, uplo, *n, *k, *alpha, A, LDA, x, *incx,
|
|
kusano |
2b45e8 |
*beta, y, *incy );
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_ssbmv(CblasColMajor, uplo, *n, *k, *alpha, a, *lda, x, *incx,
|
|
kusano |
2b45e8 |
*beta, y, *incy );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_sspmv(int *order, char *uplow, int *n, float *alpha, float *ap,
|
|
kusano |
2b45e8 |
float *x, int *incx, float *beta, float *y, int *incy) {
|
|
kusano |
2b45e8 |
float *A,*AP;
|
|
kusano |
2b45e8 |
int i,j,k,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( LDA*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_sspmv( CblasRowMajor, uplo, *n, *alpha, AP, x, *incx, *beta, y,
|
|
kusano |
2b45e8 |
*incy );
|
|
kusano |
2b45e8 |
free(A); free(AP);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sspmv( CblasColMajor, uplo, *n, *alpha, ap, x, *incx, *beta, y,
|
|
kusano |
2b45e8 |
*incy );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_stpmv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, float *ap, float *x, int *incx) {
|
|
kusano |
2b45e8 |
float *A, *AP;
|
|
kusano |
2b45e8 |
int i, j, k, LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( LDA*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_stpmv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
|
|
kusano |
2b45e8 |
free(A); free(AP);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_stpmv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_stpsv(int *order, char *uplow, char *transp, char *diagn,
|
|
kusano |
2b45e8 |
int *n, float *ap, float *x, int *incx) {
|
|
kusano |
2b45e8 |
float *A, *AP;
|
|
kusano |
2b45e8 |
int i, j, k, LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_TRANSPOSE trans;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
enum CBLAS_DIAG diag;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_transpose_type(transp,&trans);
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
get_diag_type(diagn,&diag);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( LDA*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_stpsv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
|
|
kusano |
2b45e8 |
free(A); free(AP);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_stpsv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_sspr(int *order, char *uplow, int *n, float *alpha, float *x,
|
|
kusano |
2b45e8 |
int *incx, float *ap ){
|
|
kusano |
2b45e8 |
float *A, *AP;
|
|
kusano |
2b45e8 |
int i,j,k,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( LDA*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_sspr( CblasRowMajor, uplo, *n, *alpha, x, *incx, AP );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=AP[ k ];
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
ap[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=AP[ k ];
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
ap[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A); free(AP);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sspr( CblasColMajor, uplo, *n, *alpha, x, *incx, ap );
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
void F77_sspr2(int *order, char *uplow, int *n, float *alpha, float *x,
|
|
kusano |
2b45e8 |
int *incx, float *y, int *incy, float *ap ){
|
|
kusano |
2b45e8 |
float *A, *AP;
|
|
kusano |
2b45e8 |
int i,j,k,LDA;
|
|
kusano |
2b45e8 |
enum CBLAS_UPLO uplo;
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
get_uplo_type(uplow,&uplo);
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
if (*order == TEST_ROW_MJR) {
|
|
kusano |
2b45e8 |
LDA = *n;
|
|
kusano |
2b45e8 |
A = ( float* )malloc( LDA*LDA*sizeof( float ) );
|
|
kusano |
2b45e8 |
AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=ap[ k ];
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
AP[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
cblas_sspr2( CblasRowMajor, uplo, *n, *alpha, x, *incx, y, *incy, AP );
|
|
kusano |
2b45e8 |
if (uplo == CblasUpper) {
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=i; j<*n; j++, k++ )
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=AP[ k ];
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=0; i
|
|
kusano |
2b45e8 |
ap[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else {
|
|
kusano |
2b45e8 |
for( i=0, k=0; i<*n; i++ )
|
|
kusano |
2b45e8 |
for( j=0; j
|
|
kusano |
2b45e8 |
A[ LDA*i+j ]=AP[ k ];
|
|
kusano |
2b45e8 |
for( j=0, k=0; j<*n; j++ )
|
|
kusano |
2b45e8 |
for( i=j; i<*n; i++, k++ )
|
|
kusano |
2b45e8 |
ap[ k ]=A[ LDA*i+j ];
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
free(A);
|
|
kusano |
2b45e8 |
free(AP);
|
|
kusano |
2b45e8 |
}
|
|
kusano |
2b45e8 |
else
|
|
kusano |
2b45e8 |
cblas_sspr2( CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, ap );
|
|
kusano |
2b45e8 |
}
|