SyTen
state.h File Reference

State class and closely related functions. More...

+ Include dependency graph for state.h:
+ This graph shows which files directly or indirectly include this file:

Classes

class  syten::MPS::State
 Matrix Product State with automatic caching. More...
 

Namespaces

namespace  syten
 Syten namespace.
 
namespace  syten::MPS
 The namespace containing all MPS-related tools, classes and objects.
 

Macros

#define SYTEN_MPS_EXPECT_ORDER(a, b, c, f)
 Asserts that the supplied macro arguments a, b and c are 1 through 3 with the calling funcation named as f. More...
 

Functions

SRDef syten::MPS::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...
 
void syten::MPS::apply_op_naive (State &a, Operator const &op)
 Applies the MPO op to the MPS a without truncation. More...
 
SDef syten::MPS::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 syten::MPS::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 syten::MPS::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...
 
SRDef syten::MPS::norm (State const &a)
 Returns the norm of a state, i.e. \(\sqrt{\langle a | a \rangle }\). More...
 
SRDef syten::MPS::normSqd (State const &a)
 Returns the squared norm of a state, i.e. \(\langle a | a \rangle \). More...
 
State syten::MPS::operator* (State const &a, Operator const &op)
 Multiplies a state with an operator and returns the copy without changing the inputs. More...
 
State syten::MPS::operator* (State const &a, SDef const c)
 Multiplies a state with a number and returns the copy without changing the inputs. More...
 
State syten::MPS::operator+ (State const &a, State const &b)
 Adds two states together as \(|\phi\rangle = |a\rangle + |b\rangle\). More...
 
SDef syten::MPS::overlap (State const &b, State const &a)
 Returns the overlap \(\langle b | a \rangle\) between two states. More...
 
SDef syten::MPS::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...
 
template<typename S >
SDef syten::MPS::sqaure_expectation (S &&a, Operator const &op, S &&b)
 Returns the expectation value and the squared. More...
 
template<typename S >
std::pair< SDef, SRDef > syten::MPS::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 > syten::MPS::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
void syten::MPS::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 syten::MPS::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...
 
Tensor< 3 > syten::MPS::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< 3 > syten::MPS::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 > syten::MPS::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 > syten::MPS::mps_mps_ctr_ctr (Tensor< 2 > const &left, Tensor< 2 > const &right, Tensor< 3 > const &lower)
 Calculates a local site contraction. More...
 
Tensor< 2 > syten::MPS::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 > syten::MPS::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...
 
Helper functions for MPS-MPS calculations
void syten::MPS::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< SRDef > syten::MPS::block_entropies (State &state, SRDef const alpha=1.)
 Computes the Rényi entropies. More...
 
Tensor< 2 > syten::MPS::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 > syten::MPS::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< 3 > syten::MPS::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...
 
Tensor< 4 > syten::MPS::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...
 
State syten::MPS::conj (State const &input)
 Returns a complex-conjugated copy of the input state. More...
 
std::ostreamsyten::MPS::operator<< (std::ostream &out, State const &s)
 Outputs all tensors in a MP state. More...
 
template<typename TR >
void syten::MPS::orthogonalise (State &psi, std::vector< TR > const &orts, Truncation const &)
 Orthogonalises the MPS psi in-place against all vectors contained in orts. More...
 
std::vector< std::vector< std::pair< Sector, std::tuple< std::vector< SRDef >, DenseTensor< 2, SDef >, DenseTensor< 2, SDef > > > > > syten::MPS::schmidt_decompositions (State &state)
 Returns the Schmidt spectrum and vectors. More...
 
std::vector< std::vector< SRDef > > syten::MPS::schmidt_values (State &state)
 Returns the Schmidt spectrum and spectrum optionally. More...
 
SRDef syten::MPS::split_rank_4_into_mps_cnorm (Tensor< 4 > &&r4, Tensor< 3 > &left_site, Tensor< 2 > &center, 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 syten::MPS::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 syten::MPS::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...
 
void syten::MPS::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...
 

Detailed Description

State class and closely related functions.