73 boost::chrono::high_resolution_clock::time_point sweep_now = boost::chrono::high_resolution_clock::now();
77 std::size_t L =
mps.length();
79 int _site = 0, site = 0;
80 if (initial_site != -1) {
86 Storage::prefetch(
left_[site]);
87 Storage::prefetch(
right_[site+2]);
89 Storage::prefetch(
left_[site-1]);
90 Storage::prefetch(
right_[site+1]);
94 maquis::cout <<
mps.description() << std::endl;
96 for (; _site < 2*L-2; ++_site) {
103 int lr, site1, site2;
109 ts_cache_mpo[site1].placement_l =
mpo[site1].placement_l;
110 ts_cache_mpo[site1].placement_r =
get_right_placement(ts_cache_mpo[site1],
mpo[site1].placement_l,
mpo[site2].placement_r);
116 ts_cache_mpo[site1].placement_l =
get_left_placement(ts_cache_mpo[site1],
mpo[site1].placement_l,
mpo[site2].placement_r);
117 ts_cache_mpo[site1].placement_r =
mpo[site2].placement_r;
123 maquis::cout << std::endl;
124 maquis::cout <<
"Sweep " <<
sweep <<
", optimizing sites " << site1 <<
" and " << site2 << std::endl;
139 Storage::fetch(
left_[site1]);
140 Storage::fetch(
right_[site2+1]);
144 if (site2+2 <
right_.size()){
145 Storage::prefetch(
right_[site2+2]);
149 Storage::prefetch(
left_[site1-1]);
154 boost::chrono::high_resolution_clock::time_point now, then;
162 std::vector<MPSTensor<Matrix, SymmGroup> > ortho_vecs(
base::northo);
169 std::pair<double, MPSTensor<Matrix, SymmGroup> > res;
175 if (
parms[
"eigensolver"] == std::string(
"IETL")) {
179 } else if (parms["eigensolver"] == std::
string("IETL_JCD")) {
184 throw std::runtime_error(
"I don't know this eigensolver.");
196 maquis::cout <<
"Energy " << lr <<
" " << res.first << std::endl;
206 boost::tie(
mps[site1],
mps[site2], trunc) = tst.split_mps_l2r(Mmax, cutoff);
214 t =
mps[site2].normalize_left(DefaultSolver());
216 maquis::cout <<
"Propagating t with norm " << t.
norm() << std::endl;
217 if (site2 < L-1)
mps[site2+1].multiply_from_left(t);
220 Storage::drop(
right_[site2+1]);
225 Storage::evict(
mps[site1]);
226 Storage::evict(
left_[site1]);
231 boost::tie(
mps[site1],
mps[site2], trunc) = tst.split_mps_r2l(Mmax, cutoff);
239 t =
mps[site1].normalize_right(DefaultSolver());
241 maquis::cout <<
"Propagating t with norm " << t.
norm() << std::endl;
242 if (site1 > 0)
mps[site1-1].multiply_from_right(t);
245 Storage::drop(
left_[site1]);
250 Storage::evict(
mps[site2]);
251 Storage::evict(
right_[site2+1]);
261 boost::chrono::high_resolution_clock::time_point sweep_then = boost::chrono::high_resolution_clock::now();
262 double elapsed = boost::chrono::duration<double>(sweep_then - sweep_now).count();
263 maquis::cout <<
"Sweep has been running for " << elapsed <<
" seconds." << std::endl;
std::size_t get_Mmax(int sweep) const
double truncated_fraction
void sweep(int sweep, OptimizeDirection d=Both)
std::pair< double, MPSTensor< Matrix, SymmGroup > > solve_ietl_lanczos(SiteProblem< Matrix, SymmGroup > &sp, MPSTensor< Matrix, SymmGroup > const &initial, BaseParameters ¶ms)
std::vector< Boundary< typename storage::constrained< Matrix >::type, SymmGroup > > left_
int to_site(const int L, const int i) const
static MPSTensor< Matrix, SymmGroup > site_ortho_boundaries(MPSTensor< Matrix, SymmGroup > const &mps, MPSTensor< Matrix, SymmGroup > const &ortho_mps, block_matrix< OtherMatrix, SymmGroup > const &ortho_left, block_matrix< OtherMatrix, SymmGroup > const &ortho_right)
std::vector< std::vector< block_matrix< typename storage::constrained< Matrix >::type, SymmGroup > > > ortho_left_
std::vector< int > get_right_placement(const MPOTensor< Matrix, SymmGroup > &mpo, const std::vector< int > &placement_l, const std::vector< int > &placement_r_old)
results_collector iteration_results_
MPS< Matrix, SymmGroup >::scalar_type overlap(MPS< Matrix, SymmGroup > const &mps1, MPS< Matrix, SymmGroup > const &mps2)
std::vector< std::vector< block_matrix< typename storage::constrained< Matrix >::type, SymmGroup > > > ortho_right_
std::pair< double, MPSTensor< Matrix, SymmGroup > > solve_ietl_jcd(SiteProblem< Matrix, SymmGroup > &sp, MPSTensor< Matrix, SymmGroup > const &initial, BaseParameters ¶ms, std::vector< MPSTensor< Matrix, SymmGroup > > ortho_vecs=std::vector< MPSTensor< Matrix, SymmGroup > >())
boost::function< bool()> stop_callback
MPO< Matrix, SymmGroup > const & mpo
MPS< Matrix, SymmGroup > & mps
double get_cutoff(int sweep) const
#define BEGIN_TIMING(name)
std::vector< Boundary< typename storage::constrained< Matrix >::type, SymmGroup > > right_
void boundary_right_step(MPO< Matrix, SymmGroup > const &mpo, int site)
std::size_t bond_dimension
std::vector< MPS< Matrix, SymmGroup > > ortho_mps
std::vector< int > get_left_placement(const MPOTensor< Matrix, SymmGroup > &mpo, const std::vector< int > &placement_l_old, const std::vector< int > &placement_r)
void boundary_left_step(MPO< Matrix, SymmGroup > const &mpo, int site)