7#include "yas/serialize.hpp"
8#include "yas/std_types.hpp"
19template <
typename,
typename,
bool>
20struct OneSiteObservable;
21template <
typename,
typename,
bool>
22struct TwoSiteObservable;
60template <
typename Scalar_,
typename Symmetry_, std::size_t TRank = 2,
bool ENABLE_AD =
false, Opts::CTMCheckpoint CPOpts = Opts::CTMCheckpoint{}>
63 template <
typename Scalar__,
73 template <
typename Scalar__,
85 template <
typename,
typename, std::
size_t,
bool, Opts::CTMCheckpo
int>
92 template <std::
size_t N>
93 using cdims = std::array<int, N>;
97 explicit CTM(std::size_t
chi, Opts::CTM_INIT
init = Opts::CTM_INIT::FROM_A)
122 cell_ = A_in->cell();
123 if constexpr(TRank == 1) {
129 std::size_t
fullChi()
const {
return C1s[0].uncoupledCodomain()[0].fullDim(); }
131 template <
bool TRACK = ENABLE_AD>
132 void solve(std::size_t max_steps);
134 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.GROW_ALL>
138 void loadFromMatlab(
const std::filesystem::path& p,
const std::string& root_name,
int qn_scale = 1);
140 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.MOVE>
142 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.MOVE>
144 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.MOVE>
146 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.MOVE>
148 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.MOVE>
151 template <
bool TRACK = ENABLE_AD>
160 const std::shared_ptr<iPEPS<Scalar, Symmetry, ENABLE_AD>>&
Psi()
const {
return A; }
162 template <
typename Ar>
165 ar& YAS_OBJECT_NVP(
"CTM",
168 (
"HAS_RDM", HAS_RDM),
184 std::size_t
chi()
const {
return chi_; }
189 std::shared_ptr<iPEPS<Scalar, Symmetry, ENABLE_AD>> A;
192 Opts::CTM_INIT init_m = Opts::CTM_INIT::FROM_A;
193 Opts::PROJECTION proj_m = Opts::PROJECTION::CORNER;
194 bool HAS_RDM =
false;
220 template <
bool TRACK = ENABLE_AD>
223 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RDM>
225 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RDM>
228 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.CORNER>
231 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.PROJECTORS>
233 get_projectors(
const int x,
const int y,
const Opts::DIRECTION dir) XPED_CONST;
235 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RENORMALIZE>
236 std::tuple<Tensor<Scalar, 0, 2, Symmetry, TRACK>,
Tensor<Scalar, 1, TRank + 1, Symmetry, TRACK>,
Tensor<Scalar, 1, 1, Symmetry, TRACK>>
237 renormalize_left(
const int x,
241 bool NORMALIZE =
true) XPED_CONST;
243 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RENORMALIZE>
244 std::tuple<
Tensor<
Scalar, 1, 1,
Symmetry, TRACK>,
Tensor<
Scalar, TRank + 1, 1,
Symmetry, TRACK>,
Tensor<
Scalar, 2, 0,
Symmetry, TRACK>>
245 renormalize_right(const
int x,
249 bool NORMALIZE = true) XPED_CONST;
251 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RENORMALIZE>
252 std::tuple<
Tensor<
Scalar, 0, 2,
Symmetry, TRACK>,
Tensor<
Scalar, 1, TRank + 1,
Symmetry, TRACK>,
Tensor<
Scalar, 1, 1,
Symmetry, TRACK>>
253 renormalize_top(const
int x,
257 bool NORMALIZE = true) XPED_CONST;
259 template <
bool TRACK = ENABLE_AD,
bool CP = CPOpts.RENORMALIZE>
260 std::tuple<
Tensor<
Scalar, 1, 1,
Symmetry, TRACK>,
Tensor<
Scalar, TRank + 1, 1,
Symmetry, TRACK>,
Tensor<
Scalar, 2, 0,
Symmetry, TRACK>>
261 renormalize_bottom(const
int x,
265 bool NORMALIZE = true) XPED_CONST;
272#ifndef XPED_COMPILED_LIB
const std::shared_ptr< iPEPS< Scalar, Symmetry, ENABLE_AD > > & Psi() const
Definition: CTM.hpp:160
void serialize(Ar &ar)
Definition: CTM.hpp:163
void left_move()
Definition: CTM.cpp:693
friend class CTM
Definition: CTM.hpp:86
friend std::array< TMatrix< std::conditional_t< ENABLE_AD__, stan::math::var, typename TwoSiteObservable< OpScalar__, Symmetry__, HERMITIAN__ >::ObsScalar > >, 4 > avg(XPED_CONST CTM< Scalar__, Symmetry__, TRank__, ENABLE_AD__, CPOpts__ > &env, TwoSiteObservable< OpScalar__, Symmetry__, HERMITIAN__ > &op)
std::size_t chi() const
Definition: CTM.hpp:184
void right_move()
Definition: CTM.cpp:759
void set_A(std::shared_ptr< iPEPS< Scalar, Symmetry, ENABLE_AD > > A_in)
Definition: CTM.hpp:119
CTM(std::size_t chi, Opts::CTM_INIT init=Opts::CTM_INIT::FROM_A)
Definition: CTM.hpp:97
CTM(std::size_t chi, const UnitCell &cell, Opts::CTM_INIT init=Opts::CTM_INIT::FROM_A)
Definition: CTM.hpp:102
auto info() const
Definition: CTM.cpp:376
void computeRDM()
Definition: CTM.cpp:367
Symmetry_ Symmetry
Definition: CTM.hpp:89
friend TMatrix< std::conditional_t< ENABLE_AD__, stan::math::var, typename OneSiteObservable< OpScalar__, Symmetry__, HERMITIAN__ >::ObsScalar > > avg(XPED_CONST CTM< Scalar__, Symmetry__, TRank__, ENABLE_AD__, CPOpts__ > &env, OneSiteObservable< OpScalar__, Symmetry__, HERMITIAN__ > &op)
std::size_t fullChi() const
Definition: CTM.hpp:129
Scalar_ Scalar
Definition: CTM.hpp:90
void grow_all()
Definition: CTM.cpp:333
void top_move()
Definition: CTM.cpp:824
const UnitCell & cell() const
Definition: CTM.hpp:159
void loadFromMatlab(const std::filesystem::path &p, const std::string &root_name, int qn_scale=1)
Definition: CTM.cpp:199
CTM(std::shared_ptr< iPEPS< Scalar, Symmetry, ENABLE_AD > > A, std::size_t chi, const Opts::CTM_INIT init=Opts::CTM_INIT::FROM_A)
Definition: CTM.hpp:108
void solve(std::size_t max_steps)
Definition: CTM.cpp:319
void bottom_move()
Definition: CTM.cpp:889
bool RDM_COMPUTED() const
Definition: CTM.hpp:153
void init()
Definition: CTM.cpp:45
void checkHermiticity() const
Definition: CTM.cpp:401
std::array< int, N > cdims
Definition: CTM.hpp:93
Opts::CTM_INIT const init_mode()
Definition: CTM.hpp:186
Definition: Tensor.hpp:40
Definition: OneSiteObservable.hpp:21
Definition: CTMOpts.hpp:96
Definition: ScalarTraits.hpp:10
Definition: TMatrix.hpp:13
Definition: TwoSiteObservable.hpp:22
Definition: UnitCell.hpp:15
Pattern pattern
Definition: UnitCell.hpp:27