introduced permutation group algebra class

This commit is contained in:
Jiri Pittner 2024-01-11 18:04:25 +01:00
parent 387491204c
commit 60fd23b37c
2 changed files with 40 additions and 4 deletions

View File

@ -95,7 +95,7 @@ return q;
}
template <typename T>
NRPerm<T> NRPerm<T>::operator+(const NRPerm<T> &q) const
NRPerm<T> NRPerm<T>::operator&(const NRPerm<T> &q) const
{
#ifdef DEBUG
if(!this->is_valid() || !q.is_valid()) laerror("concatenation of invalid permutation");
@ -108,7 +108,7 @@ return r;
}
template <typename T>
NRPerm<T> NRPerm<T>::operator-(const NRPerm<T> &q) const
NRPerm<T> NRPerm<T>::operator|(const NRPerm<T> &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<T> &irrep, const Partition<T> &cclass);
template std::ostream & operator<<(std::ostream &s, const Sn_characters<T> &x); \
#define INSTANTIZE2(T,R) \
template class WeightPermutation<T,R>; \
template class PermutationAlgebra<T,R>; \
INSTANTIZE(int)
INSTANTIZE(unsigned int)
INSTANTIZE2(int,double)

View File

@ -37,6 +37,8 @@ template <typename T> class CyclePerm;
template <typename T> class Partition;
template <typename T> class CompressedPartition;
template <typename T> class YoungTableaux;
template <typename T, typename R> class WeightPermutation;
template <typename T, typename R> class PermutationAlgebra;
template <typename T>
class NRPerm : public NRVec_from1<T> {
@ -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<T> &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 <typename T, typename R>
class WeightPermutation {
public:
R weight;
NRPerm<T> perm;
WeightPermutation() : weight(0) {};
WeightPermutation(const R w, const NRPerm<T> &p) : weight(w), perm(p) {};
WeightPermutation(const NRPerm<T> &p) : perm(p) {weight= p.parity();};
void copyonwrite() {perm.copyonwrite();};
};
template <typename T, typename R>
class PermutationAlgebra : public NRVec<WeightPermutation<T,R> >
{
public:
PermutationAlgebra() {};
PermutationAlgebra(const YoungTableaux<T> &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);