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_dgemv(int *order, char *transp, int *m, int *n, double *alpha, 
kusano 2b45e8
	       double *a, int *lda, double *x, int *incx, double *beta, 
kusano 2b45e8
	       double *y, int *incy ) {
kusano 2b45e8
kusano 2b45e8
  double *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   = ( double* )malloc( (*m)*LDA*sizeof( double ) );
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_dgemv( 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_dgemv( CblasColMajor, trans,
kusano 2b45e8
		  *m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dgemv( UNDEFINED, trans,
kusano 2b45e8
		  *m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dger(int *order, int *m, int *n, double *alpha, double *x, int *incx,
kusano 2b45e8
	     double *y, int *incy, double *a, int *lda ) {
kusano 2b45e8
kusano 2b45e8
  double *A;
kusano 2b45e8
  int i,j,LDA;
kusano 2b45e8
kusano 2b45e8
  if (*order == TEST_ROW_MJR) {
kusano 2b45e8
     LDA = *n+1;
kusano 2b45e8
     A   = ( double* )malloc( (*m)*LDA*sizeof( double ) );
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_dger(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_dger( CblasColMajor, *m, *n, *alpha, x, *incx, y, *incy, a, *lda );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtrmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
	      int *n, double *a, int *lda, double *x, int *incx) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n)*LDA*sizeof( double ) );
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_dtrmv(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_dtrmv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx);
kusano 2b45e8
  else {
kusano 2b45e8
     cblas_dtrmv(UNDEFINED, uplo, trans, diag, *n, a, *lda, x, *incx);
kusano 2b45e8
  }
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtrsv(int *order, char *uplow, char *transp, char *diagn, 
kusano 2b45e8
	       int *n, double *a, int *lda, double *x, int *incx ) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n)*LDA*sizeof( double ) );
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_dtrsv(CblasRowMajor, uplo, trans, diag, *n, A, LDA, x, *incx );
kusano 2b45e8
     free(A);
kusano 2b45e8
   }
kusano 2b45e8
   else
kusano 2b45e8
     cblas_dtrsv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
void F77_dsymv(int *order, char *uplow, int *n, double *alpha, double *a, 
kusano 2b45e8
	      int *lda, double *x, int *incx, double *beta, double *y,
kusano 2b45e8
	      int *incy) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n)*LDA*sizeof( double ) );
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_dsymv(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_dsymv(CblasColMajor, uplo, *n, *alpha, a, *lda, x, *incx,
kusano 2b45e8
		 *beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dsyr(int *order, char *uplow, int *n, double *alpha, double *x, 
kusano 2b45e8
	     int *incx, double *a, int *lda) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n)*LDA*sizeof( double ) );
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_dsyr(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_dsyr(CblasColMajor, uplo, *n, *alpha, x, *incx, a, *lda);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dsyr2(int *order, char *uplow, int *n, double *alpha, double *x, 
kusano 2b45e8
	     int *incx, double *y, int *incy, double *a, int *lda) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n)*LDA*sizeof( double ) );
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_dsyr2(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_dsyr2(CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, a, *lda);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dgbmv(int *order, char *transp, int *m, int *n, int *kl, int *ku,
kusano 2b45e8
	       double *alpha, double *a, int *lda, double *x, int *incx, 
kusano 2b45e8
	       double *beta, double *y, int *incy ) {
kusano 2b45e8
kusano 2b45e8
  double *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   = ( double* )malloc( (*n+*kl)*LDA*sizeof( double ) );
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_dgbmv( 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_dgbmv( CblasColMajor, trans, *m, *n, *kl, *ku, *alpha,
kusano 2b45e8
		  a, *lda, x, *incx, *beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtbmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
	      int *n, int *k, double *a, int *lda, double *x, int *incx) {
kusano 2b45e8
  double *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 = ( double* )malloc( (*n+*k)*LDA*sizeof( double ) );
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_dtbmv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
kusano 2b45e8
     free(A);
kusano 2b45e8
   }
kusano 2b45e8
   else
kusano 2b45e8
     cblas_dtbmv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtbsv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
	      int *n, int *k, double *a, int *lda, double *x, int *incx) {
kusano 2b45e8
  double *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 = ( double* )malloc( (*n+*k)*LDA*sizeof( double ) );
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_dtbsv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dtbsv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dsbmv(int *order, char *uplow, int *n, int *k, double *alpha,
kusano 2b45e8
	      double *a, int *lda, double *x, int *incx, double *beta, 
kusano 2b45e8
	      double *y, int *incy) {
kusano 2b45e8
  double *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   = ( double* )malloc( (*n+*k)*LDA*sizeof( double ) );
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_dsbmv(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_dsbmv(CblasColMajor, uplo, *n, *k, *alpha, a, *lda, x, *incx,
kusano 2b45e8
		 *beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dspmv(int *order, char *uplow, int *n, double *alpha, double *ap,
kusano 2b45e8
	      double *x, int *incx, double *beta, double *y, int *incy) {
kusano 2b45e8
  double *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   = ( double* )malloc( LDA*LDA*sizeof( double ) );
kusano 2b45e8
     AP  = ( double* )malloc( (((LDA+1)*LDA)/2)*sizeof( double ) );
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_dspmv( CblasRowMajor, uplo, *n, *alpha, AP, x, *incx, *beta, y, 
kusano 2b45e8
		  *incy );
kusano 2b45e8
     free(A);
kusano 2b45e8
     free(AP);
kusano 2b45e8
  }
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dspmv( CblasColMajor, uplo, *n, *alpha, ap, x, *incx, *beta, y, 
kusano 2b45e8
		  *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtpmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
	      int *n, double *ap, double *x, int *incx) {
kusano 2b45e8
  double *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   = ( double* )malloc( LDA*LDA*sizeof( double ) );
kusano 2b45e8
     AP  = ( double* )malloc( (((LDA+1)*LDA)/2)*sizeof( double ) );
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_dtpmv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
kusano 2b45e8
     free(A);
kusano 2b45e8
     free(AP);
kusano 2b45e8
  }
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dtpmv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dtpsv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
	      int *n, double *ap, double *x, int *incx) {
kusano 2b45e8
  double *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   = ( double* )malloc( LDA*LDA*sizeof( double ) );
kusano 2b45e8
     AP  = ( double* )malloc( (((LDA+1)*LDA)/2)*sizeof( double ) );
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_dtpsv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
kusano 2b45e8
     free(A);
kusano 2b45e8
     free(AP);
kusano 2b45e8
  }
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dtpsv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dspr(int *order, char *uplow, int *n, double *alpha, double *x, 
kusano 2b45e8
	     int *incx, double *ap ){
kusano 2b45e8
  double *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   = ( double* )malloc( LDA*LDA*sizeof( double ) );
kusano 2b45e8
     AP  = ( double* )malloc( (((LDA+1)*LDA)/2)*sizeof( double ) );
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_dspr( 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);
kusano 2b45e8
     free(AP);
kusano 2b45e8
  }
kusano 2b45e8
  else
kusano 2b45e8
     cblas_dspr( CblasColMajor, uplo, *n, *alpha, x, *incx, ap );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_dspr2(int *order, char *uplow, int *n, double *alpha, double *x, 
kusano 2b45e8
	     int *incx, double *y, int *incy, double *ap ){
kusano 2b45e8
  double *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   = ( double* )malloc( LDA*LDA*sizeof( double ) );
kusano 2b45e8
     AP  = ( double* )malloc( (((LDA+1)*LDA)/2)*sizeof( double ) );
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_dspr2( 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_dspr2( CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, ap );
kusano 2b45e8
}