From b1f415fe047e72e122f8c2b7a2d2d3cf997f94e4 Mon Sep 17 00:00:00 2001 From: jiri Date: Wed, 16 Apr 2008 12:56:02 +0000 Subject: [PATCH] *** empty log message *** --- mat.cc | 45 +++++++-------------------------------------- vec.h | 14 ++++---------- 2 files changed, 11 insertions(+), 48 deletions(-) diff --git a/mat.cc b/mat.cc index e467085..f393596 100644 --- a/mat.cc +++ b/mat.cc @@ -913,24 +913,6 @@ NRMat< complex >::operator*(const NRSMat< complex > &rhs) const -// sum of rows -template<> -const NRVec NRMat::rsum() const -{ - NRVec result(mm); - for (int i=0; i -const NRVec NRMat::csum() const -{ - NRVec result(nn); - for (int i=0; i NRMat &NRMat::conjugateme() {return *this;} @@ -1082,37 +1064,24 @@ void NRMat< complex >::axpy(const complex alpha, // trace of Mat -template<> -const double NRMat::trace() const +template +const T NRMat::trace() const { #ifdef DEBUG if (nn != mm) laerror("no-square matrix in Mat::trace()"); #endif - return cblas_dasum(nn, (*this)[0], nn+1); - - -} - - - -template<> -const complex NRMat< complex >::trace() const -{ -#ifdef DEBUG - if (nn != mm) laerror("no-square matrix in Mat::trace()"); -#endif - register complex sum = CZERO; - for (int i=0; i diff --git a/vec.h b/vec.h index 33c4d86..4a61365 100644 --- a/vec.h +++ b/vec.h @@ -103,7 +103,8 @@ public: const NRVec operator*(const NRSMat &mat) const {NRVec result(mat.ncols()); result.gemv((T)0,mat,'t',(T)1,*this); return result;}; const NRVec operator*(const SparseMat &mat) const {NRVec result(mat.ncols()); result.gemv((T)0,mat,'t',(T)1,*this); return result;}; const NRMat operator|(const NRVec &rhs) const; - inline const T sum() const; //sum of its elements + inline const T sum() const {T sum=0; for(int i=0; i::operator*(const NRVec &rhs) const // Sum of elements template<> -inline const double NRVec::sum() const +inline const double NRVec::asum() const { return cblas_dasum(nn, v, 1); } -template<> -inline const complex -NRVec< complex >::sum() const -{ - complex sum = CZERO; - for (int i=0; i