From 89cc0c5b1eb6aac66cd976e4e3e1e5e7c731a61e Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Fri, 14 Nov 2025 16:15:58 +0100 Subject: [PATCH] small fixes in permutation --- permutation.cc | 13 +------------ permutation.h | 19 +++++++++++++++---- vec.h | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/permutation.cc b/permutation.cc index bc56247..db82546 100644 --- a/permutation.cc +++ b/permutation.cc @@ -804,16 +804,6 @@ for(int i=0; isize(); ++i) {res[i].perm = (*this)[i].perm * rhs; res[i]. return res; } -template template -PermutationAlgebra NRPerm::operator*(const PermutationAlgebra &pa) const -{ -PermutationAlgebra res(pa.size()); -for(int i=0; i PermutationAlgebra PermutationAlgebra::operator&(const PermutationAlgebra &rhs) const @@ -2201,8 +2191,7 @@ INSTANTIZE(unsigned int) INSTANTIZE2(int,int) - - INSTANTIZE2(int,double) +INSTANTIZE2(int,std::complex) }//namespace diff --git a/permutation.h b/permutation.h index a926f60..81e83b8 100644 --- a/permutation.h +++ b/permutation.h @@ -108,6 +108,7 @@ return r; } + template class WeightPermutation { public: @@ -115,11 +116,11 @@ public: NRPerm perm; int size() const {return perm.size();}; - bool is_zero() const {return weight==0;} + bool is_zero() const {return weight==(R)0;} bool is_scaledidentity() const {return perm.is_identity();} - bool is_identity() const {return weight==1 && is_scaledidentity();} + bool is_identity() const {return weight==(R)1 && is_scaledidentity();} bool is_plaindata() const {return false;}; - WeightPermutation() : weight(0) {}; + WeightPermutation() : weight((R)0) {}; explicit WeightPermutation(const NRPerm &p, const R w=1) : weight(w), perm(p) {}; void copyonwrite() {perm.copyonwrite();}; WeightPermutation operator&(const WeightPermutation &rhs) const {return WeightPermutation(perm&rhs.perm,weight*rhs.weight);}; @@ -147,7 +148,7 @@ public: static void copyonwrite(WeightPermutation& x) {x.perm.copyonwrite();}; typedef typename LA_traits::normtype normtype; typedef R coefficienttype; - typedef NRPerm elementtype; + typedef R elementtype; //is needed for nrvec::simplify(), not typedef NRPerm elementtype; static inline bool smaller(const WeightPermutation& x, const WeightPermutation& y) {return x.perm& x, const WeightPermutation& y) {return x.perm>y.perm;}; static R coefficient(const WeightPermutation& x){return x.weight;}; @@ -448,5 +449,15 @@ for(int i=0; i template +PermutationAlgebra NRPerm::operator*(const PermutationAlgebra &pa) const +{ +PermutationAlgebra res(pa.size()); +for(int i=0; i inline NRVec(const T (&a)[SIZE]); //! inlined constructor creating vector of given size filled with data located at given memory location @@ -2096,7 +2096,7 @@ for(int next=1; next::coefficient(x[next])==0 || LA_traits::abscoefficient(x[next]) ::coefficient(x[next])==(typename LA_traits::elementtype)0 || LA_traits::abscoefficient(x[next])