66 boost::chrono::high_resolution_clock::time_point sweep_now = boost::chrono::high_resolution_clock::now();
70 std::size_t L =
mps.length();
72 int _site = 0, site = 0;
73 if (initial_site != -1) {
85 Storage::prefetch(
left_[site]);
86 Storage::prefetch(
right_[site+1]);
89 maquis::cout <<
mps.description() << std::endl;
91 for (; _site < 2*L; ++_site) {
93 int lr = (_site < L) ? +1 : -1;
96 if (lr == -1 && site == L-1) {
97 maquis::cout <<
"Syncing storage" << std::endl;
101 maquis::cout <<
"Sweep " <<
sweep <<
", optimizing site " << site << std::endl;
118 Storage::fetch(
left_[site]);
119 Storage::fetch(
right_[site+1]);
121 if (lr == +1) Storage::prefetch(
left_[site+1]);
122 else Storage::prefetch(
right_[site]);
124 assert(
left_[site].reasonable() );
125 assert(
right_[site+1].reasonable() );
136 boost::chrono::high_resolution_clock::time_point now, then;
138 std::pair<double, MPSTensor<Matrix, SymmGroup> > res;
142 std::vector<MPSTensor<Matrix, SymmGroup> > ortho_vecs(
base::northo);
152 if (
parms[
"eigensolver"] == std::string(
"IETL")) {
156 } else if (parms["eigensolver"] == std::
string("IETL_JCD")) {
161 throw std::runtime_error(
"I don't know this eigensolver.");
164 mps[site] = res.second;
173 maquis::cout <<
"Energy " << lr <<
" " << res.first << std::endl;
179 int ngs =
parms.template get<int>(
"ngrowsweeps"), nms =
parms.template get<int>(
"nmainsweeps");
181 alpha =
parms.template get<double>(
"alpha_initial");
182 else if (
sweep < ngs + nms)
183 alpha =
parms.template get<double>(
"alpha_main");
185 alpha =
parms.template get<double>(
"alpha_final");
193 maquis::cout <<
"Growing, alpha = " << alpha << std::endl;
195 site, alpha, cutoff, Mmax);
199 mps[site+1].multiply_from_left(t);
203 Storage::drop(
left_[site+1]);
205 }
else if (lr == -1) {
207 maquis::cout <<
"Growing, alpha = " << alpha << std::endl;
210 site, alpha, cutoff, Mmax);
214 mps[site-1].multiply_from_right(t);
218 Storage::drop(
right_[site]);
222 Storage::evict(
left_[site]);
223 Storage::evict(
right_[site+1]);
229 boost::chrono::high_resolution_clock::time_point sweep_then = boost::chrono::high_resolution_clock::now();
230 double elapsed = boost::chrono::duration<double>(sweep_then - sweep_now).count();
231 maquis::cout <<
"Sweep has been running for " << elapsed <<
" seconds." << std::endl;
std::size_t get_Mmax(int sweep) const
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_
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_
results_collector iteration_results_
MPS< Matrix, SymmGroup >::scalar_type overlap(MPS< Matrix, SymmGroup > const &mps1, MPS< Matrix, SymmGroup > const &mps2)
void sweep(int sweep, OptimizeDirection d=Both)
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
int to_site(const int L, const int i) 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
void boundary_left_step(MPO< Matrix, SymmGroup > const &mpo, int site)