continueing on partitions

This commit is contained in:
Jiri Pittner 2021-05-24 22:12:39 +02:00
parent 7d9fc46784
commit 40fe368c31
3 changed files with 44 additions and 7 deletions

View File

@ -746,7 +746,7 @@ PERM_RANK_TYPE r=factorial(n);
for(int i=1; i<=n; ++i)
{
T m=(*this)[i];
if(i>1 && m>0) r/=ipow(i,m);
if(i>1 && m>0) r/=longpow(i,m);
if(m>1) r/=factorial(m);
}
return r;
@ -770,6 +770,33 @@ return factorial(n)/prod;
}
/*hammermesh eq 10-25, highest weight == generalized partition of r into n parts*/
template <typename T>
PERM_RANK_TYPE Partition<T>::Un_irrep_dim(const int n) const
{
#ifdef DEBUG
if(!this->is_valid()) laerror("operation with an invalid partition");
#endif
std::cout<<"TEST "<<nparts()<<" "<<n<<std::endl;
if(nparts()>n) return 0; //too antisymmetric partition
int i,j;
double prod;
int r=this->size();
NRVec_from1<int> p(n);
for(i=1;i<=n;i++) p[i]= (i<=r?(*this)[i]:0)+n-i;
std::cout<<"TEST "<<p<<std::endl;
prod=1;
for(j=n;j>=2;j--)
{
for(i=1;i<j;i++) prod*= (p[i]-p[j]);
prod /= factorial(j-1); //can be fractional in the intermediate steps - needs double
}
return (PERM_RANK_TYPE) (prod+0.2);
}
template <typename T>
Partition<T> Partition<T>::adjoint() const
{
@ -802,7 +829,7 @@ this->clear();
for(int i=1; i<=nparts; ++i) (*this)[i]=x[i].size();
}
PERM_RANK_TYPE ipow(PERM_RANK_TYPE x, int i)
PERM_RANK_TYPE longpow(PERM_RANK_TYPE x, int i)
{
if(i<0) return 0;
PERM_RANK_TYPE y=1;

View File

@ -65,7 +65,7 @@ public:
};
extern PERM_RANK_TYPE factorial(const int n);
extern PERM_RANK_TYPE ipow(PERM_RANK_TYPE x, int i);
extern PERM_RANK_TYPE longpow(PERM_RANK_TYPE x, int i);
//permutations represented in the cycle format
template <typename T>
@ -156,6 +156,7 @@ public:
explicit Partition(const YoungTableaux<T> &x); //extract a partition as a shape of Young tableaux
Partition adjoint() const; //also called conjugate partition
PERM_RANK_TYPE Sn_irrep_dim() const;
PERM_RANK_TYPE Un_irrep_dim(const int n) const;
PERM_RANK_TYPE generate_all(void (*callback)(const Partition<T>&), int nparts=0); //nparts <0 means at most to -nparts
@ -172,7 +173,6 @@ public:
int nrows() const {return this->size();}
int ncols() const {return (*this)[1].size();}
bool is_standard() const; //is it filled in standard way (possibly with repeated numbers)
//@@@???void clear(); //clear the numbers but keep shape (different than inherited clear())
int sum() const; //get back sum of the partition
NRVec_from1<T> yamanouchi() const; //@@@yamanouchi symbol
//@@@ ??>young operator as a linear comb of permutations - maybe a class for itself, i.e. element of the Sn group algebra? or maybe as a vector with index being the rank of the permutation(n! length) or as a sparsemat thereof or maybe a list???
@ -188,7 +188,6 @@ extern PERM_RANK_TYPE partitions(int n, int k= -1); //enumerate partitions to k
//@@@Sn character table computation from young - young frame filling - routine for one character of one irrep and another for generation of the whole group table (maybe class for a group table too)
//
//@@@@Un irrep dimensions from gelfand
}//namespace
#endif

15
t.cc
View File

@ -68,16 +68,24 @@ for(int i=0; i<4; ++i)
}
}
static int unitary_n;
static PERM_RANK_TYPE space_dim;
void pprintme(const Partition<int> &p)
{
CompressedPartition pc(p);
cout<<'['<<pc<<"] ";
Partition<int> q=p.adjoint();
cout<<"IR dim "<<p.Sn_irrep_dim()<<endl;
PERM_RANK_TYPE snd=p.Sn_irrep_dim();
cout<<"IR dim "<<snd<<endl;
PERM_RANK_TYPE und=p.Un_irrep_dim(unitary_n);
cout<<"U("<<unitary_n<<") ir dim "<<und<<endl;
space_dim += und*snd;
CompressedPartition qc(q);
cout <<"("<<qc<<')';
cout<<" Class size "<<qc.Sn_class_size()<<endl;
/*
int nn=p.size();
YoungTableaux<int> y(p);
for(int i=1; i<=y.nrows(); ++i)
@ -89,6 +97,7 @@ YoungTableaux<int> yy(y);
yy.clear();
cout<<yy;
cout <<y;
*/
}
@ -2121,11 +2130,13 @@ cout <<"generated "<<tot<<endl;
if(1)
{
int n;
cin >>n;
cin >>n >>unitary_n;
Partition<int> p(n);
space_dim=0;
int tot=p.generate_all(pprintme,0);
cout <<"generated "<<tot<<endl;
if(tot!=partitions(n)) laerror("internal error in partition generation or enumerations");
if(space_dim!=longpow(unitary_n,n)) {cout<<space_dim<<" "<<ipow(unitary_n,n)<<endl;laerror("integer overflow or internal error in space dimensions");}
}