7#include <unordered_set>
23template<
typename Kind,
int N,
typename Scalar=
double>
29 static constexpr int Nq=1;
52 inline static constexpr std::array<qType,2>
lowest_qs()
54 return std::array<qType,2>{{
qarray<1>(std::array<int,1>{{1}}),
58 inline static std::string
name()
64 inline static constexpr std::array<KIND,Nq>
kind() {
return {Kind::name}; }
65 inline static constexpr std::array<int,Nq>
mod() {
return {
MOD_N}; }
84 static std::vector<qType>
reduceSilent(
const std::vector<qType>& ql,
const qType& qr);
88 static std::vector<qType>
reduceSilent(
const std::vector<qType>& ql,
const std::vector<qType>& qr,
bool UNIQUE =
false);
90 static vector<tuple<qarray<1>,size_t,
qarray<1>,size_t,
qarray<1> > >
tensorProd (
const std::vector<qType>& ql,
const std::vector<qType>& qr );
114 int q1_z,
int q2_z,
int q3_z);
116 int q1_z,
int q2_z,
int q3_z);
163 template<std::
size_t M>
164 static bool compare (
const std::array<qType,M>& q1,
const std::array<qType,M>& q2 );
171 template<std::
size_t M>
172 static bool validate(
const std::array<qType,M>& qs );
174 static bool triangle(
const std::array<qType,3>& qs );
175 static bool pair(
const std::array<qType,2>& qs );
179template<
typename Kind,
int N,
typename Scalar>
183 std::vector<qType> vout;
184 vout.push_back({posmod<N>(ql[0]+qr[0])});
189template<
typename Kind,
int N,
typename Scalar>
193 std::vector<qType> vout;
194 vout.push_back({posmod<N>(ql[0]+qm[0]+qr[0])});
198template<
typename Kind,
int N,
typename Scalar>
202 std::vector<typename ZN<Kind,N,Scalar>::qType> vout;
203 for (std::size_t q=0; q<ql.size(); q++)
205 vout.push_back({posmod<N>(ql[q][0]+qr[0])});
210template<
typename Kind,
int N,
typename Scalar>
212reduceSilent(
const std::vector<qType>& ql,
const std::vector<qType>& qr,
bool UNIQUE )
216 std::unordered_set<qType> uniqueControl;
217 std::vector<qType> vout;
218 for (std::size_t q=0; q<ql.size(); q++)
219 for (std::size_t p=0; p<qr.size(); p++)
221 int i = posmod<N>(ql[q][0]+qr[p][0]);
222 if (
auto it = uniqueControl.find({i}) == uniqueControl.end()) {uniqueControl.insert({i}); vout.push_back({i});}
228 std::vector<qType> vout;
230 for (std::size_t q=0; q<ql.size(); q++)
231 for (std::size_t p=0; p<qr.size(); p++)
233 vout.push_back({posmod<N>(ql[q][0]+qr[p][0])});
239template<
typename Kind,
int N,
typename Scalar>
241tensorProd (
const std::vector<qType>& ql,
const std::vector<qType>& qr )
244 for (std::size_t q=0; q<ql.size(); q++)
245 for (std::size_t p=0; p<qr.size(); p++)
247 out.push_back(make_tuple(ql[q], q, qr[p], p,
qarray<1>{posmod<N>(ql[q][0]+qr[p][0])}));
252template<
typename Kind,
int N,
typename Scalar>
256 Scalar out = Scalar(1.);
260template<
typename Kind,
int N,
typename Scalar>
264 Scalar out = Scalar(1.);
268template<
typename Kind,
int N,
typename Scalar>
272 Scalar out = Scalar(1.);
276template<
typename Kind,
int N,
typename Scalar>
280 Scalar out = Scalar(1.);
284template<
typename Kind,
int N,
typename Scalar>
288 Scalar out = Scalar(1.);
292template<
typename Kind,
int N,
typename Scalar>
296 Scalar out = Scalar(1.);
300template<
typename Kind,
int N,
typename Scalar>
304 Scalar out = Scalar(1.);
308template<
typename Kind,
int N,
typename Scalar>
312 Scalar out = Scalar(1.);
316template<
typename Kind,
int N,
typename Scalar>
320 Scalar out = Scalar(1.);
324template<
typename Kind,
int N,
typename Scalar>
327 int q1_z,
int q2_z,
int q3_z)
332template<
typename Kind,
int N,
typename Scalar>
335 int q1_z,
int q2_z,
int q3_z)
340template<
typename Kind,
int N,
typename Scalar>
348template<
typename Kind,
int N,
typename Scalar>
353 Scalar out = Scalar(1.);
357template<
typename Kind,
int N,
typename Scalar>
366template<
typename Kind,
int N,
typename Scalar>
375template<
typename Kind,
int N,
typename Scalar>
381 Scalar out = Scalar(1.);
385template<
typename Kind,
int N,
typename Scalar>
391 Scalar out = Scalar(1.);
395template<
typename Kind,
int N,
typename Scalar>
401 Scalar out = Scalar(1.);
405template<
typename Kind,
int N,
typename Scalar>
411 Scalar out = Scalar(1.);
415template<
typename Kind,
int N,
typename Scalar>
422 Scalar out = Scalar(1.);
426template<
typename Kind,
int N,
typename Scalar>
431 Scalar out = Scalar(1.);
435template<
typename Kind,
int N,
typename Scalar>
440 Scalar out = Scalar(1.);
444template<
typename Kind,
int N,
typename Scalar>
450 Scalar out = Scalar(1.);
454template<
typename Kind,
int N,
typename Scalar>
458 Scalar out = Scalar(1.);
462template<
typename Kind,
int N,
typename Scalar>
467 Scalar out = Scalar(1.);
471template<
typename Kind,
int N,
typename Scalar>
476 Scalar out = Scalar(1.);
480template<
typename Kind,
int N,
typename Scalar>
481template<std::
size_t M>
485 for (std::size_t m=0; m<
M; m++)
487 if (q1[m][0] > q2[m][0]) {
return false;}
488 else if (q1[m][0] < q2[m][0]) {
return true; }
493template<
typename Kind,
int N,
typename Scalar>
498 if (posmod<N>(qs[0][0]+qs[1][0]) == posmod<N>(qs[2][0])) {
return true;}
502template<
typename Kind,
int N,
typename Scalar>
507 if ( qs[0] == qs[1] ) {
return true;}
511template<
typename Kind,
int N,
typename Scalar>
512template<std::
size_t M>
516 if constexpr(
M == 1 ) {
return true; }
519 else { cout <<
"This should not be printed out!" << endl;
return true; }
static constexpr std::array< qType, 2 > lowest_qs()
static Scalar coeff_tensorProd(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static constexpr bool IS_TRIVIAL
static constexpr bool NON_ABELIAN
static Scalar coeff_buildL(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static Scalar coeff_MPOprod6(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static constexpr std::array< KIND, Nq > kind()
static qType flip(const qType &q)
static std::vector< qType > reduceSilent(const qType &ql, const qType &qr)
static Scalar coeff_sign2(const qType &q1, const qType &q2, const qType &q3)
static Scalar coeff_sign(const qType &q1, const qType &q2, const qType &q3)
static Scalar coeff_leftSweep3(const qType &q1, const qType &q2, const qType &q3)
static int spinorFactor()
static constexpr bool IS_CHARGE_SU2()
static Scalar coeff_leftSweep2(const qType &q1, const qType &q2, const qType &q3)
static bool validate(const std::array< qType, M > &qs)
static bool triangle(const std::array< qType, 3 > &qs)
static Scalar coeff_Apair(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static constexpr bool NO_CHARGE_SYM()
static bool pair(const std::array< qType, 2 > &qs)
static Scalar coeff_CGC(const qType &q1, const qType &q2, const qType &q3, int q1_z, int q2_z, int q3_z)
static Scalar coeff_prod(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static Scalar coeff_twoSiteGate(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static constexpr bool IS_SPIN_SU2()
static constexpr size_t lowest_qs_size
static vector< tuple< qarray< 1 >, size_t, qarray< 1 >, size_t, qarray< 1 > > > tensorProd(const std::vector< qType > &ql, const std::vector< qType > &qr)
static constexpr std::array< int, Nq > mod()
static Scalar coeff_leftSweep(const qType &q1, const qType &q2)
static constexpr bool NO_SPIN_SYM()
static Scalar coeff_MPOprod9(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static Scalar coeff_rightOrtho(const qType &q1, const qType &q2)
static constexpr qType qvacuum()
static constexpr bool IS_SPIN_U1()
static Scalar coeff_6j(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static Scalar coeff_dot(const qType &q1)
static Scalar coeff_9j(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static Scalar coeff_AW(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static Scalar coeff_adjoint(const qType &q1, const qType &q2, const qType &q3)
static Scalar coeff_buildR(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static bool compare(const std::array< qType, M > &q1, const std::array< qType, M > &q2)
static Scalar coeff_Wpair(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9, const qType &q10, const qType &q11, const qType &q12)
static Scalar coeff_3j(const qType &q1, const qType &q2, const qType &q3, int q1_z, int q2_z, int q3_z)
static Scalar coeff_unity()
static int degeneracy(const qType &q)
static Scalar coeff_splitAA(const qType &q1, const qType &q2, const qType &q3)
static std::string name()
static Scalar coeff_swapPhase(const qType &q1, const qType &q2, const qType &q3)
static constexpr bool ABELIAN
static constexpr int MOD_N
static constexpr bool IS_MODULAR
static Scalar coeff_HPsi(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static constexpr bool HAS_CGC