young operator implemented as permutation algebra type

This commit is contained in:
Jiri Pittner 2024-01-15 17:35:56 +01:00
parent a9a07daaa7
commit 0fa4f9fc2e
3 changed files with 42 additions and 22 deletions

View File

@ -1632,8 +1632,6 @@ return _character<T>;
////generation of the young operator ////generation of the young operator
template <typename T>
void (*_young_operator_callback)(const NRPerm<T>&p, const T parity, const PERM_RANK_TYPE nterms);
template <typename T> template <typename T>
static NRPerm<T> _aperm; static NRPerm<T> _aperm;
@ -1655,6 +1653,9 @@ static PERM_RANK_TYPE _nyoungterms, _expectterms;
template <typename T> template <typename T>
static T _antparity; static T _antparity;
template <typename T, typename R>
PermutationAlgebra<T,R> *_young_r;
template <typename T> template <typename T>
@ -1663,8 +1664,9 @@ static void symetr(T ilin, T iel)
if(ilin > (*_tyou_cols<T>)[1]) if(ilin > (*_tyou_cols<T>)[1])
{ {
(*_young_r<T,T>)[_nyoungterms].weight = _antparity<T>;
(*_young_r<T,T>)[_nyoungterms].perm = _aperm<T>*_sperm<T>;
++_nyoungterms; ++_nyoungterms;
(*_young_operator_callback<T>)(_aperm<T>*_sperm<T>,_antparity<T>,_expectterms);
} }
else if(iel > (*_tyou_rows<T>)[ilin]) symetr(ilin+1,(T)1); else if(iel > (*_tyou_rows<T>)[ilin]) symetr(ilin+1,(T)1);
else else
@ -1715,14 +1717,12 @@ else
template <typename T> template <typename T>
PERM_RANK_TYPE YoungTableaux<T>::young_operator(void (*callback)(const NRPerm<T>&p, const T parity, const PERM_RANK_TYPE nterms)) const PermutationAlgebra<T,T> YoungTableaux<T>::young_operator() const
{ {
#ifdef DEBUG #ifdef DEBUG
if(!this->is_standard()) laerror("young_operator called for non-standard tableaux"); if(!this->is_standard()) laerror("young_operator called for non-standard tableaux");
#endif #endif
_young_operator_callback<T> = callback;
_nyoungterms =0; _nyoungterms =0;
_tyou<T> = this; _tyou<T> = this;
Partition<T> rows=Partition<T>(*this); Partition<T> rows=Partition<T>(*this);
@ -1739,11 +1739,14 @@ _expectterms=1;
for(int i=1;i<=cols[1];i++) _expectterms *= factorial(rows[i]); for(int i=1;i<=cols[1];i++) _expectterms *= factorial(rows[i]);
for(int i=1;i<=rows[1];i++) _expectterms *= factorial(cols[i]); for(int i=1;i<=rows[1];i++) _expectterms *= factorial(cols[i]);
PermutationAlgebra<T,T> r(_expectterms);
_young_r<T,T> = &r;
antisym<T>(1,1); antisym<T>(1,1);
if(_nyoungterms!=_expectterms) laerror("youngconstruct: inconsistent number of terms"); 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<T> &x);
#define INSTANTIZE2(T,R) \ #define INSTANTIZE2(T,R) \
template class WeightPermutation<T,R>; \ template class WeightPermutation<T,R>; \
template class PermutationAlgebra<T,R>; \ template class PermutationAlgebra<T,R>; \
template std::istream & operator>>(std::istream &s, WeightPermutation<T,R> &x); \
template std::ostream & operator<<(std::ostream &s, const WeightPermutation<T,R> &x); \
INSTANTIZE(int) INSTANTIZE(int)
INSTANTIZE(unsigned int) INSTANTIZE(unsigned int)
INSTANTIZE2(int,int)
INSTANTIZE2(int,double) INSTANTIZE2(int,double)
}//namespace }//namespace

View File

@ -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 //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 { namespace LA {
@ -91,16 +93,33 @@ public:
}; };
template <typename T, typename R>
std::istream & operator>>(std::istream &s, WeightPermutation<T,R> &x)
{
s>>x.weight>>x.perm;
return s;
}
template <typename T, typename R>
std::ostream & operator<<(std::ostream &s, const WeightPermutation<T,R> &x)
{
s<<x.weight<<' '<<x.perm<<' ';
return s;
}
template <typename T, typename R> template <typename T, typename R>
class PermutationAlgebra : public NRVec<WeightPermutation<T,R> > class PermutationAlgebra : public NRVec<WeightPermutation<T,R> >
{ {
public: public:
PermutationAlgebra() {}; PermutationAlgebra() {};
PermutationAlgebra(const YoungTableaux<T> &y);// Young antisymmetrizer TODO@@@ PermutationAlgebra(int n) : NRVec<WeightPermutation<T,R> >(n) {};
}; };
//TODO@@@ iostream for WeightPermutation and PermutationAlgebra //TODO@@@ basic operators for the algebra, possibly also simplification after operation
//TODO@@@ permutationalgebra for Kucharski style antisymmetrizers //TODO@@@ permutationalgebra for Kucharski style antisymmetrizers
@ -241,7 +260,7 @@ public:
NRVec_from1<T> yamanouchi() const; //yamanouchi symbol NRVec_from1<T> yamanouchi() const; //yamanouchi symbol
T character_contribution(int ncyc=0) const; //contribution of filled tableaux to Sn character T character_contribution(int ncyc=0) const; //contribution of filled tableaux to Sn character
PERM_RANK_TYPE generate_all_standard(void (*callback)(const YoungTableaux<T>&)); PERM_RANK_TYPE generate_all_standard(void (*callback)(const YoungTableaux<T>&));
PERM_RANK_TYPE young_operator(void (*callback)(const NRPerm<T>&p, const T parity, const PERM_RANK_TYPE nterms)) const; //generate young operator for a standard tableaux PermutationAlgebra<T,T> young_operator() const; //generate young operator for a standard tableaux
}; };

13
t.cc
View File

@ -91,16 +91,11 @@ cout<<p;
static int unitary_n; static int unitary_n;
static PERM_RANK_TYPE space_dim; static PERM_RANK_TYPE space_dim;
void yyprintme(const NRPerm<int>&p, const int parity, const PERM_RANK_TYPE nterms)
{
cout<< parity<<"/"<<nterms<<" "<<p;
}
void yprintme(const YoungTableaux<int>&y) void yprintme(const YoungTableaux<int>&y)
{ {
cout <<y; cout <<y;
if(!y.is_standard()) laerror("internal error in young"); if(!y.is_standard()) laerror("internal error in young");
y.young_operator(yyprintme); cout << y.young_operator();
} }
void pprintme(const Partition<int> &p) void pprintme(const Partition<int> &p)
@ -2216,7 +2211,7 @@ int tot=p.generate_all_multi(printme0);
cout <<"generated "<<tot<<endl; cout <<"generated "<<tot<<endl;
} }
if(1) if(0)
{ {
int n; cin >>n; int n; cin >>n;
NRPerm<int> p(n); NRPerm<int> p(n);
@ -2227,9 +2222,9 @@ cout <<"generated "<<tot<<endl;
} }
if(0) if(1)
{ {
int n,unitary_n;; int n;;
cin >>n >>unitary_n; cin >>n >>unitary_n;
Partition<int> p(n); Partition<int> p(n);
space_dim=0; space_dim=0;