level2_cplx_impl.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
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   // check arguments
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     // TODO performs a direct call to the underlying implementation function
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 // int EIGEN_BLAS_FUNC(hbmv)(char *uplo, int *n, int *k, RealScalar *alpha, RealScalar *a, int *lda,
00085 //                           RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
00086 // {
00087 //   return 1;
00088 // }
00089 
00097 // int EIGEN_BLAS_FUNC(hpmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
00098 // {
00099 //   return 1;
00100 // }
00101 
00109 // int EIGEN_BLAS_FUNC(hpr)(char *uplo, int *n, RealScalar *alpha, RealScalar *x, int *incx, RealScalar *ap)
00110 // {
00111 //   return 1;
00112 // }
00113 
00121 // int EIGEN_BLAS_FUNC(hpr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *x, int *incx, RealScalar *y, int *incy, RealScalar *ap)
00122 // {
00123 //   return 1;
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   // TODO perform direct calls to underlying implementation
00153 //   if(UPLO(*uplo)==LO)       matrix(a,*n,*n,*lda).selfadjointView<Lower>().rankUpdate(vector(x_cpy,*n), alpha);
00154 //   else if(UPLO(*uplo)==UP)  matrix(a,*n,*n,*lda).selfadjointView<Upper>().rankUpdate(vector(x_cpy,*n), alpha);
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   // TODO perform direct calls to underlying implementation
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   // TODO perform direct calls to underlying implementation
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   // TODO perform direct calls to underlying implementation
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 }


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:32:56