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/08/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_zgemv(int *order, char *transp, int *m, int *n, 
kusano 2b45e8
          const void *alpha,
kusano 2b45e8
          CBLAS_TEST_ZOMPLEX *a, int *lda, const void *x, int *incx, 
kusano 2b45e8
          const void *beta, void *y, int *incy) {
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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  = (CBLAS_TEST_ZOMPLEX *)malloc( (*m)*LDA*sizeof( CBLAS_TEST_ZOMPLEX) );
kusano 2b45e8
     for( i=0; i<*m; i++ )
kusano 2b45e8
        for( j=0; j<*n; j++ ){
kusano 2b45e8
           A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
           A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
        }
kusano 2b45e8
     cblas_zgemv( CblasRowMajor, trans, *m, *n, alpha, A, LDA, x, *incx,
kusano 2b45e8
	    beta, y, *incy );
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zgemv( CblasColMajor, trans,
kusano 2b45e8
                  *m, *n, alpha, a, *lda, x, *incx, beta, y, *incy );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zgemv( UNDEFINED, trans,
kusano 2b45e8
                  *m, *n, alpha, a, *lda, x, *incx, beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zgbmv(int *order, char *transp, int *m, int *n, int *kl, int *ku, 
kusano 2b45e8
	      CBLAS_TEST_ZOMPLEX *alpha, CBLAS_TEST_ZOMPLEX *a, int *lda, 
kusano 2b45e8
	      CBLAS_TEST_ZOMPLEX *x, int *incx, 
kusano 2b45e8
	      CBLAS_TEST_ZOMPLEX *beta, CBLAS_TEST_ZOMPLEX *y, int *incy) {
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *A;
kusano 2b45e8
  int i,j,irow,jcol,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 = *ku+*kl+2;
kusano 2b45e8
     A=( CBLAS_TEST_ZOMPLEX* )malloc((*n+*kl)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
           A[ LDA*(j-jcol)+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
        }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
        A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
     }
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 ].real=a[ (*lda)*(j-jcol)+i ].real;
kusano 2b45e8
           A[ LDA*j+irow ].imag=a[ (*lda)*(j-jcol)+i ].imag;
kusano 2b45e8
        }
kusano 2b45e8
     }
kusano 2b45e8
     cblas_zgbmv( CblasRowMajor, trans, *m, *n, *kl, *ku, alpha, A, LDA, x,
kusano 2b45e8
		  *incx, beta, y, *incy );
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zgbmv( CblasColMajor, trans, *m, *n, *kl, *ku, alpha, a, *lda, x,
kusano 2b45e8
		  *incx, beta, y, *incy );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zgbmv( UNDEFINED, trans, *m, *n, *kl, *ku, alpha, a, *lda, x,
kusano 2b45e8
		  *incx, beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zgeru(int *order, int *m, int *n, CBLAS_TEST_ZOMPLEX *alpha, 
kusano 2b45e8
	 CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *y, int *incy, 
kusano 2b45e8
         CBLAS_TEST_ZOMPLEX *a, int *lda){
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *A;
kusano 2b45e8
  int i,j,LDA;
kusano 2b45e8
kusano 2b45e8
  if (*order == TEST_ROW_MJR) {
kusano 2b45e8
     LDA = *n+1;
kusano 2b45e8
     A=(CBLAS_TEST_ZOMPLEX*)malloc((*m)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
kusano 2b45e8
     for( i=0; i<*m; i++ )
kusano 2b45e8
        for( j=0; j<*n; j++ ){
kusano 2b45e8
           A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
           A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
     }
kusano 2b45e8
     cblas_zgeru( 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 ].real=A[ LDA*i+j ].real;
kusano 2b45e8
           a[ (*lda)*j+i ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
        }
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zgeru( CblasColMajor, *m, *n, alpha, x, *incx, y, *incy, a, *lda );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zgeru( UNDEFINED, *m, *n, alpha, x, *incx, y, *incy, a, *lda );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zgerc(int *order, int *m, int *n, CBLAS_TEST_ZOMPLEX *alpha, 
kusano 2b45e8
	 CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *y, int *incy, 
kusano 2b45e8
         CBLAS_TEST_ZOMPLEX *a, int *lda) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *A;
kusano 2b45e8
  int i,j,LDA;
kusano 2b45e8
kusano 2b45e8
  if (*order == TEST_ROW_MJR) {
kusano 2b45e8
     LDA = *n+1;
kusano 2b45e8
     A=(CBLAS_TEST_ZOMPLEX* )malloc((*m)*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
kusano 2b45e8
     for( i=0; i<*m; i++ )
kusano 2b45e8
        for( j=0; j<*n; j++ ){
kusano 2b45e8
           A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
           A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
        }
kusano 2b45e8
     cblas_zgerc( 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 ].real=A[ LDA*i+j ].real;
kusano 2b45e8
           a[ (*lda)*j+i ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
        }
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zgerc( CblasColMajor, *m, *n, alpha, x, *incx, y, *incy, a, *lda );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zgerc( UNDEFINED, *m, *n, alpha, x, *incx, y, *incy, a, *lda );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zhemv(int *order, char *uplow, int *n, CBLAS_TEST_ZOMPLEX *alpha,
kusano 2b45e8
      CBLAS_TEST_ZOMPLEX *a, int *lda, CBLAS_TEST_ZOMPLEX *x,
kusano 2b45e8
      int *incx, CBLAS_TEST_ZOMPLEX *beta, CBLAS_TEST_ZOMPLEX *y, int *incy){
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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 = (CBLAS_TEST_ZOMPLEX *)malloc((*n)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
kusano 2b45e8
     for( i=0; i<*n; i++ )
kusano 2b45e8
        for( j=0; j<*n; j++ ){
kusano 2b45e8
           A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
           A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
     }
kusano 2b45e8
     cblas_zhemv( CblasRowMajor, uplo, *n, alpha, A, LDA, x, *incx,
kusano 2b45e8
	    beta, y, *incy );
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zhemv( CblasColMajor, uplo, *n, alpha, a, *lda, x, *incx, 
kusano 2b45e8
	   beta, y, *incy );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zhemv( UNDEFINED, uplo, *n, alpha, a, *lda, x, *incx,
kusano 2b45e8
	   beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zhbmv(int *order, char *uplow, int *n, int *k,
kusano 2b45e8
     CBLAS_TEST_ZOMPLEX *alpha, CBLAS_TEST_ZOMPLEX *a, int *lda, 
kusano 2b45e8
     CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *beta,
kusano 2b45e8
     CBLAS_TEST_ZOMPLEX *y, int *incy){
kusano 2b45e8
kusano 2b45e8
CBLAS_TEST_ZOMPLEX *A;
kusano 2b45e8
int i,irow,j,jcol,LDA;
kusano 2b45e8
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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_zhbmv(CblasRowMajor, UNDEFINED, *n, *k, alpha, a, *lda, x, 
kusano 2b45e8
		 *incx, beta, y, *incy );
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *k+2;
kusano 2b45e8
        A =(CBLAS_TEST_ZOMPLEX*)malloc((*n+*k)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
                 A[ LDA*(j-jcol)+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
              }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
              A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
           }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
              A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
           }
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 ].real=a[ (*lda)*(j-jcol)+i ].real;
kusano 2b45e8
                 A[ LDA*j+irow ].imag=a[ (*lda)*(j-jcol)+i ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_zhbmv( CblasRowMajor, uplo, *n, *k, alpha, A, LDA, x, *incx,
kusano 2b45e8
       		     beta, y, *incy );
kusano 2b45e8
        free(A);
kusano 2b45e8
      }
kusano 2b45e8
   }
kusano 2b45e8
   else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zhbmv(CblasColMajor, uplo, *n, *k, alpha, a, *lda, x, *incx,
kusano 2b45e8
                 beta, y, *incy );
kusano 2b45e8
   else
kusano 2b45e8
     cblas_zhbmv(UNDEFINED, uplo, *n, *k, alpha, a, *lda, x, *incx,
kusano 2b45e8
                 beta, y, *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zhpmv(int *order, char *uplow, int *n, CBLAS_TEST_ZOMPLEX *alpha,
kusano 2b45e8
     CBLAS_TEST_ZOMPLEX *ap, CBLAS_TEST_ZOMPLEX *x, int *incx, 
kusano 2b45e8
     CBLAS_TEST_ZOMPLEX *beta, CBLAS_TEST_ZOMPLEX *y, int *incy){
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
  if (*order == TEST_ROW_MJR) {
kusano 2b45e8
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_zhpmv(CblasRowMajor, UNDEFINED, *n, alpha, ap, x, *incx, 
kusano 2b45e8
	         beta, y, *incy);
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *n;
kusano 2b45e8
        A = (CBLAS_TEST_ZOMPLEX* )malloc(LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX ));
kusano 2b45e8
        AP = (CBLAS_TEST_ZOMPLEX* )malloc( (((LDA+1)*LDA)/2)*
kusano 2b45e8
	        sizeof( CBLAS_TEST_ZOMPLEX ));
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 ].real=ap[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=i; j<*n; j++, k++ ) {
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 AP[ k ].imag=A[ LDA*i+j ].imag;
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 ].real=ap[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=0; j
kusano 2b45e8
	         AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_zhpmv( CblasRowMajor, uplo, *n, alpha, AP, x, *incx, beta, y,
kusano 2b45e8
                     *incy );
kusano 2b45e8
        free(A);
kusano 2b45e8
        free(AP);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zhpmv( CblasColMajor, uplo, *n, alpha, ap, x, *incx, beta, y,
kusano 2b45e8
                  *incy );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zhpmv( UNDEFINED, uplo, *n, alpha, ap, x, *incx, beta, y,
kusano 2b45e8
                  *incy );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_ztbmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
     int *n, int *k, CBLAS_TEST_ZOMPLEX *a, int *lda, CBLAS_TEST_ZOMPLEX *x,
kusano 2b45e8
     int *incx) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_ztbmv(CblasRowMajor, UNDEFINED, trans, diag, *n, *k, a, *lda,
kusano 2b45e8
	x, *incx);
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *k+2;
kusano 2b45e8
        A=(CBLAS_TEST_ZOMPLEX *)malloc((*n+*k)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
                 A[ LDA*(j-jcol)+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
              }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
              A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
           }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
             A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
          }
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 ].real=a[ (*lda)*(j-jcol)+i ].real;
kusano 2b45e8
                A[ LDA*j+irow ].imag=a[ (*lda)*(j-jcol)+i ].imag;
kusano 2b45e8
             }
kusano 2b45e8
          }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_ztbmv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, 
kusano 2b45e8
		    *incx);
kusano 2b45e8
        free(A);
kusano 2b45e8
     }
kusano 2b45e8
   }
kusano 2b45e8
   else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_ztbmv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
   else
kusano 2b45e8
     cblas_ztbmv(UNDEFINED, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_ztbsv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
      int *n, int *k, CBLAS_TEST_ZOMPLEX *a, int *lda, CBLAS_TEST_ZOMPLEX *x,
kusano 2b45e8
      int *incx) {
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_ztbsv(CblasRowMajor, UNDEFINED, trans, diag, *n, *k, a, *lda, x, 
kusano 2b45e8
	         *incx);
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *k+2;
kusano 2b45e8
        A=(CBLAS_TEST_ZOMPLEX*)malloc((*n+*k)*LDA*sizeof(CBLAS_TEST_ZOMPLEX ));
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
                 A[ LDA*(j-jcol)+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
              }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
              A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
           }
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 ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
             A[ LDA*j+irow ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
           }
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 ].real=a[ (*lda)*(j-jcol)+i ].real;
kusano 2b45e8
                 A[ LDA*j+irow ].imag=a[ (*lda)*(j-jcol)+i ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_ztbsv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, 
kusano 2b45e8
		    x, *incx);
kusano 2b45e8
        free(A);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_ztbsv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
  else
kusano 2b45e8
     cblas_ztbsv(UNDEFINED, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_ztpmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
      int *n, CBLAS_TEST_ZOMPLEX *ap, CBLAS_TEST_ZOMPLEX *x, int *incx) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_ztpmv( CblasRowMajor, UNDEFINED, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *n;
kusano 2b45e8
        A=(CBLAS_TEST_ZOMPLEX*)malloc(LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
kusano 2b45e8
        AP=(CBLAS_TEST_ZOMPLEX*)malloc((((LDA+1)*LDA)/2)*
kusano 2b45e8
	 	sizeof(CBLAS_TEST_ZOMPLEX));
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 ].real=ap[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=i; j<*n; j++, k++ ) {
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 AP[ k ].imag=A[ LDA*i+j ].imag;
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 ].real=ap[ k ].real;
kusano 2b45e8
	         A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=0; j
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_ztpmv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
kusano 2b45e8
        free(A);
kusano 2b45e8
        free(AP);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_ztpmv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_ztpmv( UNDEFINED, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_ztpsv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
     int *n, CBLAS_TEST_ZOMPLEX *ap, CBLAS_TEST_ZOMPLEX *x, int *incx) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_ztpsv( CblasRowMajor, UNDEFINED, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *n;
kusano 2b45e8
        A=(CBLAS_TEST_ZOMPLEX*)malloc(LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
kusano 2b45e8
        AP=(CBLAS_TEST_ZOMPLEX*)malloc((((LDA+1)*LDA)/2)*
kusano 2b45e8
		sizeof(CBLAS_TEST_ZOMPLEX));
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 ].real=ap[ k ].real;
kusano 2b45e8
       	         A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=i; j<*n; j++, k++ ) {
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
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 ].real=ap[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=0; j
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_ztpsv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
kusano 2b45e8
        free(A);
kusano 2b45e8
        free(AP);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_ztpsv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_ztpsv( UNDEFINED, uplo, trans, diag, *n, ap, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_ztrmv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
     int *n, CBLAS_TEST_ZOMPLEX *a, int *lda, CBLAS_TEST_ZOMPLEX *x,
kusano 2b45e8
      int *incx) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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=(CBLAS_TEST_ZOMPLEX*)malloc((*n)*LDA*sizeof(CBLAS_TEST_ZOMPLEX));
kusano 2b45e8
     for( i=0; i<*n; i++ )
kusano 2b45e8
       for( j=0; j<*n; j++ ) {
kusano 2b45e8
	  A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
          A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
       }
kusano 2b45e8
     cblas_ztrmv(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_ztrmv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx);
kusano 2b45e8
  else
kusano 2b45e8
     cblas_ztrmv(UNDEFINED, uplo, trans, diag, *n, a, *lda, x, *incx);
kusano 2b45e8
}
kusano 2b45e8
void F77_ztrsv(int *order, char *uplow, char *transp, char *diagn,
kusano 2b45e8
       int *n, CBLAS_TEST_ZOMPLEX *a, int *lda, CBLAS_TEST_ZOMPLEX *x,
kusano 2b45e8
              int *incx) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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 =(CBLAS_TEST_ZOMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
kusano 2b45e8
     for( i=0; i<*n; i++ )
kusano 2b45e8
        for( j=0; j<*n; j++ ) {
kusano 2b45e8
           A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
	   A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
	}
kusano 2b45e8
     cblas_ztrsv(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_ztrsv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx );
kusano 2b45e8
   else
kusano 2b45e8
     cblas_ztrsv(UNDEFINED, uplo, trans, diag, *n, a, *lda, x, *incx );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zhpr(int *order, char *uplow, int *n, double *alpha,
kusano 2b45e8
	     CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *ap) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_zhpr(CblasRowMajor, UNDEFINED, *n, *alpha, x, *incx, ap );
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *n;
kusano 2b45e8
        A = (CBLAS_TEST_ZOMPLEX* )malloc(LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
kusano 2b45e8
        AP = ( CBLAS_TEST_ZOMPLEX* )malloc( (((LDA+1)*LDA)/2)*
kusano 2b45e8
		sizeof( CBLAS_TEST_ZOMPLEX ));
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 ].real=ap[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=i; j<*n; j++, k++ ){
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 AP[ k ].imag=A[ LDA*i+j ].imag;
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 ].real=ap[ k ].real;
kusano 2b45e8
       	         A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=0; j
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 AP[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_zhpr(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 ].real=AP[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=AP[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( j=0, k=0; j<*n; j++ )
kusano 2b45e8
              for( i=0; i
kusano 2b45e8
                 ap[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 ap[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
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 ].real=AP[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=AP[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( j=0, k=0; j<*n; j++ )
kusano 2b45e8
              for( i=j; i<*n; i++, k++ ){
kusano 2b45e8
                 ap[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
                 ap[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        free(A);
kusano 2b45e8
        free(AP);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zhpr(CblasColMajor, uplo, *n, *alpha, x, *incx, ap );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zhpr(UNDEFINED, uplo, *n, *alpha, x, *incx, ap );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zhpr2(int *order, char *uplow, int *n, CBLAS_TEST_ZOMPLEX *alpha,
kusano 2b45e8
       CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *y, int *incy,
kusano 2b45e8
       CBLAS_TEST_ZOMPLEX *ap) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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
     if (uplo != CblasUpper && uplo != CblasLower )
kusano 2b45e8
        cblas_zhpr2( CblasRowMajor, UNDEFINED, *n, alpha, x, *incx, y, 
kusano 2b45e8
		     *incy, ap );
kusano 2b45e8
     else {
kusano 2b45e8
        LDA = *n;
kusano 2b45e8
        A=(CBLAS_TEST_ZOMPLEX*)malloc( LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
kusano 2b45e8
        AP=(CBLAS_TEST_ZOMPLEX*)malloc( (((LDA+1)*LDA)/2)*
kusano 2b45e8
	sizeof( CBLAS_TEST_ZOMPLEX ));
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 ].real=ap[ k ].real;
kusano 2b45e8
	         A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
	      }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=i; j<*n; j++, k++ ) {
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
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 ].real=ap[ k ].real;
kusano 2b45e8
	         A[ LDA*i+j ].imag=ap[ k ].imag;
kusano 2b45e8
	      }
kusano 2b45e8
           for( i=0, k=0; i<*n; i++ )
kusano 2b45e8
              for( j=0; j
kusano 2b45e8
                 AP[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         AP[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
	      }
kusano 2b45e8
        }
kusano 2b45e8
        cblas_zhpr2( 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 ].real=AP[ k ].real;
kusano 2b45e8
                 A[ LDA*i+j ].imag=AP[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( j=0, k=0; j<*n; j++ )
kusano 2b45e8
              for( i=0; i
kusano 2b45e8
                 ap[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         ap[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
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 ].real=AP[ k ].real;
kusano 2b45e8
	         A[ LDA*i+j ].imag=AP[ k ].imag;
kusano 2b45e8
              }
kusano 2b45e8
           for( j=0, k=0; j<*n; j++ )
kusano 2b45e8
              for( i=j; i<*n; i++, k++ ) {
kusano 2b45e8
                 ap[ k ].real=A[ LDA*i+j ].real;
kusano 2b45e8
	         ap[ k ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
              }
kusano 2b45e8
        }
kusano 2b45e8
        free(A);
kusano 2b45e8
        free(AP);
kusano 2b45e8
     }
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zhpr2( CblasColMajor, uplo, *n, alpha, x, *incx, y, *incy, ap );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zhpr2( UNDEFINED, uplo, *n, alpha, x, *incx, y, *incy, ap );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zher(int *order, char *uplow, int *n, double *alpha,
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *a, int *lda) {
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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=(CBLAS_TEST_ZOMPLEX*)malloc((*n)*LDA*sizeof( CBLAS_TEST_ZOMPLEX ));
kusano 2b45e8
kusano 2b45e8
     for( i=0; i<*n; i++ ) 
kusano 2b45e8
       for( j=0; j<*n; j++ ) {
kusano 2b45e8
	  A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
          A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
       }
kusano 2b45e8
kusano 2b45e8
     cblas_zher(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 ].real=A[ LDA*i+j ].real;
kusano 2b45e8
          a[ (*lda)*j+i ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
       }
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zher( CblasColMajor, uplo, *n, *alpha, x, *incx, a, *lda );
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zher( UNDEFINED, uplo, *n, *alpha, x, *incx, a, *lda );
kusano 2b45e8
}
kusano 2b45e8
kusano 2b45e8
void F77_zher2(int *order, char *uplow, int *n, CBLAS_TEST_ZOMPLEX *alpha,
kusano 2b45e8
          CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *y, int *incy,
kusano 2b45e8
	  CBLAS_TEST_ZOMPLEX *a, int *lda) {
kusano 2b45e8
kusano 2b45e8
  CBLAS_TEST_ZOMPLEX *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= ( CBLAS_TEST_ZOMPLEX* )malloc((*n)*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
kusano 2b45e8
kusano 2b45e8
     for( i=0; i<*n; i++ ) 
kusano 2b45e8
       for( j=0; j<*n; j++ ) {
kusano 2b45e8
	  A[ LDA*i+j ].real=a[ (*lda)*j+i ].real;
kusano 2b45e8
          A[ LDA*i+j ].imag=a[ (*lda)*j+i ].imag;
kusano 2b45e8
       }
kusano 2b45e8
kusano 2b45e8
     cblas_zher2(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 ].real=A[ LDA*i+j ].real;
kusano 2b45e8
          a[ (*lda)*j+i ].imag=A[ LDA*i+j ].imag;
kusano 2b45e8
       }
kusano 2b45e8
     free(A);
kusano 2b45e8
  }
kusano 2b45e8
  else if (*order == TEST_COL_MJR)
kusano 2b45e8
     cblas_zher2( CblasColMajor, uplo, *n, alpha, x, *incx, y, *incy, a, *lda);
kusano 2b45e8
  else
kusano 2b45e8
     cblas_zher2( UNDEFINED, uplo, *n, alpha, x, *incx, y, *incy, a, *lda);
kusano 2b45e8
}