00001
00002
00003
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include "cblas.h"
00011 #include "cblas_f77.h"
00012 void cblas_zhpmv(const enum CBLAS_ORDER order,
00013 const enum CBLAS_UPLO Uplo,const int N,
00014 const void *alpha, const void *AP,
00015 const void *X, const int incX, const void *beta,
00016 void *Y, const int incY)
00017 {
00018 char UL;
00019 #ifdef F77_CHAR
00020 F77_CHAR F77_UL;
00021 #else
00022 #define F77_UL &UL
00023 #endif
00024 #ifdef F77_INT
00025 F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_incX=incX, F77_incY=incY;
00026 #else
00027 #define F77_N N
00028 #define F77_incX incx
00029 #define F77_incY incY
00030 #endif
00031 int n, i=0, incx=incX;
00032 const double *xx= (double *)X, *alp= (double *)alpha, *bet = (double *)beta;
00033 double ALPHA[2],BETA[2];
00034 int tincY, tincx;
00035 double *x=(double *)X, *y=(double *)Y, *st=0, *tx;
00036 extern int CBLAS_CallFromC;
00037 extern int RowMajorStrg;
00038 RowMajorStrg = 0;
00039
00040 CBLAS_CallFromC = 1;
00041 if (order == CblasColMajor)
00042 {
00043 if (Uplo == CblasLower) UL = 'L';
00044 else if (Uplo == CblasUpper) UL = 'U';
00045 else
00046 {
00047 cblas_xerbla(2, "cblas_zhpmv","Illegal Uplo setting, %d\n",Uplo );
00048 CBLAS_CallFromC = 0;
00049 RowMajorStrg = 0;
00050 return;
00051 }
00052 #ifdef F77_CHAR
00053 F77_UL = C2F_CHAR(&UL);
00054 #endif
00055 F77_zhpmv(F77_UL, &F77_N, alpha, AP, X,
00056 &F77_incX, beta, Y, &F77_incY);
00057 }
00058 else if (order == CblasRowMajor)
00059 {
00060 RowMajorStrg = 1;
00061 ALPHA[0]= *alp;
00062 ALPHA[1]= -alp[1];
00063 BETA[0]= *bet;
00064 BETA[1]= -bet[1];
00065
00066 if (N > 0)
00067 {
00068 n = N << 1;
00069 x = malloc(n*sizeof(double));
00070
00071 tx = x;
00072 if( incX > 0 ) {
00073 i = incX << 1;
00074 tincx = 2;
00075 st= x+n;
00076 } else {
00077 i = incX *(-2);
00078 tincx = -2;
00079 st = x-2;
00080 x +=(n-2);
00081 }
00082
00083 do
00084 {
00085 *x = *xx;
00086 x[1] = -xx[1];
00087 x += tincx ;
00088 xx += i;
00089 }
00090 while (x != st);
00091 x=tx;
00092
00093
00094 #ifdef F77_INT
00095 F77_incX = 1;
00096 #else
00097 incx = 1;
00098 #endif
00099
00100 if(incY > 0)
00101 tincY = incY;
00102 else
00103 tincY = -incY;
00104 y++;
00105
00106 i = tincY << 1;
00107 n = i * N ;
00108 st = y + n;
00109 do {
00110 *y = -(*y);
00111 y += i;
00112 } while(y != st);
00113 y -= n;
00114 } else
00115 x = (double *) X;
00116
00117
00118 if (Uplo == CblasUpper) UL = 'L';
00119 else if (Uplo == CblasLower) UL = 'U';
00120 else
00121 {
00122 cblas_xerbla(2, "cblas_zhpmv","Illegal Uplo setting, %d\n", Uplo );
00123 CBLAS_CallFromC = 0;
00124 RowMajorStrg = 0;
00125 return;
00126 }
00127 #ifdef F77_CHAR
00128 F77_UL = C2F_CHAR(&UL);
00129 #endif
00130
00131 F77_zhpmv(F77_UL, &F77_N, ALPHA,
00132 AP, x, &F77_incX, BETA, Y, &F77_incY);
00133 }
00134 else
00135 {
00136 cblas_xerbla(1, "cblas_zhpmv","Illegal Order setting, %d\n", order);
00137 CBLAS_CallFromC = 0;
00138 RowMajorStrg = 0;
00139 return;
00140 }
00141 if ( order == CblasRowMajor )
00142 {
00143 RowMajorStrg = 1;
00144 if(X!=x)
00145 free(x);
00146 if (N > 0)
00147 {
00148 do
00149 {
00150 *y = -(*y);
00151 y += i;
00152 }
00153 while (y != st);
00154 }
00155 }
00156
00157 CBLAS_CallFromC = 0;
00158 RowMajorStrg = 0;
00159 return;
00160 }