From 252313f3d0790df76f1e7280b34563bd4d0ac6c9 Mon Sep 17 00:00:00 2001 From: jiri Date: Wed, 22 Sep 2010 13:38:12 +0000 Subject: [PATCH] *** empty log message *** --- noncblas.cc | 33 +++++++++++++++++++++++++++++++-- sparsesmat.h | 6 ++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/noncblas.cc b/noncblas.cc index 7c6b162..6cb958d 100644 --- a/noncblas.cc +++ b/noncblas.cc @@ -246,20 +246,49 @@ void cblas_dger(const enum CBLAS_ORDER Order, const int M, const int N, #endif } +extern "C" void FORNAME(zgerc) (const FINT *m, const FINT *n, const void *alpha, const void *x, const FINT *incx, const void *y, const FINT *incy, void *a, const FINT *lda); void cblas_zgerc(const enum CBLAS_ORDER Order, const int M, const int N, const void *alpha, const void *X, const int incX, const void *Y, const int incY, void *A, const int lda) { - laerror("cblas_zgerc cannot be simply converted to fortran order"); + if(Order!=CblasRowMajor) laerror("CblasRowMajor order asserted"); +//conjugate y +complex *p; +p= (complex *) Y; for(int i=0; iimag() = -p->imag(); p+= incY;} +#ifdef FORINT + const FINT mtmp=M; + const FINT ntmp=N; + const FINT incxtmp=incX; + const FINT incytmp=incY; + const FINT ldatmp=lda; + FORNAME(zgerc) (&ntmp, &mtmp, alpha, Y, &incytmp, X, &incxtmp, A, &ldatmp); +#else + FORNAME(zgerc)(&N, &M, alpha, Y, &incY, X, &incX, A, &lda); +#endif +//conjugate y back +p= (complex *) Y; for(int i=0; iimag() = -p->imag(); p+= incY;} } + +extern "C" void FORNAME(zgeru) (const FINT *m, const FINT *n, const void *alpha, const void *x, const FINT *incx, const void *y, const FINT *incy, void *a, const FINT *lda); void cblas_zgeru(const enum CBLAS_ORDER Order, const int M, const int N, const void *alpha, const void *X, const int incX, const void *Y, const int incY, void *A, const int lda) { - laerror("cblas_zgeru cannot be simply converted to fortran order"); + if(Order!=CblasRowMajor) laerror("CblasRowMajor order asserted"); +#ifdef FORINT + const FINT mtmp=M; + const FINT ntmp=N; + const FINT incxtmp=incX; + const FINT incytmp=incY; + const FINT ldatmp=lda; + FORNAME(zgeru) (&ntmp, &mtmp, alpha, Y, &incytmp, X, &incxtmp, A, &ldatmp); +#else + FORNAME(zgeru)(&N, &M, alpha, Y, &incY, X, &incX, A, &lda); +#endif } + extern "C" void FORNAME(dgemm) (const char *transa, const char *transb, const FINT *m, const FINT *n, const FINT *k, const double *alpha, const double *a, const FINT *lda, const double *b, const FINT *ldb, const double *beta, double *c, const FINT *ldc); void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N, diff --git a/sparsesmat.h b/sparsesmat.h index 7af682c..6a98609 100644 --- a/sparsesmat.h +++ b/sparsesmat.h @@ -223,6 +223,9 @@ NRSMat::NRSMat(const SparseSMat &rhs) : nn(rhs.nrows()) { if(rhs.nrows()!=rhs.ncols()) laerror("cannot transform rectangular matrix to NRSMat"); +#ifdef CUDALA + location = cpu; +#endif count = new int(1); v=new T[nn2]; memset(v,0,nn2*sizeof(T)); @@ -239,6 +242,9 @@ nn(rhs.nrows()), mm(rhs.ncols()), count(new int(1)) { +#ifdef CUDALA + location = cpu; +#endif #ifdef MATPTR v = new T*[nn]; v[0] = new T[mm*nn];