VMPS++
|
External functions to manipulate Mps and Mpo objects.
Definition in file DmrgLinearAlgebra.h.
#include "Stopwatch.h"
#include "Mps.h"
#include "Mpo.h"
#include "solvers/MpsCompressor.h"
#include "ParamHandler.h"
Go to the source code of this file.
Macros | |
#define | OXV_EXACT_INIT_M 100 |
Functions | |
template<typename Symmetry , typename Scalar > | |
Scalar | dot (const Mps< Symmetry, Scalar > &Vbra, const Mps< Symmetry, Scalar > &Vket) |
template<typename Symmetry , typename Scalar > | |
Scalar | dot_hetero (const Mps< Symmetry, Scalar > &Vbra, const Mps< Symmetry, Scalar > &Vket, int Ncellshift=0) |
template<typename Symmetry , typename Scalar > | |
void | swap (Mps< Symmetry, Scalar > &V1, Mps< Symmetry, Scalar > &V2) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Array< Scalar, Dynamic, 1 > | matrix_element (int iL, int iR, const Mps< Symmetry, Scalar > &Vbra, const Mpo< Symmetry, MpoScalar > &O, const Mps< Symmetry, Scalar > &Vket, size_t power_of_O=1) |
template<typename Symmetry , typename Scalar > | |
Array< Scalar, Dynamic, 1 > | dot_green (const Mps< Symmetry, Scalar > &V1, const Mps< Symmetry, Scalar > &V2) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Scalar | avg (const Mps< Symmetry, Scalar > &Vbra, const Mpo< Symmetry, MpoScalar > &O, const Mps< Symmetry, Scalar > &Vket, size_t power_of_O=1ul, DMRG::DIRECTION::OPTION DIR=DMRG::DIRECTION::RIGHT, DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Scalar | avg_hetero (const Mps< Symmetry, Scalar > &Vbra, const Mpo< Symmetry, MpoScalar > &O, const Mps< Symmetry, Scalar > &Vket, bool USE_BOUNDARY=false, size_t usePower=1ul, const qarray< Symmetry::Nq > &Qmid=Symmetry::qvacuum()) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Scalar | avg (const Mps< Symmetry, Scalar > &Vbra, const Mpo< Symmetry, MpoScalar > &O1, const Mpo< Symmetry, MpoScalar > &O2, const Mps< Symmetry, Scalar > &Vket, typename Symmetry::qType Qtarget=Symmetry::qvacuum(), size_t usePower1=1, size_t usePower2=1, bool WARN=true, DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Scalar | avg (const Mps< Symmetry, Scalar > &Vbra, const vector< Mpo< Symmetry, MpoScalar > > &O, const Mps< Symmetry, Scalar > &Vket, size_t usePower=1ul, DMRG::DIRECTION::OPTION DIR=DMRG::DIRECTION::LEFT, DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
Scalar | avg (const Mps< Symmetry, Scalar > &Vbra, const vector< Mpo< Symmetry, MpoScalar > > &O1, const vector< Mpo< Symmetry, MpoScalar > > &O2, const Mps< Symmetry, Scalar > &Vket, typename Symmetry::qType Qtarget=Symmetry::qvacuum(), size_t usePower1=1ul, size_t usePower2=1ul, bool WARN=true, DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
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) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
void | HxV (const Mpo< Symmetry, MpoScalar > &H, Mps< Symmetry, Scalar > &Vinout, bool VERBOSE=true, double tol_compr=1e-4, int Mincr=100, int Mlimit=10000, int max_halfsweeps=100) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
void | polyIter (const Mpo< Symmetry, MpoScalar > &H, const Mps< Symmetry, Scalar > &Vin1, double polyB, const Mps< Symmetry, Scalar > &Vin2, Mps< Symmetry, Scalar > &Vout, bool VERBOSE=true) |
template<typename Symmetry , typename Scalar , typename OtherScalar > | |
void | addScale (const OtherScalar alpha, const Mps< Symmetry, Scalar > &Vin, Mps< Symmetry, Scalar > &Vout, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
void | OxV (const Mpo< Symmetry, MpoScalar > &H, const Mpo< Symmetry, MpoScalar > &Hdag, 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, int min_halfsweeps=1, bool MEASURE_DISTANCE=true) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
void | OxV (const Mpo< Symmetry, MpoScalar > &H, const Mpo< Symmetry, MpoScalar > &Hdag, Mps< Symmetry, Scalar > &Vinout, bool VERBOSE=true, double tol_compr=1e-4, int Mincr=100, int Mlimit=10000, int max_halfsweeps=100, int min_halfsweeps=1, bool MEASURE_DISTANCE=true) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
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) |
template<typename Symmetry , typename MpoScalar , typename Scalar > | |
void | OxV_exact (const Mpo< Symmetry, MpoScalar > &O, Mps< Symmetry, Scalar > &Vinout, 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) |
template<typename Hamiltonian , typename Scalar > | |
Hamiltonian | sum (const Hamiltonian &H1, const Hamiltonian &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Hamiltonian , typename Scalar > | |
Hamiltonian | prod (const Hamiltonian &H1, const Hamiltonian &H2, const qarray< Hamiltonian::Symmetry::Nq > &Qtot=Hamiltonian::Symmetry::qvacuum(), DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename Scalar = double> | |
Mpo< Symmetry, Scalar > | sum (const Mpo< Symmetry, Scalar > &H1, const Mpo< Symmetry, Scalar > &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename Scalar = double> | |
Mpo< Symmetry, Scalar > | diff (const Mpo< Symmetry, Scalar > &H1, const Mpo< Symmetry, Scalar > &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename Scalar = double> | |
Mpo< Symmetry, Scalar > | prod (const Mpo< Symmetry, Scalar > &H1, const Mpo< Symmetry, Scalar > &H2, const qarray< Symmetry::Nq > &Qtot=Symmetry::qvacuum(), DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT) |
template<typename Symmetry , typename MpsScalar = double, typename MpoScalar = double> | |
void | OvecxV (const std::vector< Mpo< Symmetry, MpoScalar > > &Os, Mps< Symmetry, MpsScalar > &v_in, std::size_t Minit_in=0ul, std::size_t Mincr=100ul, std::size_t Mlimit=10000ul, double tol_compr=1e-5, std::size_t max_halfsweeps=24ul, std::size_t min_halfsweeps=1ul) |
#define OXV_EXACT_INIT_M 100 |
Definition at line 5 of file DmrgLinearAlgebra.h.
void addScale | ( | const OtherScalar | alpha, |
const Mps< Symmetry, Scalar > & | Vin, | ||
Mps< Symmetry, Scalar > & | Vout, | ||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 570 of file DmrgLinearAlgebra.h.
Scalar avg | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const Mpo< Symmetry, MpoScalar > & | O, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
size_t | power_of_O = 1ul , |
||
DMRG::DIRECTION::OPTION | DIR = DMRG::DIRECTION::RIGHT , |
||
DMRG::VERBOSITY::OPTION | CHOSEN_VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Calculates the expectation value
Vbra | : input |
O | : input Mpo |
Vket | : input |
USE_SQUARE | : If true , uses the square of O stored in O itself. Call Mpo::check_SQUARE() first to see whether it was calculated. |
DIR | : whether to contract going left or right (should obviously make no difference, useful for testing purposes) |
Definition at line 149 of file DmrgLinearAlgebra.h.
Scalar avg | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const Mpo< Symmetry, MpoScalar > & | O1, | ||
const Mpo< Symmetry, MpoScalar > & | O2, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
typename Symmetry::qType | Qtarget = Symmetry::qvacuum() , |
||
size_t | usePower1 = 1 , |
||
size_t | usePower2 = 1 , |
||
bool | WARN = true , |
||
DMRG::VERBOSITY::OPTION | CHOSEN_VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Calculates the expectation value Only a left-to-right contraction is implemented.
Vbra | : input |
O1 | : input Mpo |
O2 | : input Mpo |
Vket | : input |
Qtarget | : The quantum number of the product of . For abelian symmetries simply O1.Qtarget()+O2.Qtarget() |
Definition at line 365 of file DmrgLinearAlgebra.h.
Scalar avg | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const vector< Mpo< Symmetry, MpoScalar > > & | O, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
size_t | usePower = 1ul , |
||
DMRG::DIRECTION::OPTION | DIR = DMRG::DIRECTION::LEFT , |
||
DMRG::VERBOSITY::OPTION | CHOSEN_VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 457 of file DmrgLinearAlgebra.h.
Scalar avg | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const vector< Mpo< Symmetry, MpoScalar > > & | O1, | ||
const vector< Mpo< Symmetry, MpoScalar > > & | O2, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
typename Symmetry::qType | Qtarget = Symmetry::qvacuum() , |
||
size_t | usePower1 = 1ul , |
||
size_t | usePower2 = 1ul , |
||
bool | WARN = true , |
||
DMRG::VERBOSITY::OPTION | CHOSEN_VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 473 of file DmrgLinearAlgebra.h.
Scalar avg_hetero | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const Mpo< Symmetry, MpoScalar > & | O, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
bool | USE_BOUNDARY = false , |
||
size_t | usePower = 1ul , |
||
const qarray< Symmetry::Nq > & | Qmid = Symmetry::qvacuum() |
||
) |
Definition at line 287 of file DmrgLinearAlgebra.h.
Mpo< Symmetry, Scalar > diff | ( | const Mpo< Symmetry, Scalar > & | H1, |
const Mpo< Symmetry, Scalar > & | H2, | ||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 914 of file DmrgLinearAlgebra.h.
Scalar dot | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const Mps< Symmetry, Scalar > & | Vket | ||
) |
Calculates the scalar product .
Vbra | : input |
Vket | : input |
Definition at line 24 of file DmrgLinearAlgebra.h.
Array< Scalar, Dynamic, 1 > dot_green | ( | const Mps< Symmetry, Scalar > & | V1, |
const Mps< Symmetry, Scalar > & | V2 | ||
) |
Definition at line 121 of file DmrgLinearAlgebra.h.
Scalar dot_hetero | ( | const Mps< Symmetry, Scalar > & | Vbra, |
const Mps< Symmetry, Scalar > & | Vket, | ||
int | Ncellshift = 0 |
||
) |
Calculates the scalar product for a heterogenic MPS.
Vbra | : input |
Vket | : input |
Ncellshift | : Shift Vbra by this many unit cells (negative=left-shift, positive=right-shift). |
Definition at line 36 of file DmrgLinearAlgebra.h.
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 |
||
) |
Apply an Mpo to an Mps by using the zip-up algorithm (Stoudenmire, White 2010).
H | : input Hamiltonian |
Vin | : input |
Vout | : output |
VERBOSE | : print info if true |
Definition at line 500 of file DmrgLinearAlgebra.h.
void HxV | ( | const Mpo< Symmetry, MpoScalar > & | H, |
Mps< Symmetry, Scalar > & | Vinout, | ||
bool | VERBOSE = true , |
||
double | tol_compr = 1e-4 , |
||
int | Mincr = 100 , |
||
int | Mlimit = 10000 , |
||
int | max_halfsweeps = 100 |
||
) |
Definition at line 531 of file DmrgLinearAlgebra.h.
Array< Scalar, Dynamic, 1 > matrix_element | ( | int | iL, |
int | iR, | ||
const Mps< Symmetry, Scalar > & | Vbra, | ||
const Mpo< Symmetry, MpoScalar > & | O, | ||
const Mps< Symmetry, Scalar > & | Vket, | ||
size_t | power_of_O = 1 |
||
) |
Definition at line 71 of file DmrgLinearAlgebra.h.
void OvecxV | ( | const std::vector< Mpo< Symmetry, MpoScalar > > & | Os, |
Mps< Symmetry, MpsScalar > & | v_in, | ||
std::size_t | Minit_in = 0ul , |
||
std::size_t | Mincr = 100ul , |
||
std::size_t | Mlimit = 10000ul , |
||
double | tol_compr = 1e-5 , |
||
std::size_t | max_halfsweeps = 24ul , |
||
std::size_t | min_halfsweeps = 1ul |
||
) |
Definition at line 954 of file DmrgLinearAlgebra.h.
void OxV | ( | const Mpo< Symmetry, MpoScalar > & | H, |
const Mpo< Symmetry, MpoScalar > & | Hdag, | ||
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 , |
||
int | min_halfsweeps = 1 , |
||
bool | MEASURE_DISTANCE = true |
||
) |
Definition at line 593 of file DmrgLinearAlgebra.h.
void OxV | ( | const Mpo< Symmetry, MpoScalar > & | H, |
const Mpo< Symmetry, MpoScalar > & | Hdag, | ||
Mps< Symmetry, Scalar > & | Vinout, | ||
bool | VERBOSE = true , |
||
double | tol_compr = 1e-4 , |
||
int | Mincr = 100 , |
||
int | Mlimit = 10000 , |
||
int | max_halfsweeps = 100 , |
||
int | min_halfsweeps = 1 , |
||
bool | MEASURE_DISTANCE = true |
||
) |
Definition at line 622 of file DmrgLinearAlgebra.h.
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 |
||
) |
Performs an exact MPO-MPS product.
O | : input MPO |
Vin | : input MPS |
Vout | : output MPS |
tol_compr | : if , compresses the result with this tolerance |
VERBOSITY | : verbosity level, which is also passed on to the MpsCompressor class |
Definition at line 722 of file DmrgLinearAlgebra.h.
void OxV_exact | ( | const Mpo< Symmetry, MpoScalar > & | O, |
Mps< Symmetry, Scalar > & | Vinout, | ||
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 |
||
) |
Definition at line 855 of file DmrgLinearAlgebra.h.
void polyIter | ( | const Mpo< Symmetry, MpoScalar > & | H, |
const Mps< Symmetry, Scalar > & | Vin1, | ||
double | polyB, | ||
const Mps< Symmetry, Scalar > & | Vin2, | ||
Mps< Symmetry, Scalar > & | Vout, | ||
bool | VERBOSE = true |
||
) |
Performs an orthogonal polynomial iteration step as needed in the polynomial recursion relation .
C_n
and A_n
already. H | : input Hamiltonian |
Vin1 | : input Mps |
polyB | : the coefficient before the subtracted vector |
Vin2 | : input Mps |
Vout | : output Mps |
VERBOSE | : print info if true |
Definition at line 550 of file DmrgLinearAlgebra.h.
Hamiltonian prod | ( | const Hamiltonian & | H1, |
const Hamiltonian & | H2, | ||
const qarray< Hamiltonian::Symmetry::Nq > & | Qtot = Hamiltonian::Symmetry::qvacuum() , |
||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 880 of file DmrgLinearAlgebra.h.
Mpo< Symmetry, Scalar > prod | ( | const Mpo< Symmetry, Scalar > & | H1, |
const Mpo< Symmetry, Scalar > & | H2, | ||
const qarray< Symmetry::Nq > & | Qtot = Symmetry::qvacuum() , |
||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 942 of file DmrgLinearAlgebra.h.
Hamiltonian sum | ( | const Hamiltonian & | H1, |
const Hamiltonian & | H2, | ||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 866 of file DmrgLinearAlgebra.h.
Mpo< Symmetry, Scalar > sum | ( | const Mpo< Symmetry, Scalar > & | H1, |
const Mpo< Symmetry, Scalar > & | H2, | ||
DMRG::VERBOSITY::OPTION | VERBOSITY = DMRG::VERBOSITY::SILENT |
||
) |
Definition at line 894 of file DmrgLinearAlgebra.h.
void swap | ( | Mps< Symmetry, Scalar > & | V1, |
Mps< Symmetry, Scalar > & | V2 | ||
) |
Swaps two Mps.
Definition at line 65 of file DmrgLinearAlgebra.h.