00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "common.h"
00026
00034 int EIGEN_BLAS_FUNC(hemv)(char *uplo, int *n, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *px, int *incx, RealScalar *pbeta, RealScalar *py, int *incy)
00035 {
00036 Scalar* a = reinterpret_cast<Scalar*>(pa);
00037 Scalar* x = reinterpret_cast<Scalar*>(px);
00038 Scalar* y = reinterpret_cast<Scalar*>(py);
00039 Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
00040 Scalar beta = *reinterpret_cast<Scalar*>(pbeta);
00041
00042
00043 int info = 0;
00044 if(UPLO(*uplo)==INVALID) info = 1;
00045 else if(*n<0) info = 2;
00046 else if(*lda<std::max(1,*n)) info = 5;
00047 else if(*incx==0) info = 7;
00048 else if(*incy==0) info = 10;
00049 if(info)
00050 return xerbla_(SCALAR_SUFFIX_UP"HEMV ",&info,6);
00051
00052 if(*n==0)
00053 return 1;
00054
00055 Scalar* actual_x = get_compact_vector(x,*n,*incx);
00056 Scalar* actual_y = get_compact_vector(y,*n,*incy);
00057
00058 if(beta!=Scalar(1))
00059 {
00060 if(beta==Scalar(0)) vector(actual_y, *n).setZero();
00061 else vector(actual_y, *n) *= beta;
00062 }
00063
00064 if(alpha!=Scalar(0))
00065 {
00066
00067 if(UPLO(*uplo)==UP) vector(actual_y,*n).noalias() += matrix(a,*n,*n,*lda).selfadjointView<Upper>() * (alpha * vector(actual_x,*n));
00068 else if(UPLO(*uplo)==LO) vector(actual_y,*n).noalias() += matrix(a,*n,*n,*lda).selfadjointView<Lower>() * (alpha * vector(actual_x,*n));
00069 }
00070
00071 if(actual_x!=x) delete[] actual_x;
00072 if(actual_y!=y) delete[] copy_back(actual_y,y,*n,*incy);
00073
00074 return 1;
00075 }
00076
00084
00085
00086
00087
00088
00089
00097
00098
00099
00100
00101
00109
00110
00111
00112
00113
00121
00122
00123
00124
00125
00133 int EIGEN_BLAS_FUNC(her)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pa, int *lda)
00134 {
00135 Scalar* x = reinterpret_cast<Scalar*>(px);
00136 Scalar* a = reinterpret_cast<Scalar*>(pa);
00137 RealScalar alpha = *reinterpret_cast<RealScalar*>(palpha);
00138
00139 int info = 0;
00140 if(UPLO(*uplo)==INVALID) info = 1;
00141 else if(*n<0) info = 2;
00142 else if(*incx==0) info = 5;
00143 else if(*lda<std::max(1,*n)) info = 7;
00144 if(info)
00145 return xerbla_(SCALAR_SUFFIX_UP"HER ",&info,6);
00146
00147 if(alpha==RealScalar(0))
00148 return 1;
00149
00150 Scalar* x_cpy = get_compact_vector(x, *n, *incx);
00151
00152
00153
00154
00155
00156 if(UPLO(*uplo)==LO)
00157 for(int j=0;j<*n;++j)
00158 matrix(a,*n,*n,*lda).col(j).tail(*n-j) += alpha * internal::conj(x_cpy[j]) * vector(x_cpy+j,*n-j);
00159 else
00160 for(int j=0;j<*n;++j)
00161 matrix(a,*n,*n,*lda).col(j).head(j+1) += alpha * internal::conj(x_cpy[j]) * vector(x_cpy,j+1);
00162
00163 matrix(a,*n,*n,*lda).diagonal().imag().setZero();
00164
00165 if(x_cpy!=x) delete[] x_cpy;
00166
00167 return 1;
00168 }
00169
00177 int EIGEN_BLAS_FUNC(her2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
00178 {
00179 Scalar* x = reinterpret_cast<Scalar*>(px);
00180 Scalar* y = reinterpret_cast<Scalar*>(py);
00181 Scalar* a = reinterpret_cast<Scalar*>(pa);
00182 Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
00183
00184 int info = 0;
00185 if(UPLO(*uplo)==INVALID) info = 1;
00186 else if(*n<0) info = 2;
00187 else if(*incx==0) info = 5;
00188 else if(*incy==0) info = 7;
00189 else if(*lda<std::max(1,*n)) info = 9;
00190 if(info)
00191 return xerbla_(SCALAR_SUFFIX_UP"HER2 ",&info,6);
00192
00193 if(alpha==Scalar(0))
00194 return 1;
00195
00196 Scalar* x_cpy = get_compact_vector(x, *n, *incx);
00197 Scalar* y_cpy = get_compact_vector(y, *n, *incy);
00198
00199
00200 if(UPLO(*uplo)==LO) matrix(a,*n,*n,*lda).selfadjointView<Lower>().rankUpdate(vector(x_cpy,*n),vector(y_cpy,*n),alpha);
00201 else if(UPLO(*uplo)==UP) matrix(a,*n,*n,*lda).selfadjointView<Upper>().rankUpdate(vector(x_cpy,*n),vector(y_cpy,*n),alpha);
00202
00203 matrix(a,*n,*n,*lda).diagonal().imag().setZero();
00204
00205 if(x_cpy!=x) delete[] x_cpy;
00206 if(y_cpy!=y) delete[] y_cpy;
00207
00208 return 1;
00209 }
00210
00218 int EIGEN_BLAS_FUNC(geru)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
00219 {
00220 Scalar* x = reinterpret_cast<Scalar*>(px);
00221 Scalar* y = reinterpret_cast<Scalar*>(py);
00222 Scalar* a = reinterpret_cast<Scalar*>(pa);
00223 Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
00224
00225 int info = 0;
00226 if(*m<0) info = 1;
00227 else if(*n<0) info = 2;
00228 else if(*incx==0) info = 5;
00229 else if(*incy==0) info = 7;
00230 else if(*lda<std::max(1,*m)) info = 9;
00231 if(info)
00232 return xerbla_(SCALAR_SUFFIX_UP"GERU ",&info,6);
00233
00234 if(alpha==Scalar(0))
00235 return 1;
00236
00237 Scalar* x_cpy = get_compact_vector(x,*m,*incx);
00238 Scalar* y_cpy = get_compact_vector(y,*n,*incy);
00239
00240
00241 matrix(a,*m,*n,*lda) += alpha * vector(x_cpy,*m) * vector(y_cpy,*n).transpose();
00242
00243 if(x_cpy!=x) delete[] x_cpy;
00244 if(y_cpy!=y) delete[] y_cpy;
00245
00246 return 1;
00247 }
00248
00256 int EIGEN_BLAS_FUNC(gerc)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
00257 {
00258 Scalar* x = reinterpret_cast<Scalar*>(px);
00259 Scalar* y = reinterpret_cast<Scalar*>(py);
00260 Scalar* a = reinterpret_cast<Scalar*>(pa);
00261 Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
00262
00263 int info = 0;
00264 if(*m<0) info = 1;
00265 else if(*n<0) info = 2;
00266 else if(*incx==0) info = 5;
00267 else if(*incy==0) info = 7;
00268 else if(*lda<std::max(1,*m)) info = 9;
00269 if(info)
00270 return xerbla_(SCALAR_SUFFIX_UP"GERC ",&info,6);
00271
00272 if(alpha==Scalar(0))
00273 return 1;
00274
00275 Scalar* x_cpy = get_compact_vector(x,*m,*incx);
00276 Scalar* y_cpy = get_compact_vector(y,*n,*incy);
00277
00278
00279 matrix(a,*m,*n,*lda) += alpha * vector(x_cpy,*m) * vector(y_cpy,*n).adjoint();
00280
00281 if(x_cpy!=x) delete[] x_cpy;
00282 if(y_cpy!=y) delete[] y_cpy;
00283
00284 return 1;
00285 }