VMPS++
Loading...
Searching...
No Matches
VumpsTransferMatrixSF.h
Go to the documentation of this file.
1#ifndef VANILLA_VUMPS_TRANSFERMATRIX_STRUCTUREFACTOR
2#define VANILLA_VUMPS_TRANSFERMATRIX_STRUCTUREFACTOR
3
5
6template<typename Symmetry, typename Scalar>
8{
10
12 const vector<vector<Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &Abra_input,
13 const vector<vector<Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &Aket_input,
14 const Biped<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > &Leigen_input,
15 const Biped<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > &Reigen_input,
16 const vector<vector<qarray<Symmetry::Nq> > > &qloc_input,
17 double k_input,
18 const typename Symmetry::qType& Q = Symmetry::qvacuum())
19 :DIR(DIR_input), Abra(Abra_input), Aket(Aket_input),
20 qloc(qloc_input), k(k_input)
21 {
23 Leigen = Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> >(Leigen_input);
24 Reigen = Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> >(Reigen_input);
25 }
26
28
29 double k;
30
32
34 vector<vector<Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > Abra;
35 vector<vector<Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > Aket;
37
40
41 vector<vector<qarray<Symmetry::Nq> > > qloc;
42};
43
44template<typename Symmetry, typename Scalar>
45void HxV (const TransferMatrixSF<Symmetry,Scalar> &H, const MpoTransferVector<Symmetry,complex<Scalar> > &Vin, MpoTransferVector<Symmetry,complex<Scalar> > &Vout)
46{
47 Vout.data.clear();
48 size_t Lcell = H.qloc.size();
49
50 Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > TxV;
51
53 {
54 // Calculate T*|Vin>
55 Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > Rnext;
56 Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > R = Vin.data;
57 for (int l=Lcell-1; l>=0; --l)
58 {
59 contract_R(R, H.Abra[l], H.Id.W_at(l), H.Aket[l], H.qloc[l], H.Id.opBasis(l), Rnext);
60 R.clear();
61 R = Rnext;
62 Rnext.clear();
63 }
64 TxV = R;
65 }
66 else if (H.DIR == VMPS::DIRECTION::LEFT)
67 {
68 // Calculate <Vin|*T
69 Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > Lnext;
70 Tripod<Symmetry,Matrix<complex<Scalar>,Dynamic,Dynamic> > L = Vin.data;
71 for (size_t l=0; l<Lcell; ++l)
72 {
73 contract_L(L, H.Abra[l], H.Id.W_at(l), H.Aket[l], H.qloc[l], H.Id.opBasis(l), Lnext);
74 L.clear();
75 L = Lnext;
76 Lnext.clear();
77 }
78 TxV = L;
79 }
80 else
81 {
82 assert(1==0 and "Unknown VMPS::DIRECTION::OPTION in TransferMatrixSF!");
83 }
84
85 // result must be:
86 // RIGHT: [1-exp(+i*k)*(T-|R><L|)] * |Vin>
87 // LEFT : <Vin| * [1-exp(-i*k)*(T-|R><L|)]
88
89 Vout = Vin; // multiply 1
90
92 {
93 // subtract exp(+i*k)*T*|Vin>
94 Vout.data.addScale(-exp(+1.i*H.k), TxV.template cast<Matrix<complex<Scalar>,Dynamic,Dynamic> >());
95 // add <L|Vin>*exp(+i*k)*|R>
96 complex<Scalar> LdotV = contract_LR(H.Leigen, Vin.data);
97 Vout.data.addScale(+exp(+1.i*H.k)*LdotV, H.Reigen);
98 }
99 else if (H.DIR == VMPS::DIRECTION::LEFT)
100 {
101 // subtract exp(-i*k)*<Vin|*T
102 Vout.data.addScale(-exp(-1.i*H.k), TxV.template cast<Matrix<complex<Scalar>,Dynamic,Dynamic> >());
103 // add <Vin|R>*exp(-i*k)*<L|
104 complex<Scalar> VdotR = contract_LR(Vin.data, H.Reigen);
105 Vout.data.addScale(+exp(-1.i*H.k)*VdotR, H.Leigen);
106 }
107}
108
109template<typename Symmetry, typename Scalar1, typename Scalar2>
111{
113 HxV(H,Vinout,Vtmp);
114 Vinout = Vtmp;
115}
116
117template<typename Symmetry, typename Scalar>
119{
120 return 0;
121}
122
123#endif
size_t dim(const TransferMatrixSF< Symmetry, Scalar > &H)
void HxV(const TransferMatrixSF< Symmetry, Scalar > &H, const MpoTransferVector< Symmetry, complex< Scalar > > &Vin, MpoTransferVector< Symmetry, complex< Scalar > > &Vout)
const std::vector< std::vector< std::vector< Biped< Symmetry, MatrixType > > > > & W_at(const std::size_t loc) const
Definition: MpoTerms.h:699
const std::vector< std::vector< qType > > & opBasis() const
Definition: MpoTerms.h:710
Definition: Mpo.h:40
Mpo< Symmetry, Scalar > Identity() const
Definition: Mpo.h:130
void contract_R(const Tripod< Symmetry, MatrixType2 > &Rold, const vector< Biped< Symmetry, MatrixType > > &Abra, const vector< vector< vector< Biped< Symmetry, MpoMatrixType > > > > &W, const vector< Biped< Symmetry, MatrixType > > &Aket, const vector< qarray< Symmetry::Nq > > &qloc, const vector< qarray< Symmetry::Nq > > &qOp, Tripod< Symmetry, MatrixType2 > &Rnew, bool RANDOMIZE=false, tuple< CONTRACT_LR_MODE, size_t > MODE_input=make_pair(FULL, 0), const std::unordered_map< pair< qarray< Symmetry::Nq >, size_t >, size_t > &basis_order_map={})
void contract_L(const Tripod< Symmetry, MatrixType2 > &Lold, const vector< Biped< Symmetry, MatrixType > > &Abra, const vector< vector< vector< Biped< Symmetry, MpoMatrixType > > > > &W, const vector< Biped< Symmetry, MatrixType > > &Aket, const vector< qarray< Symmetry::Nq > > &qloc, const vector< qarray< Symmetry::Nq > > &qOp, Tripod< Symmetry, MatrixType2 > &Lnew, bool RANDOMIZE=false, tuple< CONTRACT_LR_MODE, size_t > MODE_input=make_pair(FULL, 0), const std::unordered_map< pair< qarray< Symmetry::Nq >, size_t >, size_t > &basis_order_map={})
Scalar contract_LR(const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &L, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Abra, const vector< vector< vector< Biped< Symmetry, MpoMatrixType > > > > &W, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Aket, const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &R, const vector< qarray< Symmetry::Nq > > &qloc, const vector< qarray< Symmetry::Nq > > &qOp)
Definition: Biped.h:64
void clear()
Definition: Multipede.h:409
vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > Abra
VMPS::DIRECTION::OPTION DIR
Tripod< Symmetry, Matrix< complex< Scalar >, Dynamic, Dynamic > > Leigen
vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > Aket
TransferMatrixSF(VMPS::DIRECTION::OPTION DIR_input, const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &Abra_input, const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &Aket_input, const Biped< Symmetry, Matrix< complex< Scalar >, Dynamic, Dynamic > > &Leigen_input, const Biped< Symmetry, Matrix< complex< Scalar >, Dynamic, Dynamic > > &Reigen_input, const vector< vector< qarray< Symmetry::Nq > > > &qloc_input, double k_input, const typename Symmetry::qType &Q=Symmetry::qvacuum())
Mpo< Symmetry, Scalar > Id
Tripod< Symmetry, Matrix< complex< Scalar >, Dynamic, Dynamic > > Reigen
vector< vector< qarray< Symmetry::Nq > > > qloc
Definition: qarray.h:26