From 60fd23b37c7446ee433f8ab7f4ecac7cd3c2e11a Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Thu, 11 Jan 2024 18:04:25 +0100 Subject: [PATCH] introduced permutation group algebra class --- permutation.cc | 11 +++++++++-- permutation.h | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/permutation.cc b/permutation.cc index 4798ab7..f7396b3 100644 --- a/permutation.cc +++ b/permutation.cc @@ -95,7 +95,7 @@ return q; } template -NRPerm NRPerm::operator+(const NRPerm &q) const +NRPerm NRPerm::operator&(const NRPerm &q) const { #ifdef DEBUG if(!this->is_valid() || !q.is_valid()) laerror("concatenation of invalid permutation"); @@ -108,7 +108,7 @@ return r; } template -NRPerm NRPerm::operator-(const NRPerm &q) const +NRPerm NRPerm::operator|(const NRPerm &q) const { #ifdef DEBUG if(!this->is_valid() || !q.is_valid()) laerror("concatenation of invalid permutation"); @@ -1940,9 +1940,16 @@ template T Sn_character(const Partition &irrep, const Partition &cclass); template std::ostream & operator<<(std::ostream &s, const Sn_characters &x); \ +#define INSTANTIZE2(T,R) \ +template class WeightPermutation; \ +template class PermutationAlgebra; \ + + INSTANTIZE(int) INSTANTIZE(unsigned int) +INSTANTIZE2(int,double) + diff --git a/permutation.h b/permutation.h index 9a9ca69..99eccc1 100644 --- a/permutation.h +++ b/permutation.h @@ -37,6 +37,8 @@ template class CyclePerm; template class Partition; template class CompressedPartition; template class YoungTableaux; +template class WeightPermutation; +template class PermutationAlgebra; template class NRPerm : public NRVec_from1 { @@ -56,8 +58,8 @@ public: bool is_identity() const; NRPerm inverse() const; NRPerm reverse() const; //backward order - NRPerm operator+(const NRPerm &rhs) const; //concatenate the permutations this,rhs, renumbering rhs (not commutative) - NRPerm operator-(const NRPerm &rhs) const; //concatenate the permutations rhs,this, renumbering rhs (not commutative) + NRPerm operator&(const NRPerm &rhs) const; //concatenate the permutations this,rhs, renumbering rhs (not commutative) + NRPerm operator|(const NRPerm &rhs) const; //concatenate the permutations rhs,this, renumbering rhs (not commutative) NRPerm operator*(const NRPerm &q) const; //q is rhs and applied first, this applied second NRPerm operator*(const CyclePerm &r) const; NRPerm conjugate_by(const NRPerm &q) const; //q^-1 p q @@ -76,6 +78,33 @@ public: NRPerm pow(const int n) const {return power(*this,n);}; }; +template +class WeightPermutation { +public: + R weight; + NRPerm perm; + + WeightPermutation() : weight(0) {}; + WeightPermutation(const R w, const NRPerm &p) : weight(w), perm(p) {}; + WeightPermutation(const NRPerm &p) : perm(p) {weight= p.parity();}; + void copyonwrite() {perm.copyonwrite();}; + +}; + +template +class PermutationAlgebra : public NRVec > +{ +public: + PermutationAlgebra() {}; + PermutationAlgebra(const YoungTableaux &y);// Young antisymmetrizer TODO@@@ + +}; + +//TODO@@@ iostream for WeightPermutation and PermutationAlgebra + +//TODO@@@ permutationalgebra for Kucharski style antisymmetrizers + + extern PERM_RANK_TYPE factorial(const int n); extern PERM_RANK_TYPE binom(int n, int k); extern PERM_RANK_TYPE longpow(PERM_RANK_TYPE x, int i);