small addition to permutation.h

This commit is contained in:
Jiri Pittner 2024-01-18 13:29:08 +01:00
parent 8bc2179f3b
commit ae83e43b4e
2 changed files with 13 additions and 3 deletions

View File

@ -121,6 +121,7 @@ public:
WeightPermutation operator*(const R &x) const {return WeightPermutation(weight*x,perm); } WeightPermutation operator*(const R &x) const {return WeightPermutation(weight*x,perm); }
bool operator==(const WeightPermutation &rhs) const {return this->perm == rhs.perm;}; //NOTE for sorting, compares only the permutation not the weight! bool operator==(const WeightPermutation &rhs) const {return this->perm == rhs.perm;}; //NOTE for sorting, compares only the permutation not the weight!
bool operator!=(const WeightPermutation &rhs) const {return !(*this==rhs);} //NOTE: compares only the permutation
bool operator>(const WeightPermutation &rhs) const {return this->perm > rhs.perm;}; bool operator>(const WeightPermutation &rhs) const {return this->perm > rhs.perm;};
bool operator<(const WeightPermutation &rhs) const {return this->perm < rhs.perm;}; bool operator<(const WeightPermutation &rhs) const {return this->perm < rhs.perm;};
bool operator>=(const WeightPermutation &rhs) const {return !(*this < rhs);}; bool operator>=(const WeightPermutation &rhs) const {return !(*this < rhs);};
@ -185,8 +186,8 @@ public:
void simplify(const typename LA_traits<R>::normtype thr=0) {NRVec_simplify(*this,thr);}; void simplify(const typename LA_traits<R>::normtype thr=0) {NRVec_simplify(*this,thr);};
bool operator==(PermutationAlgebra &rhs); //do NOT inherit from NRVec, as the underlying one ignores weights for the simplification; also we have to simplify before comparison bool operator==(PermutationAlgebra &rhs); //do NOT inherit from NRVec, as the underlying one ignores weights for the simplification; also we have to simplify before comparison
bool is_zero() const {return size()==0;}; //assume it was simplified bool is_zero() const {return size()==0;}; //assume it was simplified
bool is_scaled_identity() const {return size()==1 && (*this)[0]. is_scaledidentity();}; //assume it was simplified bool is_scaled_identity() const {return size()==1 && (*this)[0].is_scaledidentity();}; //assume it was simplified
bool is_identity() const {return size()==1 && (*this)[0]. is_identity();}; //assume it was simplified bool is_identity() const {return size()==1 && (*this)[0].is_identity();}; //assume it was simplified
}; };

11
t.cc
View File

@ -3095,7 +3095,16 @@ for(int i=0; i<a.size(); ++i)
if(1) if(1)
{ {
//this is kucharskiP antisymmetrizer just without parsing the input /*this is kucharskiP antisymmetrizer just without parsing the input
generate antisymmetrization operator for Brandow diagrams in the Kucharski convention
#NOTE: permgener conserves order in the subsets,
#this means that the permuted elements label places
#in the expression, not the indices, since places
#correspond to already existing antisymmetry
#in principle it would be more logical to printout permutation of places rather than indices
#but this is more convenient for further processing
*/
NRVec<NRVec_from1<int> > groups; NRVec<NRVec_from1<int> > groups;
cin >> groups; cin >> groups;
int ntot=0; int ntot=0;