The namespace containing all MPS-related tools, classes and objects. More...
Namespaces | |
namespace | BasisTransformation |
Namespace for all basis transformation related things. | |
namespace | DMRG |
MP-DMRG specific data structures and classes. | |
namespace | Lat |
Contains all lattice generators. | |
namespace | OperatorApplicators |
OperatorApplicator structs for TDVP and DMRG. | |
namespace | ParseOperator |
Support classes and functions related to matrix product operator parsing. | |
namespace | RandomState |
Generators for random states. | |
namespace | RDMs |
A namespace containing reduced density matrices. | |
namespace | Snapshots |
A namespace containing methods for taking snapshot. | |
namespace | SymConv |
Namespace containing all symmetry related casts. | |
namespace | TDVP |
TDVP Implementation. | |
namespace | TEBD |
TEBD implementation, primarily by Felix. | |
Classes | |
class | Lattice |
Stores a physical lattice and associated operators and bases. More... | |
class | LBOState |
Matrix-product state with local basis optimisation (see Florian Dorfner's thesis). More... | |
class | Operator |
Matrix Product Operator. More... | |
class | QcLatticeGenerator |
class | SState |
The "smart" MPS needs to store both the local bases and the bond bases. More... | |
class | State |
Matrix Product State with automatic caching. More... | |
Functions | |
void | addScaled (LBOState &a, LBOState const &b, SDef const &s) |
Adds b , scaled by s , to a . More... | |
SRDef | apply_op_itrunc (LBOState &a, Operator const &op, Truncation const &trunc, bool const relax=true, bool const final_rightnorm=true) |
Applies the operator op to the state a using a variant of the zip-up algorithm by Stoudenmire et. al. More... | |
SRDef | apply_op_itrunc (State &a, Operator const &op, Truncation trunc, bool const relax=true, bool const final_rightnorm=true) |
Applies the MPO op to the MPS a , immediately truncating during the application. More... | |
SRDef | apply_op_itrunc_fit (State &a, Operator const &op, Truncation trunc, SRDef desired_change, Index max_opt_sweeps) |
Applies the operator op onto the state a using the itrunc/zip-up method and then does some additional single-site optimisation sweeps on the result. More... | |
SRDef | apply_op_naive (LBOState &a, Operator const &op) |
Naively applies the operator op to the state a . More... | |
void | apply_op_naive (State &a, Operator const &op) |
Applies the MPO op to the MPS a without truncation. More... | |
template<typename Iterator = int> | |
std::tuple< LBOState, SRDef > | apply_op_orthogonalise_fit (LBOState const &, Operator const &, Truncation const &, SRDef, Index=12, Index=2, LBOState=LBOState(), Iterator=0, Iterator=0) |
Dummy implementation to satisfy the compiler, see syten::MPS::apply_op_orthogonalise_fit(). More... | |
template<typename Iterator = State*> | |
std::tuple< State, SRDef > | apply_op_orthogonalise_fit (State const &in, Operator const &op, Truncation const &trunc, SRDef desired_change, Index max_exp_sweeps=12, Index max_opt_sweeps=2, State res=State(), Iterator first=nullptr, Iterator last=nullptr) |
Applies the operator op to the state in while orthogonalising the result against states [first, last) and truncating with trunc . More... | |
MPS::Operator | build_exchange_mpo_above (std::vector< Basis > const &lop_basis, Index const sa, Index const sb, Basis const &vac, std::vector< Pair< Index, Index > > const &fermions) |
Constructs a MPO acting from above which switches the two neighbouring sites sa and sb . More... | |
MPS::Operator | build_exchange_mpo_below (std::vector< Basis > const &uop_basis, Index const sa, Index const sb, Basis const &vac, std::vector< Pair< Index, Index > > const &fermions) |
Behaves the same as build_exchange_mpo_above(), except that it constructs the MPO for application from below; hence also needs an outgoing basis vector to be supplied. More... | |
Pair< Tensor< 4 >, Tensor< 4 > > | build_exchange_tensors_above (Basis const &a, Basis const &b, Basis const &vac, std::vector< Pair< Index, Index > > const &fermions) |
Given two incoming physical bases (upper indices of MPS or MPO), builds two active site tensors switching them around. More... | |
Pair< Tensor< 4 >, Tensor< 4 > > | build_exchange_tensors_below (Basis const &a, Basis const &b, Basis const &vac, std::vector< Pair< Index, Index > > const &fermions) |
Behaves the same as build_exchange_tensors_above(), except that it constructs the tensors for application from below; hence also requires outgoing bases a , b to be supplied. More... | |
Tensor< 4 > | build_mpo_mpo (Tensor< 4 > const &left, Tensor< 4 > const &right, Basis left_basis=Basis(Direction::Inc), Basis right_basis=Basis(Direction::Inc), bool const flip=false) |
Creates the twosite gate from operator. More... | |
Lattice | coarse_grain (Lattice const &lat, std::ostream &out, bool collapse) |
Coarse-grains a lattice, returning a new lattice. More... | |
Operator | coarse_grain (Operator const &op, std::ostream &out, bool collapse) |
Coarse-grains the operator op , returning a new operator of half the size. More... | |
std::size_t | distance (int s, int e) |
Overload of distance() for integers, used by apply_op_orthogonalise_fit() . More... | |
Operator | dot (Operator const &a, Operator const &b) |
Scalar product of two operators. More... | |
Operator | dot (Operator const &a, Operator const &b, Sector const &target) |
Scalar product of two operators, i.e. the product of the operators projected on the supplied vacuum sector. More... | |
void | equiscale (Operator &op) |
Rescales all tensors of the MPO such that the 2-norms of no pair of tensors varies more than by a factor of two. More... | |
std::pair< SRDef, SRDef > | error_estimate_2svariance (MPS::Operator const &op, MPS::Lattice const &lat, MPS::State &psi) |
Calculates the 2-site approximation of the variance of the operator op with respect to the state psi on the lattice lat . More... | |
Operator | exp (Operator const &op, SDef const dt, Operator const &I, Index const order=2) |
Computes the exponential of the given operator. More... | |
bool | expand_to_left_lbo (Tensor< 3 > const &right, Tensor< 4 > const &op, LBOState &target, Index const position, SRDef const alpha=0.1, Index const max_blocksize=15, SRDef const ratio=1., Index const min_blocksize=5) |
Expands the LBO leftwards from site position . More... | |
bool | expand_to_right_lbo (Tensor< 3 > const &left, Tensor< 4 > const &op, LBOState &target, Index const position, SRDef const alpha=0.1, Index const max_blocksize=15, SRDef const ratio=1., Index const min_blocksize=5) |
Expands the LBO rightwards from site position . More... | |
bool | expand_to_top (Tensor< 3 > const &left, Tensor< 3 > const &right, Tensor< 4 > const &op, LBOState &target, Index const position, SRDef const alpha=0.1, Index const max_blocksize=15, SRDef const ratio=1., Index const min_blocksize=5) |
Expands the LBO topwards from site position . More... | |
SDef | expectation (LBOState const &a, Operator const &op) |
Calculates the expectation value \(\langle a | \left(\hat O | a \rangle\right)\). More... | |
SDef | expectation (LBOState const &a, Operator const &op, LBOState const &b) |
Calculates the expectation value \(\langle b | \left(\hat O | a \rangle\right)\). More... | |
SDef | expectation (State &&a, Operator const &op, State &&b) |
Returns the expectation value of an operator between two states as \(\langle b | \left(\hat O | a \rangle\right)\). More... | |
SDef | expectation (State const &a, Operator const &op) |
Returns the expectation value of an MPS::Operator \(\hat O\) w.r.t. a MPS::State \(|a\rangle\), i.e. \(\langle a |\hat O|a
\rangle\). More... | |
SDef | expectation (State const &a, Operator const &op, State const &b) |
Returns the expectation value of an operator between two states as \(\langle b | \left(\hat O | a \rangle\right)\). More... | |
State | fine_grain (State const &inp, Lattice const &target, std::ostream &out, bool collapse) |
Fine-grains a state to be compatible with the supplied lattice. More... | |
Tensor< 4 > | genMPOId (Basis const &upperBasis, Basis const &rightBasis) |
Generates an identity MPO component. More... | |
Tensor< 3 > | lbo_lbo_mps_cmp (Tensor< 3 > const &m, Tensor< 2 > const &v_lower, Tensor< 2 > const &v_upper) |
Contracts the physical indices of the MPS m component with the physical indices of v_lower and the full physical index of herm(v_upper) , resulting in a new MPS component in the optimised space. More... | |
Tensor< 4 > | lboify_mpo_cmp (Tensor< 4 > const &w, Tensor< 2 > const &v_lower, Tensor< 2 > const &v_upper) |
Contracts the physical indices of the MPO component w with the LBO tensors v_lower and herm(v_upper) to result in a new MPO component in the LBO space. More... | |
Tensor< 3 > | left_complement (Tensor< 3 > a, Basis const &local, Basis const &left) |
Constructs the left complement to an existing left-normalised tensor a accessing the remaining parts of the full right space. More... | |
std::pair< std::vector< SDef >, SDef > | local_expectation (Lattice const &lat, State const &a, State const &b, std::string const &id, bool const cache, bool const no_normalise) |
Computes the expectation value on each site for id . More... | |
std::pair< std::vector< SDef >, SDef > | local_expectation (Lattice const &lat, State const &a, std::string const &id, bool const cache, bool const no_normalise) |
Overload. More... | |
void | make_identities (Operator &op, Index const lbound, Index const rbound, Operator const &id) |
If an MPO is not active within the range given it will norm the MPO within this range. More... | |
Tensor< 4 > | mpo_cmp_dot_prod (Tensor< 4 > const &lower, Tensor< 4 > const &upper, bool const fuse_lhs, Sector const &sec=Sector()) |
Builds a new rank-4 MPO component from two rank-4 MPO components lower and upper multiplied via the dot product, i.e. More... | |
Tensor< 4 > | mpo_cmp_prod (Tensor< 4 > const &lower, Tensor< 4 > const &upper, bool const fuse_lhs) |
Builds a new rank-4 MPO component from two rank-4 MPO components lower and upper multiplied over the upper (for lower ) and lower (for upper ) physical indices. More... | |
SRDef | norm (LBOState const &a) |
Calculates the norm of a state. More... | |
SRDef | norm (Operator const &a) |
Returns the square root of the overlap of the operator with itself, identical to the Frobenius norm. More... | |
SRDef | norm (State const &a) |
Returns the norm of a state, i.e. \(\sqrt{\langle a | a \rangle }\). More... | |
SRDef | normSqd (LBOState const &a) |
Calculates the norm of a state. More... | |
SRDef | normSqd (Operator const &a) |
Returns the overlap of the operator with itself, identical to the squared Frobenius norm. More... | |
SRDef | normSqd (State const &a) |
Returns the squared norm of a state, i.e. \(\langle a | a \rangle \). More... | |
Operator | operator* (Operator const &a, Operator const &b) |
Product of two MPO, \( \hat r = \hat b \hat a \), i.e. b is applied after a if r is applied to a state. More... | |
Operator | operator* (Operator const &a, SDef const b) |
Scale a MPO by a scalar, \( \hat r = b \hat a \). More... | |
Operator | operator* (SDef const b, Operator const &a) |
Scale a MPO by a scalar, \( \hat r = b \hat a \) More... | |
State | operator* (State const &a, Operator const &op) |
Multiplies a state with an operator and returns the copy without changing the inputs. More... | |
State | operator* (State const &a, SDef const c) |
Multiplies a state with a number and returns the copy without changing the inputs. More... | |
LBOState | operator+ (LBOState const &a, LBOState const &b) |
Adds two states a and b together. More... | |
Operator | operator+ (Operator const &a, Operator const &b) |
Sum of two MPO, \( \hat r = \hat b + \hat a \) More... | |
State | operator+ (State const &a, State const &b) |
Adds two states together as \(|\phi\rangle = |a\rangle + |b\rangle\). More... | |
Operator | operator- (Operator const &a, Operator const &b) |
Difference of two MPO, \( \hat r = \hat a - \hat b \). More... | |
std::ostream & | operator<< (std::ostream &out, Lattice const &l) |
Pretty output for a lattice, lists the description and known operators. More... | |
std::ostream & | operator<< (std::ostream &out, LBOState const &s) |
Prints the state to the output stream out More... | |
std::ostream & | operator<< (std::ostream &out, Operator const &op) |
Prints a MPO. More... | |
template<typename It > | |
void | orthogonalise_variational (LBOState &, It, It) |
Dummy implementation, currently throws. More... | |
template<typename Iterator > | |
void | orthogonalise_variational (State &psi, Iterator first, Iterator last) |
variationally orthogonalise a state wrt a set of other states in-place More... | |
template<typename It > | |
void | orthogonalise_variational_two_site (LBOState &, It, It, Truncation const &) |
Dummy implementation, currently throws. More... | |
template<typename Iterator > | |
void | orthogonalise_variational_two_site (State &psi, Iterator first, Iterator last, Truncation const &trunc) |
variationally orthogonalise a state two sites at a time wrt a set of other states in-place More... | |
SDef | overlap (LBOState const &b, LBOState const &a) |
Calculates the overlap of two states. More... | |
SDef | overlap (Operator const &a, Operator const &b) |
Returns the overlap of two operators \( \hat A \) and \( \hat
B \), equivalent to \(\mathrm{tr}\left(\hat A^\dagger B\right) \). More... | |
STensor | overlap (SState const &b, SState const &a, std::vector< Index > perm) |
Computes overlap of two smart states. More... | |
SDef | overlap (State b, State a, std::vector< Index > perm) |
SDef | overlap (State const &b, State const &a) |
Returns the overlap \(\langle b | a \rangle\) between two states. More... | |
SDef | overlap (State const &b, State const &a, std::array< Index, 2 > lhs, Index const to) |
Returns overlap but performs swap operation on blocks beforehand. More... | |
Operator | parse (Lattice const &lat, std::string const &desc, bool truncate=true) |
Parse an operator description. More... | |
Operator | parse (std::string const &desc, bool const truncate=true) |
Parse a lattice:operator description. More... | |
Tensor< 3 > | right_complement (Tensor< 3 > b, Basis const &local, Basis const &right) |
Constructs the right complement of a right-normalised tensor B which accesses the remaining parts of the full space to the left. More... | |
void | shift (Tensor< 4 > &input, std::vector< RDef > const &shift, std::vector< Index > const &whichs) |
Shifts virtual legs by desired amount. More... | |
template<typename S > | |
SDef | sqaure_expectation (S &&a, Operator const &op, S &&b) |
Returns the expectation value and the squared. More... | |
void | switch_sites (MPS::Operator &op, Index const sa, Index const sb, std::vector< Pair< Index, Index > > const &fermions) |
Given an MPO op , switches neighbouring sites sa and sb with fermionic sectors as specified by fermions where sa+1 == sb . More... | |
template<typename S > | |
std::pair< SDef, SRDef > | variance (S &&a, Operator const &op, S &&b, SDef norm=NAN) |
Calculates the expectation value and the variance. More... | |
template<typename S > | |
std::pair< SDef, SRDef > | variance (S &&a, Operator const &op, SDef norm=NAN) |
Uses the same state to the left and to the right. More... | |
Helper Functions for MPS/MPO calculations | |
Tensor< 3 > | mps_mpo_mps_ctr_left (Tensor< 3 > const &left, Tensor< 3 > const &lower, Tensor< 3 > const &upper, Tensor< 4 > const &op) |
Calculates a new left-contraction of an MPO with an MPS. More... | |
Tensor< 3 > | mps_mpo_mps_ctr_right (Tensor< 3 > const &right, Tensor< 3 > const &lower, Tensor< 3 > const &upper, Tensor< 4 > const &op) |
Calculates a new right-contraction of an MPO with an MPS. More... | |
Tensor< 3 > | mps_mpo_ctr_ctr (Tensor< 3 > const &left, Tensor< 3 > const &right, Tensor< 3 > const &lower, Tensor< 4 > const &op) |
Calculates a local site contraction. More... | |
Tensor< 2 > | mps_mps_ctr_left (Tensor< 2 > const &left, Tensor< 3 > const &lower, Tensor< 3 > const &upper) |
Calculates a new left contraction for overlap of two states. More... | |
Tensor< 2 > | mps_mps_ctr_right (Tensor< 2 > const &right, Tensor< 3 > const &lower, Tensor< 3 > const &upper) |
Calculates a new right contraction for overlap of two states. More... | |
Tensor< 3 > | mps_mps_ctr_ctr (Tensor< 2 > const &left, Tensor< 2 > const &right, Tensor< 3 > const &lower) |
Calculates a local site contraction. More... | |
void | expand_to_left (Tensor< 3 > const &right, Tensor< 3 > const &source, Tensor< 4 > const &op, State &target, Index const position, SRDef const alpha=0.1, Index const max_blocksize=15, SRDef const ratio=1., Index const min_blocksize=1) |
Calculates an expansion term according to DMRG3S pointing to the left. More... | |
void | expand_to_right (Tensor< 3 > const &left, Tensor< 3 > const &source, Tensor< 4 > const &op, State &target, Index const position, SRDef const alpha=0.1, Index const max_blocksize=15, SRDef const ratio=1., Index const min_blocksize=1) |
Calculates an expansion term according to DMRG3S pointing to the right. More... | |
Helper functions for MPS-MPS calculations | |
Tensor< 2 > | build_ctr_overlap_left (Tensor< 2 > const &left, Tensor< 3 > const &lower, Tensor< 3 > const &upper) |
Combines upper and lower with the existing left-contraction to form a new left contraction. More... | |
Tensor< 2 > | build_ctr_overlap_right (Tensor< 2 > const &right, Tensor< 3 > const &lower, Tensor< 3 > const &upper) |
Combines upper and lower with the existing right-contraction to form a new right contraction. More... | |
Tensor< 4 > | build_two_site_environment (Tensor< 2 > const &r_cont, Tensor< 2 > const &l_cont, Tensor< 3 > const &local_left, Tensor< 3 > const &local_right) |
Combines two rank-2 overlap environment tensors and a two rank-3 MPS tensors into an environment tensor. More... | |
Tensor< 3 > | build_single_site_environment (Tensor< 2 > const &right, Tensor< 2 > const &left, Tensor< 3 > const &local) |
Combines two rank-2 overlap environment tensors and a single rank-3 MPS tensor into an environment tensor in the standard MPS ordering. More... | |
SRDef | split_rank_4_into_mps_rnorm (Tensor< 4 > &&r4, Tensor< 3 > &left_site, Tensor< 3 > &right_site, Truncation trunc) |
Splits a rank-4 tensor into two rank-3 tensors in standard MPS ordering, truncating according to trunc . More... | |
SRDef | split_rank_4_into_mps_lnorm (Tensor< 4 > &&l4, Tensor< 3 > &left_site, Tensor< 3 > &right_site, Truncation trunc) |
Splits a rank-4 tensor into two rank-3 tensors in standard MPS ordering, truncating according to trunc . More... | |
SRDef | split_rank_4_into_mps_cnorm (Tensor< 4 > &&r4, Tensor< 3 > &left_site, Tensor< 2 > ¢er, Tensor< 3 > &right_site, Truncation trunc) |
Splits a rank-4 tensor into two rank-3 tensors in standard MPS ordering, truncating according to trunc . More... | |
State | conj (State const &input) |
Returns a complex-conjugated copy of the input state. More... | |
std::ostream & | operator<< (std::ostream &out, State const &s) |
Outputs all tensors in a MP state. More... | |
void | addScaled (State &a, State const &b, SDef const s) |
Adds a MPS b , scaled by the scalar prefactor s to the MPS a , essentially a fused-multiply-add for MPS::State. More... | |
std::vector< std::vector< SRDef > > | schmidt_values (State &state) |
Returns the Schmidt spectrum and spectrum optionally. More... | |
std::vector< std::vector< std::pair< Sector, std::tuple< std::vector< SRDef >, DenseTensor< 2, SDef >, DenseTensor< 2, SDef > > > > > | schmidt_decompositions (State &state) |
Returns the Schmidt spectrum and vectors. More... | |
std::vector< SRDef > | block_entropies (State &state, SRDef const alpha=1.) |
Computes the Rényi entropies. More... | |
void | taylor_time_evolution (State &psi, Operator const &u, Truncation const &trunc=Truncation(), std::string const &app_method="itrunc") |
Time evolves the state by brute-force exponentiation. More... | |
template<typename TR > | |
void | orthogonalise (State &psi, std::vector< TR > const &orts, Truncation const &) |
Orthogonalises the MPS psi in-place against all vectors contained in orts . More... | |
The namespace containing all MPS-related tools, classes and objects.
MP toolkit.