1#ifndef DMRGPIVOTOVERLAP1
2#define DMRGPIVOTOVERLAP1
9template<
typename Symmetry,
typename Scalar>
14 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &R_input,
16 :
L(L_input),
R(R_input),
qloc(qloc_input)
22 vector<qarray<Symmetry::Nq> >
qloc;
25template<
typename Symmetry,
typename Scalar>
30 for (
size_t s=0; s<H.
qloc.size(); ++s)
31 for (
size_t qL=0; qL<H.
L.
dim; ++qL)
33 vector<tuple<qarray2<Symmetry::Nq>,size_t,
size_t> > ix;
38 for (
size_t n=0; n<ix.size(); ++n)
40 size_t qAbra = get<1>(ix[n]);
41 size_t qAket = get<2>(ix[n]);
42 auto qR = H.
R.
dict.find(get<0>(ix[n]));
44 if (qR != H.
R.
dict.end() and
45 H.
L.
block[qL].size() != 0 and
46 Vin.
data[s].block[qAket].size() != 0 and
47 H.
R.
block[qR->second].size() != 0)
49 Matrix<Scalar,Dynamic,Dynamic> Mtmp;
51 if (H.
L.
block[qL].cols() == Vin.
data[s].block[qAket].rows() and
52 Vin.
data[s].block[qAket].cols() == H.
R.
block[qR->second].rows())
56 Vin.
data[s].block[qAket],
62 lout << termcolor::red <<
"Warning: Mismatched matrix dimensions in LRxV (PivotOverlap1)!" << termcolor::reset << endl;
66 lout <<
"qnums: " << H.
L.
in[qL] <<
"-" << H.
L.
out[qL] <<
", "
67 << Vin.
data[s].in[qAket] <<
"-" << Vin.
data[s].out[qAket] <<
", "
68 << H.
R.
in[qR->second] <<
"-" << H.
R.
out[qR->second]
75 if (Vout.
data[s].block[qAbra].size() != 0)
77 Vout.
data[s].block[qAbra] += Mtmp;
81 Vout.
data[s].block[qAbra] = Mtmp;
90template<
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 LAA(qarray< Symmetry::Nq > Lin, qarray< Symmetry::Nq > Lout, size_t s, vector< qarray< Symmetry::Nq > > qloc, const vector< Biped< Symmetry, MatrixType > > &Abra, const vector< Biped< Symmetry, MatrixType > > &Aket, vector< tuple< qarray2< Symmetry::Nq >, size_t, size_t > > &result)
void LRxV(const PivotOverlap1< Symmetry, Scalar > &H, const PivotVector< Symmetry, Scalar > &Vin, PivotVector< Symmetry, Scalar > &Vout)
std::unordered_map< std::array< qType, 2 >, std::size_t > dict
std::vector< MatrixType_ > block
Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > L
vector< qarray< Symmetry::Nq > > qloc
PivotOverlap1(const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &L_input, const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &R_input, const vector< qarray< Symmetry::Nq > > &qloc_input)
Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > R
void outerResize(const PivotVector &Vrhs)
vector< Biped< Symmetry, Matrix< Scalar_, Dynamic, Dynamic > > > data