From 222c1cfb8cf65436ce293fe98209aed5c85f5cbc Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Sun, 23 May 2021 10:28:50 +0200 Subject: [PATCH] continue on partitions --- permutation.cc | 26 ++++++++++++++++++++++++++ permutation.h | 9 ++++++--- t.cc | 7 ++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/permutation.cc b/permutation.cc index b8fe706..1fa1c95 100644 --- a/permutation.cc +++ b/permutation.cc @@ -826,6 +826,28 @@ partgen(n,1); return partitioncount; } + +template +std::ostream & operator<<(std::ostream &s, const CompressedPartition &x) +{ +int n=x.size(); +T sum=0; +for(int i=n; i>0;--i) + if(x[i]) + { + s<1) s<<'^'< YoungTableaux::YoungTableaux(const Partition &frame) : NRVec_from1 >() @@ -839,6 +861,8 @@ for(int i=1; i<=nlines; ++i) (*this)[i].resize(frame[i]); } + + /***************************************************************************//** * forced instantization in the corresponding object file ******************************************************************************/ @@ -846,10 +870,12 @@ template class NRPerm; template class CyclePerm; template class CompressedPartition; template class Partition; +template class YoungTableaux; #define INSTANTIZE(T) \ template std::istream & operator>>(std::istream &s, CyclePerm &x); \ template std::ostream & operator<<(std::ostream &s, const CyclePerm &x); \ +template std::ostream & operator<<(std::ostream &s, const CompressedPartition &x); \ diff --git a/permutation.h b/permutation.h index 5aa38f5..ea6b2b3 100644 --- a/permutation.h +++ b/permutation.h @@ -108,10 +108,13 @@ public: explicit CompressedPartition(const Partition &rhs) : NRVec_from1(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; -//@@@output formatted as in the group character table }; +template +std::ostream & operator<<(std::ostream &s, const CompressedPartition &x); + + template class Partition : public NRVec_from1 { 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;} 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 &rhs) : NRVec_from1(rhs.size()) {this->clear(); int ithru=0; for(int i=rhs.size(); i>=1; --i) for(int j=0; j&), int nparts=0); //nparts <0 means at most to -nparts @@ -136,7 +139,7 @@ public: explicit YoungTableaux(const Partition &frame); bool is_valid() const; //@@@shape forms a partition - bool filled_correctly() const; //is it filled correctly + bool filled_correctly() const; //is it filled correctly@@@ }; diff --git a/t.cc b/t.cc index 56a2396..82f8493 100644 --- a/t.cc +++ b/t.cc @@ -70,12 +70,13 @@ for(int i=0; i<4; ++i) void pprintme(const Partition &p) { -cout< q=p.adjoint(); cout<<"IR dim "<