22 template<
typename Symmetry>
26 for (
int q=0; q<Symmetry::Nq; ++q)
28 if (Symmetry::kind()[q] == KIND::S or Symmetry::kind()[q] == KIND::Salt or Symmetry::kind()[q] == KIND::T)
30 ss << print_frac_nice(boost::rational<int>(qnum[q]-1,2));
32 else if (Symmetry::kind()[q] == KIND::M)
34 ss << print_frac_nice(boost::rational<int>(qnum[q],2));
36 else if (Symmetry::kind()[q] == KIND::Nparity)
38 string parity = (posmod<2>(qnum[q])==0)?
"evn":
"odd";
45 if (q!=Symmetry::Nq-1) {ss <<
",";}
50 template<
typename Scalar>
53 if (q % 2) {
return Scalar(-1.);}
62 template<
typename Symmetry>
63 std::vector<std::pair<typename Symmetry::qType,typename Symmetry::qType> >
64 split(
const typename Symmetry::qType Q,
65 const std::vector<typename Symmetry::qType>& ql,
66 const std::vector<typename Symmetry::qType> qr)
68 std::vector<std::pair<typename Symmetry::qType,typename Symmetry::qType> > vout;
69 for (std::size_t q1=0; q1<ql.size(); q1++)
70 for (std::size_t q2=0; q2<qr.size(); q2++)
72 auto Qs = Symmetry::reduceSilent(ql[q1],qr[q2]);
73 if(
auto it = std::find(Qs.begin(),Qs.end(),Q) != Qs.end()) {vout.push_back({ql[q1],qr[q2]});}
78 template<
typename Symmetry>
79 std::vector<std::pair<std::size_t,std::size_t> >
80 split(
const typename Symmetry::qType Q,
81 const std::vector<typename Symmetry::qType>& ql,
82 const std::vector<typename Symmetry::qType> qr,
85 std::vector<std::pair<std::size_t,std::size_t> > vout;
86 for (std::size_t q1=0; q1<ql.size(); q1++)
87 for (std::size_t q2=0; q2<qr.size(); q2++)
89 auto Qs = Symmetry::reduceSilent(ql[q1],qr[q2]);
90 if(
auto it = std::find(Qs.begin(),Qs.end(),Q) != Qs.end()) {vout.push_back({q1,q2});}
110 void initialize(
int maxJ=1, std::string f_3j=
"", std::string f_6j=
"", std::string f_9j=
"")
112#ifdef USE_WIG_SU2_COEFFS
113 wig_table_init(2*maxJ,9);
114 wig_temp_init(2*maxJ);
117#ifdef USE_FAST_WIG_SU2_COEFFS
118 fastwigxj_load(f_3j.c_str(), 3, NULL);
119 fastwigxj_load(f_6j.c_str(), 6, NULL);
120 fastwigxj_load(f_9j.c_str(), 9, NULL);
122 wig_table_init(2*maxJ,9);
123 wig_temp_init(2*maxJ);
129#ifdef USE_WIG_SU2_COEFFS
134#ifdef USE_FAST_WIG_SU2_COEFFS
135 if (PRINT_STATS) {std::cout << std::endl; fastwigxj_print_stats();}
148template<
typename Symmetry>
151 int length = (L==-1)?
static_cast<int>(qloc.size()):L;
153 if (Qtot != Symmetry::qvacuum())
155 if (PRINT) lout <<
"•old base:" << endl;
156 for (
size_t l=0; l<qloc.size(); ++l)
158 if (PRINT) lout <<
"l=" << l << endl;
159 for (
size_t i=0; i<qloc[l].size(); ++i)
161 if (PRINT) lout <<
"qloc: " << qloc[l][i] << endl;
162 for (
size_t q=0; q<Symmetry::Nq; ++q)
164 if (Symmetry::kind()[q] != Sym::KIND::S and Symmetry::kind()[q] != Sym::KIND::Salt and Symmetry::kind()[q] != Sym::KIND::T)
168 qloc[l][i][q] = (qloc[l][i][q] + Qtot[q]) / length;
172 qloc[l][i][q] = qloc[l][i][q] * length - Qtot[q];
181 lout <<
"•transformed base:" << endl;
182 for (
size_t l=0; l<qloc.size(); ++l)
184 lout <<
"l=" << l << endl;
185 for (
size_t i=0; i<qloc[l].size(); ++i)
187 lout <<
"qloc: " << qloc[l][i] << endl;
194template<
typename Symmetry>
198 for (
size_t q=0; q<Symmetry::Nq; ++q)
200 if (Symmetry::kind()[q] != Sym::KIND::S and Symmetry::kind()[q] != Sym::KIND::Salt and Symmetry::kind()[q] != Sym::KIND::T)
204 out[q] = qin[q] / number_cells;
208 out[q] = qin[q] * number_cells;
void transform_base(vector< vector< qarray< Symmetry::Nq > > > &qloc, qarray< Symmetry::Nq > Qtot, bool PRINT=false, bool BACK=false, int L=-1)
qarray< Symmetry::Nq > adjustQN(const qarray< Symmetry::Nq > &qin, const size_t number_cells, bool BACK=false)
void finalize(bool PRINT_STATS=false)
std::string format(qarray< Symmetry::Nq > qnum)
std::vector< std::pair< typename Symmetry::qType, typename Symmetry::qType > > split(const typename Symmetry::qType Q, const std::vector< typename Symmetry::qType > &ql, const std::vector< typename Symmetry::qType > qr)
void initialize(int maxJ=1, std::string f_3j="", std::string f_6j="", std::string f_9j="")