From 0fa4f9fc2e0bbcfd2d10eb4ff9ba9723438e7b5f Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Mon, 15 Jan 2024 17:35:56 +0100 Subject: [PATCH] young operator implemented as permutation algebra type --- permutation.cc | 26 ++++++++++++++++---------- permutation.h | 25 ++++++++++++++++++++++--- t.cc | 13 ++++--------- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/permutation.cc b/permutation.cc index f7396b3..515ed4e 100644 --- a/permutation.cc +++ b/permutation.cc @@ -1632,8 +1632,6 @@ return _character; ////generation of the young operator -template -void (*_young_operator_callback)(const NRPerm&p, const T parity, const PERM_RANK_TYPE nterms); template static NRPerm _aperm; @@ -1655,6 +1653,9 @@ static PERM_RANK_TYPE _nyoungterms, _expectterms; template static T _antparity; +template +PermutationAlgebra *_young_r; + template @@ -1663,8 +1664,9 @@ static void symetr(T ilin, T iel) if(ilin > (*_tyou_cols)[1]) { + (*_young_r)[_nyoungterms].weight = _antparity; + (*_young_r)[_nyoungterms].perm = _aperm*_sperm; ++_nyoungterms; - (*_young_operator_callback)(_aperm*_sperm,_antparity,_expectterms); } else if(iel > (*_tyou_rows)[ilin]) symetr(ilin+1,(T)1); else @@ -1715,14 +1717,12 @@ else - template -PERM_RANK_TYPE YoungTableaux::young_operator(void (*callback)(const NRPerm&p, const T parity, const PERM_RANK_TYPE nterms)) const +PermutationAlgebra YoungTableaux::young_operator() const { #ifdef DEBUG if(!this->is_standard()) laerror("young_operator called for non-standard tableaux"); #endif -_young_operator_callback = callback; _nyoungterms =0; _tyou = this; Partition rows=Partition(*this); @@ -1739,11 +1739,14 @@ _expectterms=1; for(int i=1;i<=cols[1];i++) _expectterms *= factorial(rows[i]); for(int i=1;i<=rows[1];i++) _expectterms *= factorial(cols[i]); +PermutationAlgebra r(_expectterms); +_young_r = &r; + antisym(1,1); if(_nyoungterms!=_expectterms) laerror("youngconstruct: inconsistent number of terms"); -return _nyoungterms; +return r; } @@ -1943,14 +1946,17 @@ template std::ostream & operator<<(std::ostream &s, const Sn_characters &x); #define INSTANTIZE2(T,R) \ template class WeightPermutation; \ template class PermutationAlgebra; \ +template std::istream & operator>>(std::istream &s, WeightPermutation &x); \ +template std::ostream & operator<<(std::ostream &s, const WeightPermutation &x); \ INSTANTIZE(int) INSTANTIZE(unsigned int) + +INSTANTIZE2(int,int) + + INSTANTIZE2(int,double) - - - }//namespace diff --git a/permutation.h b/permutation.h index 99eccc1..322454e 100644 --- a/permutation.h +++ b/permutation.h @@ -29,6 +29,8 @@ typedef unsigned long long PERM_RANK_TYPE; //permutations are always numbered from 1; offset is employed when applied to vectors and matrices +//TODO@@@ permutace - substitute jako multiplikace ale x[p[i]] = y[i] kde ale x a y nejsou prave permutace + namespace LA { @@ -91,16 +93,33 @@ public: }; + +template +std::istream & operator>>(std::istream &s, WeightPermutation &x) +{ +s>>x.weight>>x.perm; +return s; +} + +template +std::ostream & operator<<(std::ostream &s, const WeightPermutation &x) +{ +s< class PermutationAlgebra : public NRVec > { public: PermutationAlgebra() {}; - PermutationAlgebra(const YoungTableaux &y);// Young antisymmetrizer TODO@@@ + PermutationAlgebra(int n) : NRVec >(n) {}; }; -//TODO@@@ iostream for WeightPermutation and PermutationAlgebra +//TODO@@@ basic operators for the algebra, possibly also simplification after operation //TODO@@@ permutationalgebra for Kucharski style antisymmetrizers @@ -241,7 +260,7 @@ public: NRVec_from1 yamanouchi() const; //yamanouchi symbol T character_contribution(int ncyc=0) const; //contribution of filled tableaux to Sn character PERM_RANK_TYPE generate_all_standard(void (*callback)(const YoungTableaux&)); - PERM_RANK_TYPE young_operator(void (*callback)(const NRPerm&p, const T parity, const PERM_RANK_TYPE nterms)) const; //generate young operator for a standard tableaux + PermutationAlgebra young_operator() const; //generate young operator for a standard tableaux }; diff --git a/t.cc b/t.cc index cd8ac55..855cd67 100644 --- a/t.cc +++ b/t.cc @@ -91,16 +91,11 @@ cout<&p, const int parity, const PERM_RANK_TYPE nterms) -{ -cout<< parity<<"/"<&y) { cout < &p) @@ -2216,7 +2211,7 @@ int tot=p.generate_all_multi(printme0); cout <<"generated "<>n; NRPerm p(n); @@ -2227,9 +2222,9 @@ cout <<"generated "<>n >>unitary_n; Partition p(n); space_dim=0;