1#ifndef TWO_SITE_GATE_H_
2#define TWO_SITE_GATE_H_
6template<
typename Symmetry,
typename Scalar>
11 TwoSiteGate(
const vector<vector<vector<vector<vector<Scalar> > > > > &data_in) :
data(data_in){};
46 vector<vector<vector<vector<vector<Scalar> > > > >
data;
54template<
typename Symmetry,
typename Scalar>
67template<
typename Symmetry,
typename Scalar>
71 data.resize(qloc1.size());
72 for (
size_t s1=0; s1< qloc1.size(); s1++)
74 data[s1].resize(qloc2.size());
75 for (
size_t s2=0; s2<qloc2.size(); s2++)
77 data[s1][s2].resize(qloc1.size());
78 for (
size_t s1p=0; s1p<qloc1.size(); s1p++)
80 data[s1][s2][s1p].resize(qloc2.size());
81 for (
size_t s2p=0; s2p<qloc2.size(); s2p++)
83 data[s1][s2][s1p][s2p].resize(qmid.size());
91template<
typename Symmetry,
typename Scalar>
95 assert(!FERMIONIC and
"Fermionic swap gates are not yet implemented.");
96 for (
size_t s1=0; s1<qloc1.size(); s1++)
97 for (
size_t s2=0; s2<qloc2.size(); s2++)
98 for (
size_t s1p=0; s1p<qloc1.size(); s1p++)
99 for (
size_t s2p=0; s2p<qloc2.size(); s2p++)
100 for (
size_t k=0; k<qmid.size(); k++)
102 if (!Symmetry::triangle({qloc1[s1],qloc2[s2],qmid[k]})) {
continue;}
103 if (!Symmetry::triangle({qloc1[s1p],qloc2[s2p],qmid[k]})) {
continue;}
104 if (s1 == s2p and s2 == s1p)
108 data[s1][s2][s1p][s2p][k] = Symmetry::coeff_swapPhase(qloc1[s1],qloc2[s2],qmid[k])*Scalar(1.);
110 else {data[s1][s2][s1p][s2p][k] = Scalar(0.);}
114template<
typename Symmetry,
typename Scalar>
118 for (
size_t s1=0; s1<qloc1.size(); s1++)
119 for (
size_t s2=0; s2<qloc2.size(); s2++)
120 for (
size_t s1p=0; s1p<qloc1.size(); s1p++)
121 for (
size_t s2p=0; s2p<qloc2.size(); s2p++)
122 for (
size_t k=0; k<qmid.size(); k++)
124 if (s1 == s1p and s2 == s2p)
126 data[s1][s2][s1p][s2p][k] = Scalar(1.);
128 else {data[s1][s2][s1p][s2p][k] = Scalar(0.);}
132template<
typename Symmetry,
typename Scalar>
136 for (
size_t s1=0; s1<qloc1.size(); s1++)
137 for (
size_t s2=0; s2<qloc2.size(); s2++)
138 for (
size_t s1p=0; s1p<qloc1.size(); s1p++)
139 for (
size_t s2p=0; s2p<qloc2.size(); s2p++)
140 for (
size_t k=0; k<qmid.size(); k++)
142 cout <<
"data[" << s1 <<
"][" << s2 <<
"][" << s1p <<
"][" << s2p <<
"][" << k <<
"]=" << data[s1][s2][s1p][s2p][k] << endl;
vector< qarray< Symmetry::Nq > > qmid
Qbasis< Symmetry > rightBasis() const
Qbasis< Symmetry > midBasis() const
void setSwapGate(bool FERMIONIC=false)
TwoSiteGate(const vector< vector< vector< vector< vector< Scalar > > > > > &data_in)
vector< qarray< Symmetry::Nq > > qloc1
Qbasis< Symmetry > leftBasis() const
vector< vector< vector< vector< vector< Scalar > > > > > data
vector< qarray< Symmetry::Nq > > qloc2