1#ifndef VANILLA_VUMPSSOLVER
2#define VANILLA_VUMPSSOLVER
4#ifndef LINEARSOLVER_DIMK
5#define LINEARSOLVER_DIMK 500
10#include "termcolor.hpp"
13#include "LanczosSolver.h"
14#include "GMResSolver.h"
31template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar=
double>
68 double memory (MEMUNIT memunit=GB)
const;
80 void set_log (
int N_log_input,
string file_e_input,
string file_err_eigval_input,
string file_err_var_input,
string file_err_state_input);
87 qarray<Symmetry::Nq> Qtot, LANCZOS::EDGE::OPTION EDGE=LANCZOS::EDGE::GROUND,
bool USE_STATE=
false);
142 size_t M,
size_t Nqmax,
bool USE_STATE=
false);
175 void build_LR (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AL,
176 const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AR,
177 const vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > &C,
178 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
184 void build_R (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AR,
185 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Cintercell,
186 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
191 void build_L (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AL,
192 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Cintercell,
193 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
255 vector<PivumpsMatrix1<Symmetry,Scalar,Scalar> >
Heff;
258 vector<PivotMatrix1<Symmetry,Scalar,Scalar> >
HeffA;
261 vector<PivotMatrix1<Symmetry,Scalar,Scalar> >
HeffC;
264 vector<qarray<Symmetry::Nq> >
qloc;
295 const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Y_LR,
297 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
301 const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &LRguess,
302 Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &LRres);
379template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
384 ss <<
"VumpsSolver: ";
385 ss <<
"L=" << N_sites <<
", ";
390template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
395 ss <<
"iterations=" << N_iterations <<
", ";
396 ss <<
"e0=" << setprecision(13) << min(eL,eR) <<
", ";
397 ss <<
"err_eigval=" << setprecision(13) << err_eigval <<
", err_var=" << err_var <<
", ";
398 if (!isnan(err_state))
400 ss <<
"err_state=" << err_state <<
", ";
402 ss <<
"mem=" << round(memory(GB),3) <<
"GB";
406template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
408memory (MEMUNIT memunit)
const
425template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
427set_log (
int N_log_input,
string file_e_input,
string file_err_eigval_input,
string file_err_var_input,
string file_err_state_input)
430 file_e = file_e_input;
431 file_err_eigval = file_err_eigval_input;
432 file_err_var = file_err_var_input;
433 file_err_state = file_err_state_input;
436 err_eigval_mem.clear();
438 err_state_mem.clear();
441template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
446 if (N_log>0 or FORCE==
true)
448 eL_mem.push_back(eL);
449 eR_mem.push_back(eR);
450 err_eigval_mem.push_back(err_eigval);
451 err_var_mem.push_back(err_var);
452 err_state_mem.push_back(err_state);
455 if ((N_log>0 and N_iterations%N_log==0) or FORCE==
true)
458 ofstream Filer(file_e);
459 for (
int i=0; i<eL_mem.size(); ++i)
461 Filer << i <<
"\t" << setprecision(13) << min(eL_mem[i],eR_mem[i]) <<
"\t" << eL_mem[i] <<
"\t" << eR_mem[i] << endl;
466 Filer.open(file_err_eigval);
467 for (
int i=0; i<err_eigval_mem.size(); ++i)
469 Filer << i <<
"\t" << setprecision(13) << err_eigval_mem[i] << endl;
474 Filer.open(file_err_var);
475 for (
int i=0; i<err_var_mem.size(); ++i)
477 Filer << i <<
"\t" << setprecision(13) << err_var_mem[i] << endl;
482 Filer.open(file_err_state);
483 for (
int i=0; i<err_state_mem.size(); ++i)
485 Filer << i <<
"\t" << setprecision(13) << err_state_mem[i] << endl;
491template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
498 tolLanczosEigval = max(max(1.e-2*err_eigval,LocParam.eps_eigval),LocParam.eps_eigval);
499 tolLanczosState = max(max(1.e-2*err_var, LocParam.eps_coeff) ,LocParam.eps_coeff);
501 if (std::isnan(tolLanczosEigval))
503 tolLanczosEigval = 1e-14;
506 if (std::isnan(tolLanczosState))
508 tolLanczosState = 1e-14;
513 lout <<
"current Lanczos tolerances: " << tolLanczosEigval <<
", " << tolLanczosState << endl;
517template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
521 std::array<VectorXd,2> epsLRsq;
523 for (
const auto &g:gs)
525 epsLRsq[g].resize(N_sites);
526 for (
size_t l=0; l<N_sites; ++l)
528 epsLRsq[g](l) = std::real(Vout.state.calc_epsLRsq(g,l));
531 err_var_old = err_var;
534 err_eigval_old = err_eigval;
535 err_eigval = max(abs(eoldR-eR), abs(eoldL-eL));
542 err_state_old = err_state;
544 vector<double> norm_NAAN(N_sites);
545 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
546 #pragma omp parallel for
548 for (
size_t l=0; l<N_sites; ++l)
550 vector<Biped<Symmetry,MatrixType> > NL;
551 vector<Biped<Symmetry,MatrixType> > NR;
553 calc_B2(l, H, Vout.state, option, NAAN, NL, NR);
557 for (
size_t l=0; l<N_sites; ++l)
559 if (norm_NAAN[l] > err_state) {err_state = norm_NAAN[l];}
564template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
569 Stopwatch<> PrepTimer;
574 D = h2site_input.shape()[0];
578 Heff.resize(N_sites);
579 h2site.resize(boost::extents[D][D][D][D]);
580 h2site = h2site_input;
586 Vout.state =
Umps<Symmetry,Scalar>(qloc_input, Qtot, N_sites, M, Nqmax, GlobParam.INIT_TO_HALF_INTEGER_QN);
587 Vout.state.setRandom();
588 for (
size_t l=0; l<N_sites; ++l)
590 Vout.state.svdDecompose(l);
596 eoldL = std::nan(
"");
597 eoldR = std::nan(
"");
603 lout << PrepTimer.info(
"prepare") << endl;
607template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
611 N_sites = H.length();
613 N_iterations_without_expansion = 0;
615 Stopwatch<> PrepTimer;
618 D = H.locBasis(0).size();
619 assert(H.inBasis(0) == H.outBasis(N_sites-1) and
"You've inserted a strange MPO not consistent with the unit cell");
620 dW = H.inBasis(0).size();
621 dW_singlet = H.inBasis(0).inner_dim(Symmetry::qvacuum());
623 basis_order = H.base_order_IBC();
624 for (
size_t i=0; i<basis_order.size(); ++i)
626 basis_order_map.insert({basis_order[i],i});
632 Vout.state =
Umps<Symmetry,Scalar>(H, Qtot, N_sites, GlobParam.Minit, GlobParam.Qinit, GlobParam.INIT_TO_HALF_INTEGER_QN);
634 Vout.state.max_Nsv = GlobParam.Mlimit;
642 for (
size_t l=0; l<N_sites; ++l) Vout.state.calc_entropy(l,(CHOSEN_VERBOSITY >=
DMRG::VERBOSITY::STEPWISE)?
true :
false);
645 eoldL = std::nan(
"");
646 eoldR = std::nan(
"");
651 HeffA.resize(N_sites);
652 for (
int l=0; l<N_sites; ++l) HeffA[l].Terms.resize(1);
656 lout << PrepTimer.info(
"• initial decomposition") << endl;
657 lout <<
"• initial state : " << Vout.state.info() << endl;
658 int i_expansion_switchoff=0;
659 for (
int i=0; i<GlobParam.max_iterations; ++i)
661 if (DynParam.max_deltaM(i) == 0.) {i_expansion_switchoff = i;
break;}
664 lout <<
"• expansion turned off after ";
665 cout << termcolor::underline;
666 lout << i_expansion_switchoff;
667 cout << termcolor::reset;
668 lout <<
" iterations" << endl;
670 lout <<
"• initial bond dim. increase by ";
671 cout << termcolor::underline;
672 lout << static_cast<int>((DynParam.Mincr_rel(0)-1.)*100.) <<
"%";
673 cout << termcolor::reset;
674 lout <<
" and at least by ";
675 cout << termcolor::underline;
676 lout << DynParam.Mincr_abs(0);
677 cout << termcolor::reset << endl;
679 lout <<
"• keep at least ";
680 cout << termcolor::underline;
681 lout << Vout.state.min_Nsv;
682 cout << termcolor::reset;
683 lout <<
" singular values per block" << endl;
685 lout <<
"• make between ";
686 cout << termcolor::underline;
687 lout << GlobParam.min_iterations;
688 cout << termcolor::reset;
690 cout << termcolor::underline;
691 lout << GlobParam.max_iterations;
692 cout << termcolor::reset;
693 lout <<
" iterations" << endl;
695 bool USE_PARALLEL=
false, USE_SEQUENTIAL=
false, USE_DYNAMIC=
false;
696 for (
int i=0; i<GlobParam.max_iterations; ++i)
702 if (USE_DYNAMIC and N_sites == 1)
704 lout <<
"• use the parallel algorithm" << endl;
706 else if (USE_DYNAMIC and N_sites > 1)
708 lout <<
"• use the sequential algorithm" << endl;
710 else if (USE_PARALLEL and USE_SEQUENTIAL)
712 lout <<
"• use a combination of sequential and parallel algorithm" << endl;
714 else if (USE_PARALLEL)
716 lout <<
"• use the parallel algorithm" << endl;
718 else if (USE_SEQUENTIAL)
720 lout <<
"• use the sequential algorithm" << endl;
722 lout <<
"• eigenvalue tolerance : ";
723 cout << termcolor::underline;
724 lout << GlobParam.tol_eigval;
725 cout << termcolor::reset;
727 lout <<
"• variational tolerance: ";
728 cout << termcolor::underline;
729 lout << GlobParam.tol_var;
730 cout << termcolor::reset;
732 lout <<
"• state tolerance: ";
733 cout << termcolor::underline;
734 lout << GlobParam.tol_state;
735 cout << termcolor::reset;
743template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
747 Stopwatch<> PrepTimer;
752 assert(H.inBasis(0) == H.outBasis(N_sites-1) and
"You insert a strange MPO not consistent with the unit cell");
753 dW = H.inBasis(0).size();
758 Vout.state =
Umps<Symmetry,Scalar>(H.locBasis(0), Qtot, N_sites, GlobParam.Minit, GlobParam.Qinit, GlobParam.INIT_TO_HALF_INTEGER_QN);
759 Vout.state.max_Nsv = GlobParam.Mlimit;
760 Vout.state.setRandom();
761 for (
size_t l=0; l<N_sites; ++l)
763 Vout.state.svdDecompose(l);
769 HeffA[0].Terms.resize(1);
774 HeffA[0].Terms[0].L.setIdentity(dW, 1, inbase);
775 HeffA[0].Terms[0].R.setIdentity(dW, 1, outbase);
778 eoldL = std::nan(
"");
779 eoldR = std::nan(
"");
785 lout << PrepTimer.info(
"prepare") << endl;
789template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
791build_L (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AL,
792 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Cintercell,
793 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
798 Stopwatch<> GMresTimer;
807 vector<Tripod<Symmetry,MatrixType> > YL(dW);
814 L.
insert(basis_order[dW-1],IdL);
816 for (
int b=dW-2; b>=0; --b)
818 YL[b] =
make_YL(b, L, AL, W, AL, qloc, qOp, basis_order_map);
822 L.
insert(basis_order[b],YL[b]);
828 solve_linear(
VMPS::DIRECTION::LEFT, b, AL, YL[b], Reigen, W, qloc, qOp,
contract_LR(basis_order[b],YL[b],Reigen), Ltmp_guess, Ltmp);
829 L.
insert(basis_order[b],Ltmp);
834template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
836build_R (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AR,
837 const Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Cintercell,
838 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
843 Stopwatch<> GMresTimer;
852 vector<Tripod<Symmetry,MatrixType> > YR(dW);
859 R.
insert(basis_order[0],IdR);
861 for (
int a=1; a<dW; ++a)
863 YR[a] =
make_YR(a, R, AR, W, AR, qloc, qOp, basis_order_map);
867 R.
insert(basis_order[a],YR[a]);
873 solve_linear(
VMPS::DIRECTION::RIGHT, a, AR, YR[a], Leigen, W, qloc, qOp,
contract_LR(basis_order[a],Leigen,YR[a]), Rtmp_guess, Rtmp);
874 R.
insert(basis_order[a],Rtmp);
879template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
881build_LR (
const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AL,
882 const vector<vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > > &AR,
883 const vector<
Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > &C,
884 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
890 Stopwatch<> GMresTimer;
902 vector<Tripod<Symmetry,MatrixType> > YL(dW);
903 vector<Tripod<Symmetry,MatrixType> > YR(dW);
913 L.
insert(basis_order[dW-1], IdL);
914 R.
insert(basis_order[0], IdR);
916 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
917 #pragma omp parallel sections
921 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
925 for (
int b=dW-2; b>=0; --b)
927 YL[b] =
make_YL(b, L, AL, W, AL, qloc, qOp, basis_order_map);
931 L.
insert(basis_order[b],YL[b]);
938 solve_linear(
VMPS::DIRECTION::LEFT, b, AL, YL[b], Reigen, W, qloc, qOp,
contract_LR(basis_order[b],YL[b],Reigen), Ltmp_guess, Ltmp);
939 L.
insert(basis_order[b],Ltmp);
943 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
947 cout <<
"<L[0]|R>=" <<
contract_LR(basis_order[0],Ltmp,Reigen) << endl;
955 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
959 for (
int a=1; a<dW; ++a)
961 YR[a] =
make_YR(a, R, AR, W, AR, qloc, qOp, basis_order_map);
965 R.
insert(basis_order[a],YR[a]);
971 solve_linear(
VMPS::DIRECTION::RIGHT, a, AR, YR[a], Leigen, W, qloc, qOp,
contract_LR(basis_order[a],Leigen,YR[a]), Rtmp_guess, Rtmp);
972 R.
insert(basis_order[a],Rtmp);
976 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
980 cout <<
"<L|R[dW-1]>=" <<
contract_LR(basis_order[dW-1],Leigen,Rtmp) << endl;
990 lout <<
"linear systems" << GMresTimer.info() << endl;
1028template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1034 HeffC.resize(N_sites);
1035 for (
size_t l=0; l<N_sites; ++l) HeffC[l].Terms.resize(1);
1037 for (
size_t l=0; l<N_sites; ++l)
1041 HeffA[l].Terms[0].W = H.get_W_power(power)[l];
1042 HeffC[l].Terms[0].W = H.get_W_power(power)[l];
1050 H.get_W_power(power), H.locBasis(), H.get_qOp_power(power),
1051 HeffA[0].Terms[0].L, HeffA[N_sites-1].Terms[0].R);
1054 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1055 #pragma omp parallel sections
1058 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1062 for (
size_t l=1; l<N_sites; ++l)
1069 Vout.state.A[
GAUGE::L][l-1], H.get_W_power(power)[l-1], Vout.state.A[
GAUGE::L][l-1],
1070 H.locBasis(l-1), H.get_qOp_power(power)[l-1],
1071 HeffA[l].Terms[0].L);
1074 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1078 for (
int l=N_sites-2; l>=0; --l)
1085 Vout.state.A[
GAUGE::R][l+1], H.get_W_power(power)[l+1], Vout.state.A[
GAUGE::R][l+1],
1086 H.locBasis(l+1), H.get_qOp_power(power)[l+1],
1087 HeffA[l].Terms[0].R);
1092 for (
size_t l=0; l<N_sites; ++l)
1094 HeffC[l].Terms[0].L = HeffA[(l+1)%N_sites].Terms[0].L;
1095 HeffC[l].Terms[0].R = HeffA[l].Terms[0].R;
1099template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1103 Stopwatch<> IterationTimer;
1104 double tolLanczosEigval, tolLanczosState;
1105 set_LanczosTolerances(tolLanczosEigval,tolLanczosState);
1108 double t_trunc = 0.;
1119 if ((err_var < GlobParam.tol_var and N_iterations_without_expansion > GlobParam.min_iter_without_expansion) or
1120 N_iterations_without_expansion > GlobParam.max_iter_without_expansion
1123 Stopwatch<> ExpansionTimer;
1124 size_t current_M = Vout.state.calc_Mmax();
1125 size_t deltaM = min(max(
static_cast<size_t>((DynParam.Mincr_rel(N_iterations)-1) * current_M), DynParam.Mincr_abs(N_iterations)),
1126 DynParam.max_deltaM(N_iterations));
1129 lout << termcolor::blue
1130 <<
"Nsv=" << current_M
1131 <<
", rel=" <<
static_cast<size_t>(DynParam.Mincr_rel(N_iterations) * current_M-current_M)
1132 <<
", abs=" << DynParam.Mincr_abs(N_iterations)
1133 <<
", lim=" << DynParam.max_deltaM(N_iterations)
1134 <<
", deltaM=" << deltaM
1135 << termcolor::reset << endl;
1139 FORCE_DO_SOMETHING =
true;
1140 DynParam.doSomething(N_iterations);
1141 FORCE_DO_SOMETHING =
false;
1142 if (Vout.state.calc_Mmax()+deltaM >= GlobParam.Mlimit) {deltaM = GlobParam.Mlimit-Vout.state.calc_Mmax();}
1143 else if (Vout.state.calc_Mmax() == GlobParam.Mlimit) {deltaM=0ul;}
1144 else if (Vout.state.calc_Mmax() > GlobParam.Mlimit) {assert(
false and
"Exceeded Mlimit.");}
1149 lout << termcolor::blue <<
"performing expansion with " << expand_option << termcolor::reset << endl;
1151 expand_basis2(deltaM, H, Vout, expand_option);
1152 t_exp = ExpansionTimer.time();
1153 N_iterations_without_expansion = 0;
1156 if ((N_iterations+1)%GlobParam.truncatePeriod == 0 )
1158 Stopwatch<> TruncationTimer;
1159 Vout.state.truncate(
false);
1160 t_trunc = TruncationTimer.time();
1163 Stopwatch<> EnvironmentTimer;
1164 build_cellEnv(H,Vout);
1165 double t_env = EnvironmentTimer.time();
1167 Stopwatch<> OptimizationTimer;
1169 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1170 #pragma omp parallel for schedule(dynamic)
1172 for (
size_t l=0; l<N_sites; ++l)
1175 H.locBasis(l), H.opBasis(l), HeffA[l].qlhs, HeffA[l].qrhs, HeffA[l].factor_cgcs);
1177 Eigenstate<PivotVector<Symmetry,Scalar> > gAC;
1178 Eigenstate<PivotVector<Symmetry,Scalar> > gC;
1183 Stopwatch<> LanczosTimer;
1185 Lutz.set_dimK(min(LocParam.dimK,
dim(gAC.state)));
1186 Lutz.edgeState(HeffA[l], gAC, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1189 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1190 #pragma omp critical
1193 lout <<
"l=" << l <<
", AC" <<
", time" << LanczosTimer.info() <<
", " << Lutz.info() << endl;
1198 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1199 #pragma omp critical
1202 lout <<
"e0(AC)=" << setprecision(13) << gAC.energy <<
", ratio=" << gAC.energy/Vout.energy << endl;
1210 Lucy.set_dimK(min(LocParam.dimK,
dim(gC.state)));
1211 Lucy.edgeState(
PivotMatrix0(HeffC[l]), gC, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1215 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1216 #pragma omp critical
1219 lout <<
"l=" << l <<
", C" <<
", time" << LanczosTimer.info() <<
", " << Lucy.info() << endl;
1224 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1225 #pragma omp critical
1228 lout <<
"e0(C)=" << setprecision(13) << gC.energy <<
", ratio=" << gC.energy/Vout.energy << endl;
1232 Vout.state.A[
GAUGE::C][l] = gAC.state.data;
1233 Vout.state.C[l] = gC.state.data[0];
1236 double t_opt = OptimizationTimer.time();
1238 Stopwatch<> SweepTimer;
1239 for (
size_t l=0; l<N_sites; ++l)
1242 (err_var>0.01)? Vout.state.svdDecompose(l) : Vout.state.polarDecompose(l);
1258 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1259 #pragma omp parallel sections
1262 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1266 Reigen = Vout.state.C[N_sites-1].
contract(Vout.state.C[N_sites-1].adjoint());
1267 eL = std::real(
contract_LR(basis_order[0], YLlast, Reigen)) / H.volume();
1269 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
1273 Leigen = Vout.state.C[N_sites-1].
adjoint().contract(Vout.state.C[N_sites-1]);
1274 eR = std::real(
contract_LR(basis_order[dW-1], Leigen, YRfrst)) / H.volume();
1277 Vout.energy = min(eL,eR);
1297 double t_sweep = SweepTimer.time();
1299 Stopwatch<> ErrorTimer;
1302 if (abs(err_state_old-err_state)/err_state > 1e-3 or N_iterations_without_expansion<=1 or N_iterations<=6)
1304 calc_errors(H, Vout, GlobParam.CALC_STATE_ERROR);
1305 t_err = ErrorTimer.time();
1308 lout << ErrorTimer.info(
"error calculation") << endl;
1313 calc_errors(H, Vout,
false);
1316 lout <<
"State error seems converged and will not be recalculated until the next expansion!" << endl;
1322 lout << Vout.state.test_ortho() << endl;
1323 lout << termcolor::blue <<
"eL=" << eL <<
", eR=" << eR << termcolor::reset << endl;
1324 lout << test_LReigen(Vout) << endl;
1328 ++N_iterations_without_expansion;
1330 double t_tot = IterationTimer.time();
1334 size_t standard_precision = cout.precision();
1335 lout << termcolor::bold << eigeninfo() << termcolor::reset << endl;
1337 lout << Vout.state.info() << endl;
1338 lout << IterationTimer.info(
"full parallel iteration")
1339 <<
" (environment=" << round(t_env/t_tot*100.,0) <<
"%"
1340 <<
", optimization=" << round(t_opt/t_tot*100.,0) <<
"%"
1341 <<
", sweep=" << round(t_sweep/t_tot*100.,0) <<
"%"
1342 <<
", error=" << round(t_err/t_tot*100.,0) <<
"%";
1343 if (t_exp != 0.) {lout <<
", basis expansion=" << round(t_exp/t_tot*100.,0) <<
"%";}
1344 if (t_trunc != 0) {lout <<
", basis truncation=" << round(t_trunc/t_tot*100.,0) <<
"%";}
1350template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1354 Stopwatch<> IterationTimer;
1356 double tolLanczosEigval, tolLanczosState;
1357 set_LanczosTolerances(tolLanczosEigval,tolLanczosState);
1360 double t_trunc = 0.;
1371 if ((err_var < GlobParam.tol_var and N_iterations_without_expansion > GlobParam.min_iter_without_expansion) or
1372 N_iterations_without_expansion > GlobParam.max_iter_without_expansion
1376 FORCE_DO_SOMETHING =
true;
1377 lout << termcolor::blue <<
"Performing a measurement for N_iterations=" << N_iterations << termcolor::reset << endl;
1378 DynParam.doSomething(N_iterations);
1379 FORCE_DO_SOMETHING =
false;
1381 Stopwatch<> ExpansionTimer;
1382 size_t current_M = Vout.state.calc_Mmax();
1383 size_t deltaM = min(max(
static_cast<size_t>(DynParam.Mincr_rel(N_iterations) * current_M-current_M), DynParam.Mincr_abs(N_iterations)),
1384 DynParam.max_deltaM(N_iterations));
1387 lout << termcolor::blue
1388 <<
"Nsv=" << current_M
1389 <<
", rel=" <<
static_cast<size_t>(DynParam.Mincr_rel(N_iterations) * current_M-current_M)
1390 <<
", abs=" << DynParam.Mincr_abs(N_iterations)
1391 <<
", lim=" << DynParam.max_deltaM(N_iterations)
1392 <<
", deltaM=" << deltaM
1393 << termcolor::reset << endl;
1396 if (Vout.state.calc_Mmax()+deltaM >= GlobParam.Mlimit) {deltaM = GlobParam.Mlimit-Vout.state.calc_Mmax();}
1397 else if (Vout.state.calc_Mmax() == GlobParam.Mlimit) {deltaM=0ul;}
1398 else if (Vout.state.calc_Mmax() > GlobParam.Mlimit) {assert(
false and
"Exceeded Mlimit.");}
1403 lout << termcolor::blue <<
"performing expansion with " << expand_option << termcolor::reset << endl;
1405 expand_basis2(deltaM, H, Vout, expand_option);
1406 t_exp = ExpansionTimer.time();
1407 N_iterations_without_expansion = 0;
1411 for (
size_t l=0; l<N_sites; ++l)
1413 build_cellEnv(H,Vout);
1416 H.locBasis(l), H.opBasis(l), HeffA[l].qlhs, HeffA[l].qrhs, HeffA[l].factor_cgcs);
1418 Eigenstate<PivotVector<Symmetry,Scalar> > gAC;
1419 Eigenstate<PivotVector<Symmetry,Scalar> > gCR;
1420 Eigenstate<PivotVector<Symmetry,Scalar> > gCL;
1425 Stopwatch<> LanczosTimer;
1427 Lutz(LocParam.REORTHO);
1428 Lutz.set_dimK(min(LocParam.dimK,
dim(gAC.state)));
1429 Lutz.edgeState(HeffA[l], gAC, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1432 lout <<
"l=" << l <<
", AC" <<
", time" << LanczosTimer.info() <<
", " << Lutz.info() << endl;
1436 lout <<
"e0(AC)=" << setprecision(13) << gAC.energy <<
", ratio=" << gAC.energy/Vout.energy << endl;
1443 Lucy(LocParam.REORTHO);
1444 Lucy.set_dimK(min(LocParam.dimK,
dim(gCR.state)));
1445 Lucy.edgeState(
PivotMatrix0(HeffC[l]), gCR, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1447 if (std::real(gCR.state.data[0].block[0](0,0)) < 0.) { gCR.state.data[0] = (-1.) * gCR.state.data[0]; }
1451 lout <<
"l=" << l <<
", CR" <<
", time" << LanczosTimer.info() <<
", " << Lucy.info() << endl;
1455 lout <<
"e0(C)=" << setprecision(13) << gCR.energy <<
", ratio=" << gCR.energy/Vout.energy << endl;
1459 size_t lC = Vout.state.minus1modL(l);
1463 Luca(LocParam.REORTHO);
1464 Luca.set_dimK(min(LocParam.dimK,
dim(gCL.state)));
1465 Luca.edgeState(
PivotMatrix0(HeffC[lC]), gCL, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1467 if (std::real(gCL.state.data[0].block[0](0,0)) < 0.) { gCL.state.data[0] = (-1.) * gCL.state.data[0]; }
1471 lout <<
"l=" << l <<
", CL" <<
", time" << LanczosTimer.info() <<
", " << Luca.info() << endl;
1475 lout <<
"e0(C)=" << setprecision(13) << gCL.energy <<
", ratio=" << gCL.energy/Vout.energy << endl;
1478 Vout.state.A[
GAUGE::C][l] = gAC.state.data;
1479 Vout.state.C[lC] = gCL.state.data[0];
1480 Vout.state.C[l] = gCR.state.data[0];
1482 (err_var>0.01)? Vout.state.svdDecompose(l,
GAUGE::R) : Vout.state.polarDecompose(l,
GAUGE::R);
1483 (err_var>0.01)? Vout.state.svdDecompose(l,
GAUGE::L) : Vout.state.polarDecompose(l,
GAUGE::L);
1491 eL = std::real(
contract_LR(basis_order[0], YLlast, Reigen)) / H.volume();
1492 eR = std::real(
contract_LR(basis_order[dW-1], Leigen, YRfrst)) / H.volume();
1494 Vout.energy = min(eL,eR);
1496 Stopwatch<> ErrorTimer;
1498 if (abs(err_state_old-err_state)/err_state_old > 0.001 or N_iterations_without_expansion<=1 or N_iterations<=6)
1500 calc_errors(H, Vout, GlobParam.CALC_STATE_ERROR);
1501 t_err = ErrorTimer.time();
1504 lout << ErrorTimer.info(
"error calculation") << endl;
1509 if (GlobParam.CALC_STATE_ERROR) {calc_errors(H, Vout,
false);}
1512 lout <<
"State error seems converged and will be not recalculated until the next expansion!" << endl;
1518 lout << Vout.state.test_ortho() << endl;
1519 lout << termcolor::blue <<
"eL=" << eL <<
", eR=" << eR << termcolor::reset << endl;
1520 lout << test_LReigen(Vout) << endl;
1524 ++N_iterations_without_expansion;
1529 size_t standard_precision = cout.precision();
1530 lout << Vout.state.info() << endl;
1531 lout <<
"S=" << Vout.state.entropy().transpose() << endl;
1532 lout << termcolor::bold << eigeninfo() << termcolor::reset << endl;
1533 lout << IterationTimer.info(
"full sequential iteration") << endl;
1538template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1542 Stopwatch<> IterationTimer;
1553 eL = std::real((Leigen.
contract(hR)).trace());
1554 eR = std::real((hL.
contract(Reigen)).trace());
1560 Stopwatch<> GMresTimer;
1566 lout <<
"linear systems" << GMresTimer.info() << endl;
1572 Heff[0].h.resize(boost::extents[D][D][D][D]);
1576 Heff[0].AL = Vout.state.A[
GAUGE::L][0];
1577 Heff[0].AR = Vout.state.A[
GAUGE::R][0];
1578 Heff[0].qloc = Vout.state.locBasis(0);
1580 double tolLanczosEigval, tolLanczosState;
1581 set_LanczosTolerances(tolLanczosEigval,tolLanczosState);
1584 Eigenstate<PivotVector<Symmetry,Scalar> > gAC;
1587 Stopwatch<> LanczosTimer;
1589 Lutz1.set_dimK(min(LocParam.dimK,
dim(gAC.state)));
1590 Lutz1.edgeState(Heff[0],gAC, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1594 lout <<
"time" << LanczosTimer.info() <<
", " << Lutz1.info() << endl;
1598 lout <<
"e0(AC)=" << setprecision(13) << gAC.energy << endl;
1602 Eigenstate<PivotVector<Symmetry,Scalar> > gC;
1606 Lutz0.set_dimK(min(LocParam.dimK,
dim(gC.state)));
1607 Lutz0.edgeState(
PivumpsMatrix0(Heff[0]),gC, LANCZOS::EDGE::GROUND, tolLanczosEigval,tolLanczosState,
false);
1611 lout <<
"time" << LanczosTimer.info() <<
", " << Lutz0.info() << endl;
1615 lout <<
"e0(C)=" << setprecision(13) << gC.energy << endl;
1619 Vout.state.A[
GAUGE::C][0] = gAC.state.data;
1620 Vout.state.C[0] = gC.state.data[0];
1621 (err_var>0.01)? Vout.state.svdDecompose(0) : Vout.state.polarDecompose(0);
1626 Vout.energy = min(eL,eR);
1630 lout << Vout.state.test_ortho() << endl;
1631 lout << termcolor::blue <<
"eL=" << eL <<
", eR=" << eR << termcolor::reset << endl;
1632 lout << test_LReigen(Vout) << endl;
1640 size_t standard_precision = cout.precision();
1641 lout <<
"S=" << Vout.state.entropy().transpose() << endl;
1642 lout << eigeninfo() << endl;
1643 lout << IterationTimer.info(
"full iteration") << endl;
1648template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1652 assert(H.length() == 2);
1653 Stopwatch<> IterationTimer;
1655 vector<Biped<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > > Atmp;
1657 Vout.state.A[
GAUGE::C][0], H.locBasis(1),
1658 Vout.state.Qtop(0), Vout.state.Qbot(0),
1660 for (
size_t s=0; s<Atmp.size(); ++s)
1662 Atmp[s] = Atmp[s].cleaned();
1665 if (HeffA[0].Terms[0].W.size() == 0)
1672 Eigenstate<PivotVector<Symmetry,Scalar> > g;
1677 HeffA[0].qlhs.clear();
1678 HeffA[0].qrhs.clear();
1679 HeffA[0].factor_cgcs.clear();
1681 HeffA[0].Terms[0].qloc, HeffA[0].Terms[0].qOp,
1682 HeffA[0].qlhs, HeffA[0].qrhs, HeffA[0].factor_cgcs);
1685 Stopwatch<> LanczosTimer;
1687 Lutz(LocParam.REORTHO);
1688 Lutz.set_dimK(min(LocParam.dimK,
dim(g.state)));
1692 lout <<
"time" << LanczosTimer.info() <<
", " << Lutz.info() << endl;
1695 auto Cref = Vout.state.C[0];
1714 double truncDump, Sdump;
1717 Vout.state.locBasis(0), Vout.state.A[
GAUGE::L][0],
1718 Vout.state.locBasis(0), Vout.state.A[
GAUGE::R][0],
1719 Vout.state.Qtop(0), Vout.state.Qbot(0),
1720 Vout.state.C[0],
true, truncDump, Sdump,
1721 Vout.state.eps_svd,Vout.state.min_Nsv,Vout.state.max_Nsv);
1722 Vout.state.C[0] = 1./sqrt((Vout.state.C[0].contract(Vout.state.C[0].adjoint())).trace()) * Vout.state.C[0];
1726 for (
size_t s=0; s<H.locBasis(0).size(); ++s)
1728 Vout.state.A[
GAUGE::C][0][s] = Vout.state.A[
GAUGE::L][0][s] *Vout.state.C[0];
1734 Vout.energy = 0.5*g.energy-Eold;
1735 err_eigval = abs(Vout.energy-eL);
1736 err_state = (Cref-Vout.state.C[0]).
norm();
1737 err_var = err_state;
1738 Eold = 0.5*g.energy;
1743 lout << Vout.state.test_ortho() << endl;
1747 contract_L(HeffA[0].Terms[0].L, Vout.state.A[
GAUGE::L][0], H.W[0], Vout.state.A[
GAUGE::L][0], H.locBasis(0), H.opBasis(0), HeffLtmp);
1748 HeffA[0].Terms[0].L = HeffLtmp;
1749 contract_R(HeffA[0].Terms[0].R, Vout.state.A[
GAUGE::R][0], H.W[1], Vout.state.A[
GAUGE::R][0], H.locBasis(1), H.opBasis(1), HeffRtmp);
1750 HeffA[0].Terms[0].R = HeffRtmp;
1754 size_t standard_precision = cout.precision();
1755 lout <<
"S=" << Vout.state.entropy().transpose() << endl;
1756 lout << termcolor::bold << eigeninfo() << termcolor::reset << endl;
1757 lout << IterationTimer.info(
"full iteration") << endl;
1762template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1779 ss <<
"ReigenTest=" << (Reigen-PsiR.
data).
norm() <<
", LeigenTest=" << (Leigen-PsiL.
data).
norm() << endl;
1783template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1789 lout << endl << termcolor::colorize << termcolor::bold
1790 <<
"———————————————————————————————————————————————VUMPS algorithm—————————————————————————————————————————————————————————"
1791 << termcolor::reset << endl;
1794 if (!USER_SET_GLOBPARAM) {GlobParam = H.get_VumpsGlobParam();}
1795 if (!USER_SET_DYNPARAM) {DynParam = H.get_VumpsDynParam();}
1799 prepare_idmrg(H, Vout, Qtot, USE_STATE);
1803 assert(H.length() == 2 and
"Need L=2 for H2SITE!");
1804 for (
size_t i=0; i<GlobParam.max_iterations; i++)
1806 assert(DynParam.iteration(i) ==
UMPS_ALG::H2SITE and
"iteration H2SITE can not be mixed with other iterations");
1808 prepare_h2site(H.H2site(0,
true), H.locBasis(0), Vout, Qtot, GlobParam.Minit, GlobParam.Qinit, USE_STATE);
1818 prepare(H, Vout, Qtot, USE_STATE);
1821 Stopwatch<> GlobalTimer;
1823 while (((err_eigval >= GlobParam.tol_eigval or err_state >= GlobParam.tol_state) and N_iterations < GlobParam.max_iterations) or
1824 N_iterations < GlobParam.min_iterations)
1828 iteration_parallel(H,Vout);
1832 iteration_sequential(H,Vout);
1836 iteration_idmrg(H,Vout);
1840 iteration_h2site(Vout);
1846 iteration_sequential(H,Vout);
1849 DynParam.doSomething(N_iterations);
1852 #ifdef USE_HDF5_STORAGE
1853 if (GlobParam.savePeriod != 0 and N_iterations%GlobParam.savePeriod == 0 and N_iterations>GlobParam.Niter_before_save)
1855 string filename = GlobParam.saveName;
1856 if (GlobParam.FULLMMAX_FILENAME) filename += make_string(
"_fullMmax=",Vout.state.calc_fullMmax());
1857 lout << termcolor::green <<
"saving state to: " << filename << termcolor::reset << endl;
1858 Vout.state.save(filename,H.info());
1873 lout << GlobalTimer.info(
"total runtime") << endl;
1874 size_t standard_precision = cout.precision();
1875 lout << termcolor::bold << setprecision(14)
1876 <<
"iterations=" << N_iterations
1877 <<
", e0=" << Vout.energy
1878 <<
", err_eigval=" << err_eigval
1879 <<
", err_var=" << err_var
1880 <<
", err_state=" << err_state
1881 << setprecision(standard_precision) << termcolor::reset
1883 lout << Vout.state.info() << endl;
1887 if (GlobParam.CALC_S_ON_EXIT)
1889 for (
size_t l=0; l<N_sites; l++)
1891 auto [qs,svs] = Vout.state.entanglementSpectrumLoc(l);
1892 ofstream Filer(make_string(
"sv_final_",l,
".dat"));
1894 for (
size_t i=0; i<svs.size(); i++)
1896 for (
size_t deg=0; deg<Symmetry::degeneracy(qs[i]); deg++)
1898 Filer << index <<
"\t" << qs[i] <<
"\t" << svs[i] << endl;
1907template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1912 const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &Y_LR,
1914 const vector<vector<vector<vector<
Biped<Symmetry,SparseMatrix<Scalar> > > > > > &W,
1918 const Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &LRguess,
1919 Tripod<Symmetry,Matrix<Scalar,Dynamic,Dynamic> > &LRres)
1921 MpoTransferMatrix<Symmetry,Scalar> T(DIR,
A,
A, LReigen, W, qloc, qOp, ab, basis_order_map, basis_order);
1930 lout << termcolor::yellow <<
"dim(bvec)=" <<
dim(bvec) << termcolor::reset << endl;
1933 Gimli.solve_linear(T, bvec, LRres_tmp, 1e-10,
true);
1934 LRres = LRres_tmp.
data;
1938 lout << DIR <<
": " << Gimli.info() << endl;
1942template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1953 T.LReigen = LReigen;
1956 for (
size_t q=0; q<bvec.
data.
dim; ++q)
1958 bvec.
data.
block[q] -= hLRdotLR * Matrix<Scalar,Dynamic,Dynamic>::Identity(bvec.
data.
block[q].rows(),
1968 lout << termcolor::yellow <<
"dim(bvec)=" <<
dim(bvec) << termcolor::reset << endl;
1971 Gimli.solve_linear(T,bvec,LRres_tmp);
1972 LRres = LRres_tmp.
data;
1976 lout << DIR <<
": " << Gimli.info() << endl;
1980template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
1985 if (DeltaM == 0ul) {
return;}
1987 vector<Biped<Symmetry,MatrixType> > NL;
1988 vector<Biped<Symmetry,MatrixType> > NR;
1992 calc_B2(loc, H, Vout.state, option, NAAN, NL, NR);
1996 auto [U,Sigma,Vdag] = NAAN.
truncateSVD(1ul,DeltaM,Vout.state.eps_svd,trunc,
true);
2025 vector<Biped<Symmetry,MatrixType> > P(Vout.state.locBasis(loc).size());
2026 for (
size_t s=0; s<Vout.state.locBasis(loc).size(); ++s)
2030 Vout.state.enrich(loc,
GAUGE::L, P);
2037 H.locBasis(loc), H.opBasis(loc),
2038 HeffA[(loc+1)%N_sites].Terms[0].L);
2042 P.resize(Vout.state.locBasis((loc+1)%N_sites).size());
2043 for (
size_t s=0; s<Vout.state.locBasis((loc+1)%N_sites).size(); ++s)
2045 P[s] = Vdag * NR[s];
2047 Vout.state.enrich(loc,
GAUGE::R, P);
2053 contract_R(HeffA[(loc+1)%N_sites].Terms[0].R,
2054 Vout.state.A[
GAUGE::R][(loc+1)%N_sites], H.W[(loc+1)%N_sites], Vout.state.A[
GAUGE::R][(loc+1)%N_sites],
2055 H.locBasis((loc+1)%N_sites), H.opBasis((loc+1)%N_sites),
2056 HeffA[loc].Terms[0].R);
2059 Vout.state.update_outbase(loc,
GAUGE::L);
2062 Vout.state.updateC(loc);
2066 Vout.state.updateAC((loc+1)%N_sites,
GAUGE::L);
2069 Vout.state.C[loc] = Vout.state.C[loc].sorted();
2070 Vout.state.sort_A(loc,
GAUGE::L,
true);
2071 Vout.state.sort_A((loc+1)%N_sites,
GAUGE::L,
true);
2074template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2078 for (
size_t loc=0; loc<N_sites; loc++)
2080 cout <<
"loc=" << loc << endl;
2081 expand_basis(loc, DeltaM, H, Vout, option);
2085template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2093 PivotMatrix2 H2(HeffA[loc].Terms[0].L, HeffA[(loc+1)%N_sites].Terms[0].R, HeffA[loc].Terms[0].W, HeffA[(loc+1)%N_sites].Terms[0].W,
2094 H.locBasis(loc), H.locBasis((loc+1)%N_sites), H.opBasis(loc), H.opBasis((loc+1)%N_sites));
2096 vector<Biped<Symmetry,MatrixType> > AL;
2097 vector<Biped<Symmetry,MatrixType> > AR;
2114 for (
size_t s=0; s<Psi.
A[
GAUGE::L][loc].size(); ++s)
2116 AL[s] = Psi.
A[
GAUGE::L][loc][s] * Psi.
C[loc];
2122 assert(1!=1 and
"You inserted an invalid value for enum VUMPS::TWOSITEA::OPTION in calc_B2 from VumpsSolver.");
2127 AR, H.locBasis((loc+1)%N_sites),
2129 precalc_blockStructure (HeffA[loc].Terms[0].L, A2C.
data, HeffA[loc].Terms[0].W, HeffA[(loc+1)%N_sites].Terms[0].W, A2C.
data, HeffA[(loc+1)%N_sites].Terms[0].R,
2130 H.locBasis(loc), H.locBasis((loc+1)%N_sites), H.opBasis(loc), H.opBasis((loc+1)%N_sites),
2139 qloc_l.
pullData(H.locBasis(loc)); qloc_r.
pullData(H.locBasis((loc+1)%N_sites));
2140 auto combined_basis = qloc_l.
combine(qloc_r);
2144 0.,Psi.
min_Nsv,std::numeric_limits<size_t>::max());
2156 contract_L(IdL, NL, AL, H.locBasis(loc), TL);
2157 contract_R(IdR, NR, AR, H.locBasis((loc+1)%N_sites), TR);
2161template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2165 vector<Biped<Symmetry,MatrixType> > NL_dump, NR_dump;
2166 calc_B2(loc,H,Psi,option,B2,NL_dump,NR_dump);
2169template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2173 N_sites = V.state.
length();
2174 size_t Lhetero = Ncells * N_sites;
2177 if (HeffA.size() == 0)
2179 lout << termcolor::blue <<
"create_Mps(Ncells,V,H,x0): Environments are empty, recalculating!..." << termcolor::reset << endl;
2181 prepare(H, Vtmp, V.state.Qtarget(),
true);
2184 CHOSEN_VERBOSITY = VERB_BACKUP;
2188 HeffA[0].Terms[0].L, HeffA[(Lhetero-1)%N_sites].Terms[0].R, x0);
2197template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2202 N_sites = V.state.
length();
2203 size_t Lhetero = Ncells * N_sites;
2204 assert(O.
length()%N_sites == 0 and
"Please choose a heterogeneous region that is commensurate with the unit cell!");
2209 vector<vector<Biped<Symmetry,MatrixType> > > ALxO = V.state.A[
GAUGE::L];
2210 vector<vector<Biped<Symmetry,MatrixType> > > ARxO = V.state.A[
GAUGE::R];
2211 vector<vector<Biped<Symmetry,MatrixType> > > ACxO = V.state.A[
GAUGE::C];
2232 for (
size_t l=0; l<N_sites; ++l)
2280 vector<vector<Biped<Symmetry,MatrixType> > > As(N_sites);
2281 for (
size_t l=0; l<N_sites; ++l) As[l] = ACxO[l];
2283 auto Qt = Symmetry::reduceSilent(V.state.Qtarget(), O.
Qtarget());
2286 Maux.
min_Nsv = V.state.min_Nsv;
2288 auto Cshift = V.state.C[N_sites-1];
2292 Cshift = 1./sqrt((Cshift.contract(Cshift.adjoint())).trace()) * Cshift;
2306 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2307 #pragma omp parallel sections
2310 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2314 build_L(ALxO, V.state.C[N_sites-1], H.W, H.locBasis(), H.opBasis(), L_with_O);
2316 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2320 build_R(ARxO, Cshift, H.W, H.locBasis(), H.opBasis(), R_with_O);
2326 vector<Mps<Symmetry,Scalar>> Mres(Omult.size());
2327 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2328 #pragma omp parallel for
2330 for (
size_t l=0; l<Omult.size(); ++l)
2333 OxV_exact(Omult[l], Mtmp, Mres[l], tol_OxV, VERB);
2338template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2343 size_t Lhetero = Ncells * N_sites;
2344 assert(O.
length()%N_sites == 0 and
"Please choose a heterogeneous region that is commensurate with the unit cell!");
2349 vector<vector<Biped<Symmetry,MatrixType> > > ALxO = V.state.A[
GAUGE::L];
2350 vector<vector<Biped<Symmetry,MatrixType> > > ARxO = V.state.A[
GAUGE::R];
2351 vector<vector<Biped<Symmetry,MatrixType> > > ACxO = V.state.A[
GAUGE::C];
2353 for (
size_t l=0; l<N_sites; ++l)
2382 vector<vector<Biped<Symmetry,MatrixType> > > As(N_sites);
2383 for (
size_t l=0; l<N_sites; ++l) As[l] = ACxO[l];
2385 auto Qt = Symmetry::reduceSilent(V.state.Qtarget(), O.
Qtarget());
2388 Maux.
min_Nsv = V.state.min_Nsv;
2390 auto Cshift = V.state.C[N_sites-1];
2393 Cshift = 1./sqrt((Cshift.contract(Cshift.adjoint())).trace()) * Cshift;
2395 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2396 #pragma omp parallel sections
2399 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2403 build_L(ALxO, V.state.C[N_sites-1], H.W, H.locBasis(), H.qOp, L_with_O);
2405 #ifndef VUMPS_SOLVER_DONT_USE_OPENMP
2409 build_R(ARxO, Cshift, H.W, H.locBasis(), H.qOp, R_with_O);
2417 OxV_exact(Omult, Mtmp, Mres, tol_OxV, VERB);
2421template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2432 size_t Lhetero = Ncells * AL.size();
2434 vector<vector<Biped<Symmetry,MatrixType>>> As(Lhetero);
2436 for (
size_t l=0; l<x0; ++l)
2441 for (
size_t l=x0+1; l<Lhetero; ++l)
2452 vector<vector<qarray<Symmetry::Nq>>> qloc(Lhetero);
2453 for (
size_t l=0; l<Lhetero; ++l)
2455 qloc[l] = qloc_input[l%N_sites];
2470template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2489 Vout.
Boundaries.R = HeffA[N_sites-1].Terms[0].R;
2517template<
typename Symmetry,
typename MpHamiltonian,
typename Scalar>
2521 if (DeltaM == 0) {
return;}
2522 auto state_ref = Vout.state;
2524 for(
size_t loc=0; loc<N_sites; loc++)
2526 vector<Biped<Symmetry,MatrixType> > NL;
2527 vector<Biped<Symmetry,MatrixType> > NR;
2530 calc_B2(loc, H, state_ref, option, NAAN, NL, NR);
2534 lout <<
"l=" << loc <<
", norm(NAAN)=" << sqrt(NAAN.
squaredNorm().sum()) << endl;
2539 auto [U,Sigma,Vdag] = NAAN.
truncateSVD(1ul,DeltaM,state_ref.eps_svd,trunc,
false);
2543 vector<Biped<Symmetry,MatrixType> > P(Vout.state.locBasis(loc).size());
2544 for (
size_t s=0; s<Vout.state.locBasis(loc).size(); ++s)
2554 Vout.state.enrich(loc,
GAUGE::L, P);
2570 P.resize(Vout.state.locBasis((loc+1)%N_sites).size());
2571 for (
size_t s=0; s<Vout.state.locBasis((loc+1)%N_sites).size(); ++s)
2573 P[s] = Vdag * NR[s];
2581 Vout.state.enrich(loc,
GAUGE::R, P);
2597 Vout.state.update_outbase(loc,
GAUGE::L);
2600 Vout.state.updateC(loc);
2604 Vout.state.sort_A((loc+1)%N_sites,
GAUGE::R);
2605 Vout.state.C[loc] = Vout.state.C[loc].sorted();
2609 for (
size_t loc=0; loc<N_sites; loc++)
2612 Vout.state.sort_A(loc,
GAUGE::L,
true);
2613 Vout.state.C[loc] = Vout.state.C[loc].sorted();
2615 Vout.state.update_inbase();
2616 Vout.state.update_outbase();
void contract_AA(const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &A1, const vector< qarray< Symmetry::Nq > > &qloc1, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &A2, const vector< qarray< Symmetry::Nq > > &qloc2, const qarray< Symmetry::Nq > &Qtop, const qarray< Symmetry::Nq > &Qbot, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Apair, bool DRY=false)
void contract_AW(const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Ain, const vector< qarray< Symmetry::Nq > > &qloc, const vector< vector< vector< Biped< Symmetry, MpoMatrixType > > > > &W, const vector< qarray< Symmetry::Nq > > &qOp, const Qbasis< Symmetry > &qauxAl, const Qbasis< Symmetry > &qauxWl, const Qbasis< Symmetry > &qauxAr, const Qbasis< Symmetry > &qauxWr, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Aout, bool FORCE_QTOT=false, qarray< Symmetry::Nq > Qtot=Symmetry::qvacuum())
void split_AA2(DMRG::DIRECTION::OPTION DIR, const Qbasis< Symmetry > &locBasis, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Apair, const vector< qarray< Symmetry::Nq > > &qloc_l, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Al, const vector< qarray< Symmetry::Nq > > &qloc_r, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Ar, const qarray< Symmetry::Nq > &qtop, const qarray< Symmetry::Nq > &qbot, double eps_svd, size_t min_Nsv, size_t max_Nsv)
void split_AA(DMRG::DIRECTION::OPTION DIR, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Apair, const vector< qarray< Symmetry::Nq > > &qloc_l, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Al, const vector< qarray< Symmetry::Nq > > &qloc_r, vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &Ar, const qarray< Symmetry::Nq > &qtop, const qarray< Symmetry::Nq > &qbot, double eps_svd, size_t min_Nsv, size_t max_Nsv)
void precalc_blockStructure(const Tripod< Symmetry, Eigen::Matrix< Scalar, Dynamic, Dynamic > > &L, const vector< Biped< Symmetry, Eigen::Matrix< Scalar, Dynamic, Dynamic > > > &Abra, const vector< vector< vector< Biped< Symmetry, MpoMatrixType > > > > &W, const vector< Biped< Symmetry, Eigen::Matrix< Scalar, Dynamic, Dynamic > > > &Aket, const Tripod< Symmetry, Eigen::Matrix< Scalar, Dynamic, Dynamic > > &R, const vector< qarray< Symmetry::Nq > > &qloc, const vector< qarray< Symmetry::Nq > > &qOp, vector< std::array< size_t, 2 > > &qlhs, vector< vector< std::array< size_t, 6 > > > &qrhs, vector< vector< Scalar > > &factor_cgcs)
Hamiltonian sum(const Hamiltonian &H1, const Hamiltonian &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
void OxV_exact(const Mpo< Symmetry, MpoScalar > &O, const Mps< Symmetry, Scalar > &Vin, Mps< Symmetry, Scalar > &Vout, double tol_compr=1e-7, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::HALFSWEEPWISE, int max_halfsweeps=200, int min_halfsweeps=1, int Minit=-1, DMRG::BROOM::OPTION BROOMOPTION=DMRG::BROOM::QR)
void HxV(const Mpo< Symmetry, MpoScalar > &H, const Mps< Symmetry, Scalar > &Vin, Mps< Symmetry, Scalar > &Vout, bool VERBOSE=true, double tol_compr=1e-4, int Mincr=100, int Mlimit=10000, int max_halfsweeps=100)
double norm(const PivotMatrix0< Symmetry, Scalar, MpoScalar > &H)
size_t dim(const PivotMatrix0< Symmetry, Scalar, MpoScalar > &H)
Tripod< Symmetry, MatrixType > make_YL(size_t b, const Tripod< Symmetry, MatrixType > &Lold, const vector< vector< Biped< Symmetry, MatrixType > > > &Abra, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< MpoScalar > > > > > > &W, const vector< vector< Biped< Symmetry, MatrixType > > > &Aket, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, const std::unordered_map< pair< qarray< Symmetry::Nq >, size_t >, size_t > &basis_order_map)
Tripod< Symmetry, MatrixType > make_YR(size_t a, const Tripod< Symmetry, MatrixType > &Rold, const vector< vector< Biped< Symmetry, MatrixType > > > &Abra, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< MpoScalar > > > > > > &W, const vector< vector< Biped< Symmetry, MatrixType > > > &Aket, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, const std::unordered_map< pair< qarray< Symmetry::Nq >, size_t >, size_t > &basis_order_map)
Biped< Symmetry, MatrixType > make_hR(const boost::multi_array< MpoScalar, 4 > &H2site, const vector< Biped< Symmetry, MatrixType > > &AR, const vector< qarray< Symmetry::Nq > > &qloc)
Biped< Symmetry, MatrixType > make_hL(const boost::multi_array< MpoScalar, 4 > &H2site, const vector< Biped< Symmetry, MatrixType > > &AL, const vector< qarray< Symmetry::Nq > > &qloc)
**Calculates the tensor (eq. (12)) from the explicit 4-legged 2-site Hamiltonian and ....
#define LINEARSOLVER_DIMK
void set_pivot(int pivot_input)
const Qbasis< Symmetry > & outBasis(const std::size_t loc) const
const std::vector< std::vector< std::vector< Biped< Symmetry, MatrixType > > > > & W_at(const std::size_t loc) const
const Qbasis< Symmetry > & inBasis(const std::size_t loc) const
const std::vector< std::vector< qType > > & opBasis() const
const qType & Qtarget() const
std::size_t length() const
void set_Qmultitarget(const vector< qarray< Nq > > &Qmulti_input)
void rightSplitStep(size_t loc, Biped< Symmetry, MatrixType > &C)
MpsBoundaries< Symmetry, Scalar > Boundaries
void update_inbase(size_t loc)
void update_outbase(size_t loc)
Qbasis< Symmetry > combine(const Qbasis< Symmetry > &other, bool FLIP=false) const
void pullData(const vector< Biped< Symmetry, MatrixType > > &A, const Eigen::Index &leg)
qarray< Symmetry::Nq > Qtop(size_t loc) const
qarray< Symmetry::Nq > Qbot(size_t loc) const
vector< vector< qarray< Symmetry::Nq > > > qloc
void calc_N(DMRG::DIRECTION::OPTION DIR, size_t loc, vector< Biped< Symmetry, MatrixType > > &N) const
qarray< Nq > Qtarget() const
std::array< vector< vector< Biped< Symmetry, MatrixType > > >, 3 > A
vector< Biped< Symmetry, MatrixType > > C
Matrix< Scalar, Dynamic, Dynamic > MatrixType
VUMPS::CONTROL::LOC LocParam
Matrix< Scalar, Dynamic, 1 > VectorType
double get_err_state() const
void set_boundary(const Umps< Symmetry, Scalar > &Vin, Mps< Symmetry, Scalar > &Vout, bool LEFT=false, bool RIGHT=true)
DMRG::VERBOSITY::OPTION get_verbosity()
Mps< Symmetry, Scalar > create_Mps(size_t Ncells, const Eigenstate< Umps< Symmetry, Scalar > > &V, const MpHamiltonian &H, size_t x0)
string test_LReigen(const Eigenstate< Umps< Symmetry, Scalar > > &Vout) const
vector< qarray< Symmetry::Nq > > qloc
std::unordered_map< pair< qarray< Symmetry::Nq >, size_t >, size_t > basis_order_map
size_t N_iterations_without_expansion
void expand_basis2(size_t DeltaD, const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout, VUMPS::TWOSITE_A::OPTION option=VUMPS::TWOSITE_A::ALxAC)
void edgeState(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout, qarray< Symmetry::Nq > Qtot, LANCZOS::EDGE::OPTION EDGE=LANCZOS::EDGE::GROUND, bool USE_STATE=false)
void set_LanczosTolerances(double &tolLanczosEigval, double &tolLanczosState)
void calc_B2(size_t loc, const MpHamiltonian &H, const Umps< Symmetry, Scalar > &Psi, VUMPS::TWOSITE_A::OPTION option, Biped< Symmetry, MatrixType > &B2, vector< Biped< Symmetry, MatrixType > > &NL, vector< Biped< Symmetry, MatrixType > > &NR) const
double memory(MEMUNIT memunit=GB) const
vector< double > err_state_mem
void prepare_h2site(const TwoSiteHamiltonian &h2site, const vector< qarray< Symmetry::Nq > > &qloc_input, Eigenstate< Umps< Symmetry, Scalar > > &Vout, qarray< Symmetry::Nq > Qtot_input, size_t M, size_t Nqmax, bool USE_STATE=false)
VUMPS::CONTROL::DYN DynParam
void set_log(int N_log_input, string file_e_input, string file_err_eigval_input, string file_err_var_input, string file_err_state_input)
DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY
VumpsSolver(DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
void iteration_sequential(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout)
VUMPS::CONTROL::GLOB GlobParam
void iteration_h2site(Eigenstate< Umps< Symmetry, Scalar > > &Vout)
void build_cellEnv(const MpHamiltonian &H, const Eigenstate< Umps< Symmetry, Scalar > > &Vout, size_t power=1)
void iteration_idmrg(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout)
void calc_errors(const MpHamiltonian &H, const Eigenstate< Umps< Symmetry, Scalar > > &Vout, bool CALC_ERR_STATE=true, VUMPS::TWOSITE_A::OPTION option=VUMPS::TWOSITE_A::ALxAC)
TwoSiteHamiltonian h2site
vector< PivumpsMatrix1< Symmetry, Scalar, Scalar > > Heff
double get_err_eigval() const
Tripod< Symmetry, MatrixType > YLlast
void build_R(const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &AR, const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &Cintercell, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< Scalar > > > > > > &W, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, Tripod< Symmetry, MatrixType > &R)
const double & errState()
void iteration_parallel(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout)
Tripod< Symmetry, MatrixType > YRfrst
void build_L(const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &AL, const Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &Cintercell, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< Scalar > > > > > > &W, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, Tripod< Symmetry, MatrixType > &L)
void build_LR(const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &AL, const vector< vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > > &AR, const vector< Biped< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > > &C, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< Scalar > > > > > > &W, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, Tripod< Symmetry, MatrixType > &L, Tripod< Symmetry, MatrixType > &R)
vector< PivotMatrix1< Symmetry, Scalar, Scalar > > HeffC
vector< pair< qarray< Symmetry::Nq >, size_t > > basis_order
const double & errEigval()
vector< PivotMatrix1< Symmetry, Scalar, Scalar > > HeffA
vector< double > err_var_mem
Mps< Symmetry, Scalar > assemble_Mps(size_t Ncells, const Umps< Symmetry, Scalar > &V, const vector< vector< Biped< Symmetry, MatrixType > > > &AL, const vector< vector< Biped< Symmetry, MatrixType > > > &AR, const vector< vector< qarray< Symmetry::Nq > > > &qloc_input, const Tripod< Symmetry, MatrixType > &L, const Tripod< Symmetry, MatrixType > &R, int x0)
boost::multi_array< Scalar, 4 > TwoSiteHamiltonian
void prepare_idmrg(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout, qarray< Symmetry::Nq > Qtot, bool USE_STATE=false)
void expand_basis(size_t loc, size_t DeltaD, const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout, VUMPS::TWOSITE_A::OPTION option=VUMPS::TWOSITE_A::ALxAC)
void cleanup(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout)
double get_err_var() const
void write_log(bool FORCE=false)
void solve_linear(VMPS::DIRECTION::OPTION gauge, size_t ab, const vector< vector< Biped< Symmetry, MatrixType > > > &A, const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &Y_LR, const Biped< Symmetry, MatrixType > &LReigen, const vector< vector< vector< vector< Biped< Symmetry, SparseMatrix< Scalar > > > > > > &W, const vector< vector< qarray< Symmetry::Nq > > > &qloc, const vector< vector< qarray< Symmetry::Nq > > > &qOp, Scalar LRdotY, const Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &LRguess, Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > &LRres)
vector< double > err_eigval_mem
void set_verbosity(DMRG::VERBOSITY::OPTION VERBOSITY)
Matrix< complex< Scalar >, Dynamic, Dynamic > ComplexMatrixType
void prepare(const MpHamiltonian &H, Eigenstate< Umps< Symmetry, Scalar > > &Vout, qarray< Symmetry::Nq > Qtot, bool USE_STATE=false)
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)
std::array< qarray< Nq >, 3 > qarray3
Biped< Symmetry, MatrixType_ > adjoint() const
std::vector< MatrixType_ > block
Biped< Symmetry, MatrixType_ > contract(const Biped< Symmetry, MatrixType_ > &A, const contract::MODE MODE=contract::MODE::UNITY) const
tuple< Biped< Symmetry, MatrixType_ >, Biped< Symmetry, MatrixType_ >, Biped< Symmetry, MatrixType_ > > truncateSVD(size_t minKeep, size_t maxKeep, EpsScalar eps_svd, double &truncWeight, double &entropy, map< qarray< Symmetry::Nq >, Eigen::ArrayXd > &SVspec, bool PRESERVE_MULTIPLETS=true, bool RETURN_SPEC=true) const
Eigen::VectorXd squaredNorm() const
void setIdentity(const Qbasis< Symmetry > &base1, const Qbasis< Symmetry > &base2, qType Q=Symmetry::qvacuum())
static constexpr double tol_eigval_Lanczos
static constexpr double tol_state_Lanczos
Tripod< Symmetry, Matrix< Scalar, Dynamic, Dynamic > > data
void insert(std::pair< qType, size_t > ab, const Multipede< Nlegs, Symmetry, MatrixType > &Trhs)
void setIdentity(size_t Drows, size_t Dcols, size_t amax=1, size_t bmax=1)
vector< vector< std::array< size_t, 12 > > > qrhs
vector< std::array< size_t, 2 > > qlhs
vector< vector< Scalar > > factor_cgcs
vector< Biped< Symmetry, Matrix< Scalar_, Dynamic, Dynamic > > > data
Biped< Symmetry, Matrix< Scalar_, Dynamic, Dynamic > > data