VMPS++
Loading...
Searching...
No Matches
MpsBoundaries.h
Go to the documentation of this file.
1#ifndef MPSBOUNDARIES
2#define MPSBOUNDARIES
3
4template<typename Symmetry, typename Scalar>
6{
7public:
8
9 typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
10
12
13 MpsBoundaries (const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &L_input,
14 const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &R_input,
15 const vector<vector<Biped<Symmetry,MatrixType> > > &AL_input,
16 const vector<vector<Biped<Symmetry,MatrixType> > > &AR_input,
17 const vector<vector<qarray<Symmetry::Nq> > > &qloc_input)
18 :L(L_input), R(R_input), qloc(qloc_input)
19 {
20 A[0] = AL_input;
21 A[1] = AR_input;
22 N_sites = qloc.size();
23 assert(A[0].size() == N_sites and A[1].size() == N_sites);
24 TRIVIAL_BOUNDARIES = false;
25 };
26
27 inline size_t length() const {return N_sites;}
28
29 inline bool IS_TRIVIAL() const {return TRIVIAL_BOUNDARIES;}
30
32 {
34 {
35 L.clear();
36 L.setVacuum();
37 R.clear();
38 R.setTarget(qarray3<Symmetry::Nq>{Qtot, Qtot, Symmetry::qvacuum()});
39 }
40 }
41
42 template<typename OtherScalar>
44 {
46
47 Bout.qloc = qloc;
48
49 Bout.L = L.template cast<Matrix<OtherScalar,Dynamic,Dynamic> >();
50 Bout.R = R.template cast<Matrix<OtherScalar,Dynamic,Dynamic> >();
51
52 Bout.Lsq = Lsq.template cast<Matrix<OtherScalar,Dynamic,Dynamic> >();
53 Bout.Rsq = Rsq.template cast<Matrix<OtherScalar,Dynamic,Dynamic> >();
54
55 for (size_t g=0; g<A.size(); ++g)
56 {
57 Bout.A[g].resize(A[g].size());
58 }
59
60 Bout.N_sites = N_sites;
62
63 for (size_t g=0; g<A.size(); ++g)
64 for (size_t l=0; l<A[g].size(); ++l)
65 {
66 Bout.A[g][l].resize(A[g][l].size());
67
68 for (size_t s=0; s<qloc[l].size(); ++s)
69 {
70 Bout.A[g][l][s].in = A[g][l][s].in;
71 Bout.A[g][l][s].out = A[g][l][s].out;
72 Bout.A[g][l][s].dict = A[g][l][s].dict;
73 Bout.A[g][l][s].dim = A[g][l][s].dim;
74
75 Bout.A[g][l][s].block.resize(A[g][l][s].dim);
76 for (size_t q=0; q<A[g][l][s].dim; ++q)
77 {
78 Bout.A[g][l][s].block[q] = A[g][l][s].block[q].template cast<OtherScalar>();
79 }
80 }
81 }
82
83 return Bout;
84 }
85
86 bool TRIVIAL_BOUNDARIES = true;
87
88 size_t N_sites = 0;
89
92
95
96 std::array<vector<vector<Biped<Symmetry,MatrixType> > >,3> A;
97
98 vector<vector<qarray<Symmetry::Nq> > > qloc;
99};
100
101#endif
size_t dim(const PivotMatrix0< Symmetry, Scalar, MpoScalar > &H)
Matrix< Scalar, Dynamic, Dynamic > MatrixType
Definition: MpsBoundaries.h:9
std::array< vector< vector< Biped< Symmetry, MatrixType > > >, 3 > A
Definition: MpsBoundaries.h:96
MpsBoundaries< Symmetry, OtherScalar > cast() const
Definition: MpsBoundaries.h:43
size_t length() const
Definition: MpsBoundaries.h:27
Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > Lsq
Definition: MpsBoundaries.h:93
MpsBoundaries(const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &L_input, const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &R_input, const vector< vector< Biped< Symmetry, MatrixType > > > &AL_input, const vector< vector< Biped< Symmetry, MatrixType > > > &AR_input, const vector< vector< qarray< Symmetry::Nq > > > &qloc_input)
Definition: MpsBoundaries.h:13
vector< vector< qarray< Symmetry::Nq > > > qloc
Definition: MpsBoundaries.h:98
void set_open_bc(qarray< Symmetry::Nq > &Qtot)
Definition: MpsBoundaries.h:31
Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > L
Definition: MpsBoundaries.h:90
bool TRIVIAL_BOUNDARIES
Definition: MpsBoundaries.h:86
Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > R
Definition: MpsBoundaries.h:91
Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > Rsq
Definition: MpsBoundaries.h:94
bool IS_TRIVIAL() const
Definition: MpsBoundaries.h:29
std::array< qarray< Nq >, 3 > qarray3
Definition: qarray.h:52
Definition: Biped.h:64
Definition: qarray.h:26