7#include <unordered_set>
23template<
typename Kind,
typename Scalar=
double>
29 static constexpr size_t Nq=1;
53 inline static constexpr std::array<qType,2>
lowest_qs()
55 return std::array<qType,2>{{
qarray<1>(std::array<int,1>{{-1}}),
59 inline static std::string
name() {
return "U1"; }
60 inline static constexpr std::array<KIND,Nq>
kind() {
return {Kind::name}; }
61 inline static constexpr std::array<int,Nq>
mod() {
return {
MOD_N}; }
81 static std::vector<qType>
reduceSilent(
const std::vector<qType>& ql,
const qType& qr);
85 static std::vector<qType>
reduceSilent(
const std::vector<qType>& ql,
const std::vector<qType>& qr,
bool UNIQUE =
false);
87 static vector<tuple<qarray<1>,size_t,
qarray<1>,size_t,
qarray<1> > >
tensorProd (
const std::vector<qType>& ql,
const std::vector<qType>& qr );
109 int q1_z,
int q2_z,
int q3_z);
111 int q1_z,
int q2_z,
int q3_z);
153 template<std::
size_t M>
154 static bool compare (
const std::array<qType,M>& q1,
const std::array<qType,M>& q2 );
161 template<std::
size_t M>
162 static bool validate(
const std::array<qType,M>& qs );
164 static bool triangle(
const std::array<qType,3>& qs );
165 static bool pair(
const std::array<qType,2>& qs );
169template<
typename Kind,
typename Scalar>
173 std::vector<qType> vout;
174 vout.push_back({ql[0]+qr[0]});
178template<
typename Kind,
typename Scalar>
182 std::vector<qType> vout;
183 vout.push_back({ql[0]+qm[0]+qr[0]});
187template<
typename Kind,
typename Scalar>
191 std::vector<typename U1<Kind,Scalar>::qType> vout;
192 for (std::size_t q=0; q<ql.size(); q++)
194 vout.push_back({ql[q][0]+qr[0]});
199template<
typename Kind,
typename Scalar>
201reduceSilent(
const std::vector<qType>& ql,
const std::vector<qType>& qr,
bool UNIQUE )
205 std::unordered_set<qType> uniqueControl;
206 std::vector<qType> vout;
207 for (std::size_t q=0; q<ql.size(); q++)
208 for (std::size_t p=0; p<qr.size(); p++)
210 int i = ql[q][0]+qr[p][0];
211 if(
auto it = uniqueControl.find({i}) == uniqueControl.end() ) { uniqueControl.insert({i}); vout.push_back({i}); }
217 std::vector<qType> vout;
219 for (std::size_t q=0; q<ql.size(); q++)
220 for (std::size_t p=0; p<qr.size(); p++)
222 vout.push_back({ql[q][0]+qr[p][0]});
228template<
typename Kind,
typename Scalar>
230tensorProd (
const std::vector<qType>& ql,
const std::vector<qType>& qr )
243 for (std::size_t q=0; q<ql.size(); q++)
244 for (std::size_t p=0; p<qr.size(); p++)
246 out.push_back(make_tuple(ql[q], q, qr[p], p,
qarray<1>{ql[q][0]+qr[p][0]}));
251template<
typename Kind,
typename Scalar>
255 Scalar out = Scalar(1.);
259template<
typename Kind,
typename Scalar>
263 Scalar out = Scalar(1.);
267template<
typename Kind,
typename Scalar>
271 Scalar out = Scalar(1.);
275template<
typename Kind,
typename Scalar>
279 Scalar out = Scalar(1.);
283template<
typename Kind,
typename Scalar>
287 Scalar out = Scalar(1.);
291template<
typename Kind,
typename Scalar>
295 Scalar out = Scalar(1.);
299template<
typename Kind,
typename Scalar>
303 Scalar out = Scalar(1.);
307template<
typename Kind,
typename Scalar>
310 int q1_z,
int q2_z,
int q3_z)
315template<
typename Kind,
typename Scalar>
318 int q1_z,
int q2_z,
int q3_z)
323template<
typename Kind,
typename Scalar>
337template<
typename Kind,
typename Scalar>
342 Scalar out = Scalar(1.);
346template<
typename Kind,
typename Scalar>
351 Scalar out = Scalar(1.);
355template<
typename Kind,
typename Scalar>
360 Scalar out = Scalar(1.);
364template<
typename Kind,
typename Scalar>
369 Scalar out = Scalar(1.);
373template<
typename Kind,
typename Scalar>
378 Scalar out = Scalar(1.);
382template<
typename Kind,
typename Scalar>
397template<
typename Kind,
typename Scalar>
412template<
typename Kind,
typename Scalar>
418 Scalar out = Scalar(1.);
422template<
typename Kind,
typename Scalar>
428 Scalar out = Scalar(1.);
432template<
typename Kind,
typename Scalar>
438 Scalar out = Scalar(1.);
442template<
typename Kind,
typename Scalar>
448 Scalar out = Scalar(1.);
452template<
typename Kind,
typename Scalar>
458 Scalar out = Scalar(1.);
462template<
typename Kind,
typename Scalar>
463template<std::
size_t M>
467 for (std::size_t m=0; m<
M; m++)
469 if (q1[m][0] > q2[m][0]) {
return false; }
470 else if (q1[m][0] < q2[m][0]) {
return true; }
475template<
typename Kind,
typename Scalar>
480 if (qs[0][0] + qs[1][0] == qs[2][0]) {
return true;}
484template<
typename Kind,
typename Scalar>
489 if (qs[0] == qs[1]) {
return true;}
493template<
typename Kind,
typename Scalar>
494template<std::
size_t M>
498 if constexpr(
M == 1 ) {
return true; }
501 else { cout <<
"This should not be printed out!" << endl;
return true; }
506#ifndef STREAM_OPERATOR_ARR_1_INT
507#define STREAM_OPERATOR_ARR_1_INT
std::ostream & operator<<(std::ostream &os, const typename Sym::U1< double >::qType &q)
static constexpr std::array< int, Nq > mod()
static Scalar coeff_unity()
static bool triangle(const std::array< qType, 3 > &qs)
static constexpr bool IS_TRIVIAL
static Scalar coeff_rightOrtho(const qType &q1, const qType &q2)
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 Scalar coeff_prod(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 constexpr bool HAS_CGC
static std::string name()
static bool pair(const std::array< qType, 2 > &qs)
static constexpr bool NO_SPIN_SYM()
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 constexpr bool IS_MODULAR
static constexpr bool ABELIAN
static constexpr std::array< qType, 2 > lowest_qs()
static constexpr bool NON_ABELIAN
static Scalar coeff_MPOprod6(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static constexpr size_t lowest_qs_size
static double coeff_leftSweep3(const qType &q1, const qType &q2, const qType &q3)
static Scalar coeff_Apair(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static Scalar coeff_adjoint(const qType &q1, const qType &q2, const qType &q3)
static constexpr size_t Nq
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 int degeneracy(const qType &q)
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_3j(const qType &q1, const qType &q2, const qType &q3, int q1_z, int q2_z, int q3_z)
static bool validate(const std::array< qType, M > &qs)
static constexpr bool IS_CHARGE_SU2()
static bool compare(const std::array< qType, M > &q1, const std::array< qType, M > &q2)
static constexpr std::array< KIND, Nq > kind()
static std::vector< qType > reduceSilent(const qType &ql, const qType &qr)
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 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 int spinorFactor()
static constexpr qType qvacuum()
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 Scalar coeff_splitAA(const qType &q1, const qType &q2, const qType &q3)
static qType flip(const qType &q)
static Scalar coeff_leftSweep(const qType &q1, const qType &q2)
static constexpr bool IS_SPIN_U1()
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 constexpr int MOD_N
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 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_CGC(const qType &q1, const qType &q2, const qType &q3, int q1_z, int q2_z, int q3_z)
static Scalar coeff_swapPhase(const qType &q1, const qType &q2, const qType &q3)
static Scalar coeff_dot(const qType &q1)
static double coeff_leftSweep2(const qType &q1, const qType &q2, const qType &q3)