continue on partitions
This commit is contained in:
parent
80eb98411f
commit
222c1cfb8c
@ -826,6 +826,28 @@ partgen<T>(n,1);
|
|||||||
return partitioncount;
|
return partitioncount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::ostream & operator<<(std::ostream &s, const CompressedPartition<T> &x)
|
||||||
|
{
|
||||||
|
int n=x.size();
|
||||||
|
T sum=0;
|
||||||
|
for(int i=n; i>0;--i)
|
||||||
|
if(x[i])
|
||||||
|
{
|
||||||
|
s<<i;
|
||||||
|
if(x[i]>1) s<<'^'<<x[i];
|
||||||
|
sum+= i*x[i];
|
||||||
|
if(sum<n) s<<',';
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
YoungTableaux<T>::YoungTableaux(const Partition<T> &frame)
|
YoungTableaux<T>::YoungTableaux(const Partition<T> &frame)
|
||||||
: NRVec_from1<NRVec_from1<T> >()
|
: NRVec_from1<NRVec_from1<T> >()
|
||||||
@ -839,6 +861,8 @@ for(int i=1; i<=nlines; ++i) (*this)[i].resize(frame[i]);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************//**
|
/***************************************************************************//**
|
||||||
* forced instantization in the corresponding object file
|
* forced instantization in the corresponding object file
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -846,10 +870,12 @@ template class NRPerm<int>;
|
|||||||
template class CyclePerm<int>;
|
template class CyclePerm<int>;
|
||||||
template class CompressedPartition<int>;
|
template class CompressedPartition<int>;
|
||||||
template class Partition<int>;
|
template class Partition<int>;
|
||||||
|
template class YoungTableaux<int>;
|
||||||
|
|
||||||
#define INSTANTIZE(T) \
|
#define INSTANTIZE(T) \
|
||||||
template std::istream & operator>>(std::istream &s, CyclePerm<T> &x); \
|
template std::istream & operator>>(std::istream &s, CyclePerm<T> &x); \
|
||||||
template std::ostream & operator<<(std::ostream &s, const CyclePerm<T> &x); \
|
template std::ostream & operator<<(std::ostream &s, const CyclePerm<T> &x); \
|
||||||
|
template std::ostream & operator<<(std::ostream &s, const CompressedPartition<T> &x); \
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,10 +108,13 @@ public:
|
|||||||
explicit CompressedPartition(const Partition<T> &rhs) : NRVec_from1<T>(rhs.size()) {this->clear(); for(int i=1; i<=rhs.size(); ++i) if(!rhs[i]) break; else (*this)[rhs[i]]++; }
|
explicit CompressedPartition(const Partition<T> &rhs) : NRVec_from1<T>(rhs.size()) {this->clear(); for(int i=1; i<=rhs.size(); ++i) if(!rhs[i]) break; else (*this)[rhs[i]]++; }
|
||||||
PERM_RANK_TYPE Sn_class_size() const;
|
PERM_RANK_TYPE Sn_class_size() const;
|
||||||
|
|
||||||
//@@@output formatted as in the group character table
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::ostream & operator<<(std::ostream &s, const CompressedPartition<T> &x);
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Partition : public NRVec_from1<T> {
|
class Partition : public NRVec_from1<T> {
|
||||||
public:
|
public:
|
||||||
@ -120,7 +123,7 @@ public:
|
|||||||
T nparts() const {T s=0; for(int i=1; i<=this->size(); ++i) if((*this)[i]) ++s; return s;}
|
T nparts() const {T s=0; for(int i=1; i<=this->size(); ++i) if((*this)[i]) ++s; return s;}
|
||||||
bool is_valid() const {if(this->size() != this->sum()) return false; for(int i=2; i<=this->size(); ++i) if((*this)[i]>(*this)[i-1]) return false; return true; }
|
bool is_valid() const {if(this->size() != this->sum()) return false; for(int i=2; i<=this->size(); ++i) if((*this)[i]>(*this)[i-1]) return false; return true; }
|
||||||
explicit Partition(const CompressedPartition<T> &rhs) : NRVec_from1<T>(rhs.size()) {this->clear(); int ithru=0; for(int i=rhs.size(); i>=1; --i) for(int j=0; j<rhs[i]; ++j) (*this)[++ithru]=i; }
|
explicit Partition(const CompressedPartition<T> &rhs) : NRVec_from1<T>(rhs.size()) {this->clear(); int ithru=0; for(int i=rhs.size(); i>=1; --i) for(int j=0; j<rhs[i]; ++j) (*this)[++ithru]=i; }
|
||||||
Partition adjoint() const;
|
Partition adjoint() const; //also called conjugate partition
|
||||||
PERM_RANK_TYPE Sn_irrep_dim() const;
|
PERM_RANK_TYPE Sn_irrep_dim() const;
|
||||||
PERM_RANK_TYPE generate_all(void (*callback)(const Partition<T>&), int nparts=0); //nparts <0 means at most to -nparts
|
PERM_RANK_TYPE generate_all(void (*callback)(const Partition<T>&), int nparts=0); //nparts <0 means at most to -nparts
|
||||||
|
|
||||||
@ -136,7 +139,7 @@ public:
|
|||||||
explicit YoungTableaux(const Partition<T> &frame);
|
explicit YoungTableaux(const Partition<T> &frame);
|
||||||
|
|
||||||
bool is_valid() const; //@@@shape forms a partition
|
bool is_valid() const; //@@@shape forms a partition
|
||||||
bool filled_correctly() const; //is it filled correctly
|
bool filled_correctly() const; //is it filled correctly@@@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
7
t.cc
7
t.cc
@ -70,12 +70,13 @@ for(int i=0; i<4; ++i)
|
|||||||
|
|
||||||
void pprintme(const Partition<int> &p)
|
void pprintme(const Partition<int> &p)
|
||||||
{
|
{
|
||||||
cout<<p;
|
CompressedPartition pc(p);
|
||||||
|
cout<<'['<<pc<<"] ";
|
||||||
Partition<int> q=p.adjoint();
|
Partition<int> q=p.adjoint();
|
||||||
cout<<"IR dim "<<p.Sn_irrep_dim()<<endl;
|
cout<<"IR dim "<<p.Sn_irrep_dim()<<endl;
|
||||||
cout <<q;
|
|
||||||
CompressedPartition qc(q);
|
CompressedPartition qc(q);
|
||||||
cout<<"Class size "<<qc.Sn_class_size()<<endl;
|
cout <<"("<<qc<<')';
|
||||||
|
cout<<" Class size "<<qc.Sn_class_size()<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user