1#ifndef DMRGPIVOTOVERLAP2
2#define DMRGPIVOTOVERLAP2
7template<
typename Symmetry,
typename Scalar>
12 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &R_input,
15 :
L(L_input),
R(R_input),
qloc1(qloc1_input),
qloc2(qloc2_input)
21 vector<qarray<Symmetry::Nq> >
qloc1;
22 vector<qarray<Symmetry::Nq> >
qloc2;
25template<
typename Symmetry,
typename Scalar>
35 for (
size_t s1=0; s1<H.
qloc1.size(); ++s1)
36 for (
size_t s2=0; s2<H.
qloc2.size(); ++s2)
38 auto qmerges12 = Symmetry::reduceSilent(H.
qloc1[s1], H.
qloc2[s2]);
40 for (
const auto &qmerge12:qmerges12)
46 for (
size_t qL=0; qL<H.
L.
dim; ++qL)
48 vector<tuple<qarray2<Symmetry::Nq>,size_t,
size_t> > ixs;
53 for (
const auto &ix:ixs)
55 auto qR = H.
R.
dict.find(get<0>(ix));
56 size_t qAbra = get<1>(ix);
57 size_t qAket = get<2>(ix);
59 if (qR != H.
R.
dict.end())
61 Matrix<Scalar,Dynamic,Dynamic> Mtmp;
63 if (H.
L.
block[qL].size() != 0 and
64 H.
R.
block[qR->second].size() !=0 and
65 Vin.
data[s1s2].block[qAket].size() != 0)
67 if (H.
L.
block[qL].cols() == Vin.
data[s1s2].block[qAket].rows() and
68 Vin.
data[s1s2].block[qAket].cols() == H.
R.
block[qR->second].rows())
72 Vin.
data[s1s2].block[qAket],
78 lout << termcolor::red <<
"Warning: Mismatching matrix dimensions in LRxV (PivotOverlap2)!" << termcolor::reset << endl;
80 print_size(Vin.
data[s1s2].block[qAket],
"Vin.data[s1s2].block[qAket]");
82 lout <<
"qnums: " << H.
L.
in[qL] <<
"-" << H.
L.
out[qL] <<
", "
83 << Vin.
data[s1s2].in[qAket] <<
"-" << Vin.
data[s1s2].out[qAket] <<
", "
84 << H.
R.
in[qR->second] <<
"-" << H.
R.
out[qR->second]
95 if (Vout.
data[s1s2].block[qAbra].rows() == Mtmp.rows() and
96 Vout.
data[s1s2].block[qAbra].cols() == Mtmp.cols())
98 Vout.
data[s1s2].block[qAbra] += Mtmp;
102 Vout.
data[s1s2].block[qAbra] = Mtmp;
113template<
typename Symmetry,
typename Scalar>
void print_size(const MatrixType &M, string label)
void optimal_multiply(Scalar alpha, const MatrixTypeA &A, const MatrixTypeB &B, const MatrixTypeC &C, MatrixTypeR &result, bool DEBUG=false)
bool AAAA(qarray< Symmetry::Nq > Lin, qarray< Symmetry::Nq > Lout, size_t s1s2, const qarray< Symmetry::Nq > &qmerge12, const vector< Biped< Symmetry, MatrixType > > &AAbra, const vector< Biped< Symmetry, MatrixType > > &AAket, vector< tuple< qarray2< Symmetry::Nq >, size_t, size_t > > &result)
void LRxV(const PivotOverlap2< Symmetry, Scalar > &H, const PivotVector< Symmetry, Scalar > &Vin, PivotVector< Symmetry, Scalar > &Vout)
Eigen::Index inner_num(const Eigen::Index &outer_num) const
Qbasis< Symmetry > combine(const Qbasis< Symmetry > &other, bool FLIP=false) const
Eigen::Index leftOffset(const qType &qnew, const std::array< qType, 2 > &qold, const std::array< Eigen::Index, 2 > &plain_old) const
void pullData(const vector< Biped< Symmetry, MatrixType > > &A, const Eigen::Index &leg)
Eigen::Index outer_num(const qType &q) const
std::unordered_map< std::array< qType, 2 >, std::size_t > dict
std::vector< MatrixType_ > block
vector< qarray< Symmetry::Nq > > qloc2
Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > R
PivotOverlap2(const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &L_input, const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &R_input, const vector< qarray< Symmetry::Nq > > &qloc1_input, const vector< qarray< Symmetry::Nq > > &qloc2_input)
vector< qarray< Symmetry::Nq > > qloc1
Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > L
void outerResize(const PivotVector &Vrhs)
vector< Biped< Symmetry, Matrix< Scalar_, Dynamic, Dynamic > > > data