From 7172e26a50aa853734ce2368fb88363881b012cb Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Thu, 8 Feb 2024 15:01:06 +0100 Subject: [PATCH] bugfix in NRMat:: rsum() and csum() --- mat.cc | 46 +++++++++++++++++++++++----------------------- mat.h | 4 ++-- t.cc | 8 ++++++-- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/mat.cc b/mat.cc index 78d0750..a41cf70 100644 --- a/mat.cc +++ b/mat.cc @@ -593,12 +593,12 @@ const NRMat NRMat::operator|(const NRMat &b) const { template const NRVec NRMat::csum() const { NOT_GPU(*this); - NRVec result(nn, getlocation()); + NRVec result(mm, getlocation()); T sum; - for(register int i=0; i NRMat::csum() const { ******************************************************************************/ template <> const NRVec NRMat::csum() const { - NRVec result(nn, getlocation()); - result = 0.0; + NRVec result(mm, getlocation()); + result.clear(); #ifdef CUDALA if(location == cpu){ #endif for(register int i=0; i NRMat::csum() const { ******************************************************************************/ template <> const NRVec > NRMat >::csum() const { - NRVec > result(nn, getlocation()); - result = 0.0; + NRVec > result(mm, getlocation()); + result.clear(); #ifdef CUDALA if(location == cpu){ #endif for(register int i=0;i > NRMat >::csum() const { template const NRVec NRMat::rsum() const { NOT_GPU(*this); - NRVec result(mm, getlocation()); + NRVec result(nn, getlocation()); T sum; - for(register int i=0; i NRMat::rsum() const { ******************************************************************************/ template <> const NRVec NRMat::rsum() const { - NRVec result(mm, getlocation()); - result = 0.0; + NRVec result(nn, getlocation()); + result.clear(); #ifdef CUDALA if(location == cpu){ #endif for(register int i=0;i NRMat::rsum() const { ******************************************************************************/ template <> const NRVec > NRMat >::rsum() const { - NRVec > result(mm, getlocation()); - result = 0.0; + NRVec > result(nn, getlocation()); + result.clear(); #ifdef CUDALA if(location == cpu){ #endif for(register int i=0;i timestransposed() const; - //! sum the rows + //! sum numbers in the rows (sum over column index) const NRVec rsum() const; - //! sum the columns + //! sum numbers in the columns (sum over row index) const NRVec csum() const; //! orthonormalize this matrix diff --git a/t.cc b/t.cc index b796cc3..2b8366d 100644 --- a/t.cc +++ b/t.cc @@ -2461,7 +2461,7 @@ Polynomial pp({1,2,3,4,5}); cout< a; +cin>>a; +cout <