From 5b3dced5bb562353431bac492bc2c411344417b9 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Fri, 24 Sep 2021 17:32:20 +0200 Subject: [PATCH] bugfix in putext() in fourindex.h --- fourindex.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fourindex.h b/fourindex.h index 84f48c8..932b33d 100644 --- a/fourindex.h +++ b/fourindex.h @@ -814,7 +814,9 @@ void fourindex_dense::putext(int f, T thr) T y; for(int i=1; i<=nbas(); ++i) for(int j=1; j<=i; ++j) for(int k=1; k<=nbas(); ++k) for(int l=1; l<=k; ++l) - if((y=abs((*this)(i,j,k,l))) > thr) + { + y=(*this)(i,j,k,l); + if(abs(y)>thr) { matel4stored x; x.elem= y; @@ -825,6 +827,7 @@ for(int i=1; i<=nbas(); ++i) for(int j=1; j<=i; ++j) if(sizeof(matel4stored) != write(f,&x,sizeof(matel4stored)) ) laerror("write error in putext"); } + } } @@ -916,7 +919,9 @@ void fourindex_dense::putext(int f, T thr) T y; for(int i=1; i<=nbas(); ++i) for(int j=1; j<=i; ++j) for(int k=1; k<=i; ++k) for(int l=1; l<=(i==k?j:k); ++l) - if((y=abs((*this)(i,j,k,l))) > thr) + { + y=(*this)(i,j,k,l); + if(abs(y) > thr) { matel4stored x; x.elem= y; @@ -927,6 +932,7 @@ for(int i=1; i<=nbas(); ++i) for(int j=1; j<=i; ++j) if(sizeof(matel4stored) != write(f,&x,sizeof(matel4stored)) ) laerror("write error in putext"); } + } }