SyTen
syten Namespace Reference

The topmost namespace for this project. More...

Namespaces

 ArrayImpl
 Implementation namespace for our Array.
 
 BinaryTree
 Binary tree implementation.
 
 BTT
 The namespace containing binary tree tensor networks.
 
 Caching
 Only contains the Caching::threshold variable.
 
 Delinearise
 Delinearisation decomposition.
 
 DenseEigensolver
 Implementation of dense eigensolvers.
 
 DenseProduct
 Contains helper functions related to the product of two dense tensors, see syten::prodD() for the main entry point.
 
 Deparallelise
 Deparallelisers.
 
 DMRG
 General DMRG-related classes for both MPS and BTT.
 
 Eigen
 Eigendecomposition.
 
 EnvVars
 Namespace for generic static variables initialised from environment variables.
 
 EternalMalloc
 Implementation namespace for le_malloc() and le_free()
 
 Excp
 Namespace for exceptions otherwise polluting the global syten:: namespace.
 
 IPEPS
 IPEPS-related functionality and tools.
 
 k_to_y
 Functions which, when given a momentum on the ring k, give the coordinate y at which we want to place this momentum.
 
 Krylov
 Krylov subspace methods.
 
 Log
 Global variables for the logging subsystem.
 
 LZ4
 Namespace for implementation of LZ4 Boost iostream filter.
 
 MemoryUsage
 Memory usage reporting with allocSize(), totalSize() and stackSize()
 
 MPS
 The namespace containing all MPS-related tools, classes and objects.
 
 Pyten
 Contains the initialisation functions for Python bindings.
 
 QR
 QR Decompositions.
 
 Random
 The random number generation engine generation subsystem.
 
 RepRegister
 All representation-related registers.
 
 Signals
 Signal catching support.
 
 SpanImpl
 Implementation namespace for MutSpan and ConstSpan.
 
 SQL
 Contains functions dealing with square lattices.
 
 STensorImpl
 Contains all ‘smart’ tensor related classes and functions.
 
 SVD
 Singular Value Decomposition.
 
 TensorBlocks
 Functions to sort the blocks of a tensor according to various criteria.
 
 TensorProd
 Implementation helpers for tensor products.
 
 Test
 Helper functions for executables in test/.
 
 Threading
 Threading-control variables and functions.
 

Classes

class  AsyncCached
 An asynchronous caching data wrapper. More...
 
class  Basis
 Basis on a specific tensor leg, essentially a list of symmetry sectors and associated reduced tensor sizes More...
 
class  BasisMap
 A data type similar to Basis which is suitable to quickly check the existence of sectors. More...
 
class  Bitset
 Bitset class directly convertible to boolean. More...
 
class  Cached
 Caching/cached type. More...
 
struct  ConvertingIterator
 The ConvertingIterator is an iterator wrapper that converts its pointee to the desired type. More...
 
struct  CtorTester
 A test object to check that no unnecessary copy operations have taken place. More...
 
struct  DenseIter
 Iterator over a single dense tensor-like object. More...
 
struct  DenseIterRestricted
 Restricted iterator. More...
 
struct  DenseTensor
 Dense tensor class. More...
 
struct  DenseTensorTypeData
 Data for special tensor types. More...
 
class  DynArray
 "Light" version of std::vector that supports malloc() allocation. More...
 
struct  EternalAllocator
 STL-compatible allocator using le_malloc() More...
 
struct  HalfInteger
 Half-Integers. More...
 
struct  HighPrec
 High-precision data type to be used for Clebsch-Gordan coefficients etc. More...
 
struct  History
 A set of history records. More...
 
struct  HistoryElement
 A single history record. More...
 
struct  IdentityType
 Identity type template to hinder type deduction. More...
 
struct  is_number
 is_number<T>::value is true if T is a scalar type. More...
 
struct  is_number< HalfInteger< Base > >
 
struct  is_number< HighPrec >
 Explicit instantiation that a HighPrec is a numeric type. More...
 
struct  IterativeConfig
 Configuration for an iterative eigensolver or exponential algorithm. More...
 
struct  IterativeExit
 Exit description for an iterative algorithm. More...
 
struct  LapackException
 Thrown if a LAPACKE function returns non-zero. More...
 
class  LimVec
 ‘Limited’ vector, wrapper around std::array<> which keeps track of its current size. More...
 
struct  load
 helper class to load an object from a file, uses a struct to imitate return-value-based function overloading More...
 
struct  loadCache
 Shortcut to load("file",true), delete supplied input file. More...
 
struct  loadInput
 Shortcut to load("file",false), don't delete input file. More...
 
struct  Maximum
 Type implicitly convertible to the maximum of all types for which a specialisation of std::numeric_limits has been defined. More...
 
struct  MemorySampler
 Stores memory sampling info, exists once as a static global object. More...
 
struct  NoNew
 Used by the logging infrastructure to indicate that no newline should be printed after the output from the stream. More...
 
struct  NoPrefix
 Used by the logging infrastructure to indicate that no prefix should be printed in front of the line. More...
 
struct  NOut
 The NOut struct is an ostream that does not output anything. More...
 
class  Pair
 A proxy class for std::pair, intended to behave exactly the same but with ADL-supported operator overloading. More...
 
class  Rep
 Single irrep of a (physical) symmetry group. More...
 
struct  ScalarBase
 ScalarBase<>::type is the base type of a complex type and the type itself if the type is a real scalar. More...
 
struct  SLattice
 The "smart" lattice needs to store all local physical bases. More...
 
struct  SMPS
 The "smart" MPS needs to store both the local bases and the bond bases. More...
 
struct  SparseCoordComparator
 Comparator for the flatmap used by the Sparse tensor to compare elements. More...
 
class  SparseTensor
 Sparse tensor of specified rank and scalar type. More...
 
class  Tensor
 A single tensor, composed of a set of symmetry-protected blocks. More...
 
struct  Tensor< 0 >
 Dummy specialisation for zero-rank tensors. More...
 
class  TensorBlock
 Represents one symmetry-protected block of a full tensor. More...
 
struct  TimeOnlyString
 Shift a default-constructed object of this type into a stream to call shiftTime(,true) on the stream, resulting in output HH:MM:SS More...
 
class  Timer
 A simple timing class, shift into an ostream for results. More...
 
struct  TimeString
 Shift a default-constructed object of this type into a stream to call shiftTime() on the stream, resulting in output yyyy.mm.ddTHH:MM:SS.uuu <CPU Time>. More...
 
struct  Truncation
 Truncation specification. More...
 
class  Vec
 A thin wrapper around std::vector with some extra bells and whistles (and without others). More...
 
struct  Verbose
 A proxy class to increase verbosity in the output. More...
 
struct  YesNo
 A base template for all sorts of typefull boolean flags, to be used more in the future. More...
 

Typedefs

template<typename T , std::size_t Sz>
using Array = ArrayImpl::Array< T, Sz >
 A thin wrapper around std::array. More...
 
template<typename T >
using BondGrid = GridImpl::BondGrid< T >
 See GridImpl::BondGrid for details. More...
 
using Conj = YesNo< struct _prod_conj >
 Decides whether to complex-conjugate a given tensor; in tensor products: applies to the second tensor. More...
 
template<typename T >
using ConstSpan = SpanImpl::ConstSpan< T >
 Range of constant elements. More...
 
using FullQR = YesNo< struct _fullqr >
 Specifies whether we do a full QR (Yes) or a thin QR (No) More...
 
template<typename T >
using Grid = GridImpl::Grid< T >
 See GridImpl::Grid for details. More...
 
using HandleFermions = YesNo< struct _prod_handle_fermions >
 Decides whether fermions are handled on the level of tensor-tensor products. More...
 
template<typename T >
using MutSpan = SpanImpl::MutSpan< T >
 Range of mutable elements. More...
 
typedef std::array< RDef, GroupMaxDegreeRepLabel
 Label of single irrep within a group. More...
 
typedef LimVec< Rep, SYTEN_MAX_SYM, unsigned char > Sector
 Specification of a full sector, i.e. one irrep per symmetry used on e.g. a tensor leg. More...
 
using STensor = STensorImpl::STensor
 ‘Smart’ tensor class. More...
 
Common Scalar Types

See also Scalar types for an overview of the different applications of these types.

using Index = std::uint32_t
 The standard index type for tensors, see also Scalar types. More...
 
using Size = std::size_t
 The standard size type for flat arrays, consider this also for loop variables where appropriate, see also Scalar types. More...
 
using Rank = std::size_t
 Compile-time constants, also used for arrays and such, see also Scalar types. More...
 
using Bool = std::uint8_t
 Alternative boolean type to use to avoid std::vector<bool>shenanigans. More...
 
using CDef = HighPrec
 The scalar type used in CGC tensors, see also Scalar types. More...
 
using MDef = HighPrec
 The scalar type used in rep representations (i.e. matrices), typically the same as CDef. More...
 
using RDef = HalfInteger< SYTEN_RDEF_BASE_TYPE >
 The scalar type used to label rep representations, see also Scalar types. More...
 
using SDef = SYTEN_SDEF_TYPE
 The scalar type used in generic tensors, see also Scalar types. More...
 
using SRDef = SYTEN_SRDEF_TYPE
 Real base of the scalar type used in generic tensors, useful for norms etc, see also Scalar types. More...
 

Enumerations

enum  DecompRescaleCGC { Yes, No }
 Whether or not to rescale the CGC spaces during an decomposition. More...
 
enum  DenseTensorType : char { DenseTensorType::None, DenseTensorType::Identity, DenseTensorType::EtherealIdentity }
 Specific types of special dense tensors. More...
 
enum  Direction : char { Direction::Inc, Direction::Out, Direction::Invalid, Direction::Silent }
 Direction of the leg from the view of the tensor it belongs to. More...
 
enum  EliminateZeros { Yes, No }
 Whether to eliminate zeros in tensor products. More...
 
enum  Fermionic : char { Never, Odd, Half }
 Speficiation when a particular label is fermionic. More...
 
enum  Group : char {
  Nil, U1, SU2, SU3,
  Z
}
 Implemented mathematical groups. More...
 
enum  Init : char { Init::Yes, Init::No }
 Specification whether we should use placement new after allocation. More...
 
enum  IterativeExitReason {
  IterativeExitReason::Converged, IterativeExitReason::MaxIterations, IterativeExitReason::MaxPossible, IterativeExitReason::InexactArithmetic,
  IterativeExitReason::E_Input, IterativeExitReason::E_InvalidMode, IterativeExitReason::E_InvalidSubMode, IterativeExitReason::Uninitialised,
  IterativeExitReason::Custom
}
 Exit reasons for iterative algorithms. More...
 
enum  Ordinal { First, Second, Third }
 enum containing the first three ordinals More...
 
enum  ParallelKind { True, False, FirstZero, SecondZero }
 enum containing return values of isParallel() calls More...
 
enum  Statistics { Bosonic, Fermionic }
 enum containing different classes of statistics More...
 
enum  TruncationType {
  Default, SVD, Deparallelise, Delinearise,
  DelineariseRelaxed
}
 enum containing the type of truncation to employ in MPO truncation More...
 

Functions

HighPrec abs (HighPrec const &)
 Absolute value of a HighPrec value. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type abs (DenseTensor< rank, Scalar > const &a)
 \( \sqrt{\sum_k A_k * \textrm{conj}(A_k)} = \sqrt{\textrm{absSqd(A)}} \), see absSqd() More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type abs (SparseTensor< rank, Scalar > const &a)
 norm of a sparse tensor, i.e. the 2-norm were the tensor reshaped into a vector More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type absSqd (DenseTensor< rank, Scalar > const &a)
 \( \sum_k A_k * \textrm{conj}(A_k) \) More...
 
template<Rank rank, typename Scalar , typename RetScalar = Scalar>
ScalarBase< RetScalar >::type absSqd (SparseTensor< rank, Scalar > const &a)
 Squared norm of a sparse tensor, i.e. the squared 2-norm were the tensor reshaped into a vector. More...
 
template<typename Iterator >
void addLog (Iterator first, Iterator end)
 Adds values in the range [first, end) using operator+=, the result is found in *first. More...
 
template<typename Container >
void addLog (Container &c)
 Adds values contained in c into c[0]. More...
 
template<typename Iterator , typename Function >
void addLog (Iterator first, Iterator end, Function &&f, std::size_t threshold=2, std::size_t avail_threads=1)
 Adds values in the range [first, end) using operator+=, the result is found in *first. More...
 
template<typename Container , typename Function >
void addLog (Container &c, Function &&f, std::size_t threshold=2, std::size_t avail_threads=1)
 Adds values contained in c into c[0], applying f whenever more than threshold terms have been summed. More...
 
template<typename Scalar >
void addScaled (DynArray< Scalar > &a, DynArray< Scalar > const &b, typename IdentityType< Scalar >::type const factor)
 \( A_i \leftarrow A_i + f B_i \), adds b scaled by factor to a More...
 
template<Rank rank>
void addScaled (Tensor< rank > &a, Tensor< rank > const &b, SDef const s)
 Adds the tensor b, scaled by the scalar prefactor s to the tensor a, essentially a fused-multiply-add for Tensor. More...
 
template<Rank rank, typename Scalar >
void addScaled (DenseTensor< rank, Scalar > &a, DenseTensor< rank, Scalar > const &b, typename IdentityType< Scalar >::type const factor, EliminateZeros const ezeros)
 \( A_i \leftarrow A_i + f B_i \), adds b scaled by factor to a, if ezeros = EliminateZeros::Yes, eliminates resulting near-zeros. More...
 
template<>
void addScaled< double > (DynArray< double > &a, DynArray< double > const &b, double const factor)
 
template<>
void addScaled< float > (DynArray< float > &a, DynArray< float > const &b, float const factor)
 
template<>
void addScaled< std::complex< double > > (DynArray< std::complex< double > > &a, DynArray< std::complex< double > > const &b, std::complex< double > const factor)
 
template<>
void addScaled< std::complex< float > > (DynArray< std::complex< float > > &a, DynArray< std::complex< float > > const &b, std::complex< float > const factor)
 
DenseTensor< 2, SRDefallSiteEntropy (MPS::State &input, Index const width)
 Calculates the two site entropy of a state on all sites i != j and single site entropy on all sites i == j Works identical to entropyTwoSite but reduces the overhead by storing and reusing some Tensors. More...
 
template<Rank rank, typename Scalar >
std::pair< std::size_t, typename ScalarBase< Scalar >::type > avgAbs (DenseTensor< rank, Scalar > const &a)
 Returns the sum of the absolute values and the number of non-zero entries in the tensor. More...
 
template<Rank rank>
SRDef avgAbs (Tensor< rank > const &a)
 Returns the average of the absolute values of the non-zero entries in the tensor. More...
 
template<Rank rank, typename Scalar >
std::pair< std::size_t, typename ScalarBase< Scalar >::type > avgAbs (SparseTensor< rank, Scalar > const &a)
 Returns the sum of the absolute non-zero values and the total number of entries of the sparse tensor. More...
 
void btt_operator_basis (BTT::Operator::Ptr sptr, BinaryTree::Tree< std::array< Index, 5 > >::Ptr bptr)
 Recursive helper to build a binary tree of bases information for BTT operators. More...
 
void btt_operator_fbasis (BTT::Operator::Ptr sptr, BinaryTree::Tree< Basis >::Ptr bptr)
 Recursive helper to build a binary tree of full bases information for BTT states. More...
 
void btt_state_basis (BTT::State::Ptr sptr, BinaryTree::Tree< std::array< Index, 5 > >::Ptr bptr)
 Recursive helper to build a binary tree of bases information for BTT states. More...
 
void btt_state_fbasis (BTT::State::Ptr sptr, BinaryTree::Tree< Basis >::Ptr bptr)
 Recursive helper to build a binary tree of full bases information for BTT states. More...
 
MPS::Operator build_hopping (MPS::Lattice const &lat, std::string const &sym, Index const first, Index const second)
 Returns the MPO rep of the (non-hermitian/‘half’) hopping term c^\dagger_first \cdot c_second. More...
 
std::string cacheFilename (std::string const &f)
 Given a string f, return the temporary cache filename, i.e. cacheDir + "/" + f More...
 
template<typename Type >
bool cachePair (Cached< Type > const &c)
 Convenience function for backwards-compatibility; do not use. More...
 
template<typename Lattice , typename State >
std::string calc_expval (Lattice const &lat, State &&a, State &&b, SDef const &norm, std::string const &op_expr, int const variance, bool const column, bool const realOnly, bool const imagOnly, Index const prec)
 Calculates an expectation value and possibly a variance for given states, lattices and operators. More...
 
template<typename NewScalar , Rank rank, typename OldScalar >
DenseTensor< rank, NewScalar > change_type (DenseTensor< rank, OldScalar > const &in)
 Change scalar type of tensor. More...
 
template<Rank rank>
bool checkedAddParallel (TensorBlock< rank > &a, TensorBlock< rank > &b, EliminateZeros const ezeros=EliminateZeros::Yes, bool add_cgc=false, bool no_zero_check_dense=false)
 Checks if a and b can be combined additively into a single block. More...
 
template<typename... Args>
void clear (Args &&... args)
 Calls .clear() on all supplied arguments. More...
 
template<Rank rank>
Tensor< rankclip (Tensor< rank > in, SRDef t)
 Clips all elements of the dense tensor blocks below the given threshold to zero; useful for displaying purposes. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > clip (DenseTensor< rank, Scalar > in, typename ScalarBase< Scalar >::type t)
 Clips all elements of the dense tensor below the given threshold to zero. More...
 
template<typename T >
constexpr T closest_power_two (T const &in)
 Returns an power-of-two approximation to in More...
 
template<typename Scalar , typename ThresholdType , typename std::enable_if< std::is_same< Scalar, typename ScalarBase< Scalar >::type >::value, int >::type = 0>
bool closeThreshold (Scalar const &x, typename IdentityType< Scalar >::type const &y, ThresholdType const &threshold)
 Returns true if the two arguments are within threshold distance to each other relative to their magnitude. More...
 
Basis combineBasisExpansion (Basis const &a, Basis const &b)
 Given two bases a and b, returns a combined basis a + b considering symmetries: Sectors s occuring in both bases have size a[s]+b[s], sectors only occuring in one basis keep their size. More...
 
template<Rank rank>
bool compat_exact_equal (Tensor< rank > const &a, Tensor< rank > const &b)
 Returns true if both tensors are compatible on every leg and their difference has norm zero. More...
 
template<typename T , typename std::enable_if<(is_number< T >::value &&std::is_same< T, typename ScalarBase< T >::type >::value), int >::type = 0>
constexpr T const & conj (T const &x)
 Complex conjugate of non-complex types, returns the argument. More...
 
template<Rank rank>
Tensor< rankconj (Tensor< rank > in)
 Complex-conjugates the tensor, inverting tensor directions and complex-conjugating all dense tensors. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > conj (DenseTensor< rank, Scalar > const &a)
 Returns the element-wise complex-conjugate of a More...
 
template<Rank contracted, Rank rank>
std::array< Index, rankconstruct_product_targer_order_a (std::array< int, rank > const &c_a)
 Given a product specifier c_a, constructs a "target order" where each leg fermionically should be such as to not induce further swaps during the product for the A-tensor. More...
 
template<Rank contracted, Rank rank>
std::array< Index, rankconstruct_product_targer_order_b (std::array< int, rank > const &c_b)
 Given a product specifier c_b, constructs a "target order" where each leg fermionically should be such as to not induce further swaps during the product for the B-tensor. More...
 
template<Rank r>
void correct_cgc_tensors (Tensor< r > &in, bool recursive=false, SourceLocation loc=SourceLocation::current())
 Corrects the CGC space by reconstructing it from a fusion tree. More...
 
void create_dg_kinetic_term (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 Creates a kinetic term in the diagonal lattice lat. More...
 
void create_interaction_term (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 Creates the interaction term in the lattice lat. More...
 
void create_ring_repulsion (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 Creates a ring-wise quadratic interaction term which favours equidistribution between different rings. More...
 
void create_rs_occ_operators (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 For every point of the lattice, creates a real-space occupation number operator to facilitate the calculation of real-space expectation values. More...
 
void create_rs_spin_operators (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 For every point of the lattice, creates a real-space spin operator to facilitate the calculation of real-space expectation values. More...
 
void create_sq_inter_ring_kinetic_term (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 Creates a length-wise kinetic term in the square lattice lat. More...
 
void create_sq_intra_ring_kinetic_term (MPS::Lattice &lat, std::string const &sym, Index const length, Index const width, bool const bpo_quiet, std::ostream &out, std::function< Index(int, int)> coord, std::function< Index(int)> kfun, std::vector< Index > idx)
 Creates a width-wise kinetic term in the square lattice lat. More...
 
constexpr Index degree (Group const g)
 The degree of a specific group. More...
 
std::tuple< std::string, std::string, std::string, std::stringdemangle_symbol (const char *symbol_name)
 Returns a tuple <module, demangled_name, location, hexoffset> More...
 
std::string demangle_type (std::string_view const mangled)
 Given a type name as returned by e.g. More...
 
template<typename T >
std::string describe_scalar_type ()
 Template used to generate a std::string describing the type in question. More...
 
template<>
std::string describe_scalar_type< HalfInteger< std::int16_t > > ()
 Specialisation of describe_scalar_type() for half-integers based on std::int16_ts. More...
 
template<>
std::string describe_scalar_type< HalfInteger< std::int32_t > > ()
 Specialisation of describe_scalar_type() for half-integers based on std::int32_ts. More...
 
template<>
std::string describe_scalar_type< HalfInteger< std::int64_t > > ()
 Specialisation of describe_scalar_type() for half-integers based on std::int64_ts. More...
 
template<>
std::string describe_scalar_type< HighPrec > ()
 Specialisation of describe_scalar_type() for HighPrec values. More...
 
Vec< SDefdiagonal (Tensor< 2 > const &m)
 Returns a vector of diagonal values, repeated according to the multiplicities of the tensor blocks. More...
 
SRDef dist (Sector const &s1, Sector const &s2)
 Returns the distance between two sectors, i.e. the sum of the distances between constituent irreps. More...
 
SRDef dist (Rep const &r1, Rep const &r2)
 Returns the distance between two representations, i.e. the absolute value of the sum of the differences in labels. More...
 
SRDef dist (Basis const &b1, Sector const &s2)
 Returns the distance between a sector and a basis. More...
 
template<typename State , typename Operator , typename FunctionParse , typename FunctionRoot >
int do_apply_op (int argc, char **argv, std::string inpFile, std::string oprDesc, FunctionParse parser, FunctionRoot root_node, std::string extension, std::string outFile, std::string funcDesc, std::string secDesc, bool bpo_cache, SRDef threshold, SRDef weight, Index maxBlocksize, Index maxStates, bool notrunc, std::string msg_state, std::string msg_op, Index fit_max_exp_sweeps, Index fit_max_opt_sweeps, SRDef fit_threshold)
 Templated wrapper for the operator application, including the parsing etc. More...
 
template<typename State , typename Lattice >
int do_expval (std::string const &aFile, std::string const &bFile, bool bpo_cache, std::string const &oprDesc, bool variance, bool column, bool realOnly, bool imagOnly, bool no_normalise, Index precision, std::string const &templateFile, std::string const &templateStart, std::string const &templateEnd, std::string const &abbrev)
 Templated wrapper for expectation value calculation including the parsing, set-up etc. More...
 
template<typename Type , std::size_t rank>
std::array< Type, rank-1 > ::type dropDummy (std::array< Type, rank > const &a, std::size_t position)
 Copies a dropping the element at 1-indexed position position. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank-1, Scalar > ::type dropDummy (SparseTensor< rank, Scalar > const &a, Rank position)
 Drops a one-dimensional dummy index at the specified position, i.e. for \( a \in [2, 3, 1] \), dropDummy(a, 3) = b` with \( b \in [2, 3] \). More...
 
template<typename Vector , typename Matrix >
IterativeExit eigenDavidson (Vector &&vec, Matrix const &mat, IterativeConfig const &conf, Vector &evec)
 Davidson eigensolver, closely follows Davidson, JOURNAL OF COMPUTATIONAL PHYSICS 17, 87-94, (1975). More...
 
template<Rank rank, typename Scalar , typename RetType = typename ScalarBase<Scalar>::type>
DenseTensor< rank, RetType > elem_abs (DenseTensor< rank, Scalar > const &a)
 Returns a dense tensor of the real base type with each element equal to the absolute value of that element in a: \( r_{ij} = |a_{ij}| \). More...
 
template<Rank rank, typename Scalar , typename RetScalar = Scalar>
SparseTensor< rank, RetScalar > elem_abs (SparseTensor< rank, Scalar > const &a)
 Returns a sparse tensor \( R \) such that for all \( i \), \( R_i = |a_i| \). More...
 
template<typename Scalar , typename ThresholdType >
void eliminate_to_zero (Scalar &n, ThresholdType const &t)
 Checks if n is over the threshold t · SYTEN_EZERO_THRESHOLD. More...
 
template<typename Scalar , typename ThresholdType >
void eliminate_to_zero (std::complex< Scalar > &n, ThresholdType const &t)
 Checks if n is over the threshold t · SYTEN_EZERO_THRESHOLD. More...
 
SRDef entropy (Tensor< 2 > densityMatrix)
 Calculates the entropy of a density matrix. More...
 
SRDef entropyOneSite (MPS::State &input, Index const site)
 Calculates the single site entropy of a state. More...
 
SRDef entropyTwoSite (MPS::State &input, Index site1, Index site2)
 Calculates the two site entropy of a state. More...
 
template<typename T , std::size_t rank>
bool equalArrayInitList (std::array< T, rank > const &a, std::array< T, rank > const &b)
 Compares two arrays, i.e. More...
 
std::string exec_get_cout (std::string const &command)
 Executes the supplied command and writes the STDOUT from the command into the supplied string. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > expansion (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b, std::array< Index, rank > const &w)
 Tensor-sums a and b together along the dimensions which have non-zero entries in which. More...
 
template<Rank rank>
Tensor< rankexpansion (Tensor< rank > const &a, Tensor< rank > const &b, ConstSpan< Index > const &w)
 Combines the two tensors a and b into a new tensor. More...
 
Tensor< 2 > exponentialTensorSym (Tensor< 2 > const &in, SDef const prefactor, Basis const &full_basis=Basis())
 Builds the exponential \( e^{c A} \) of a hermitian rank-2 tensor \( A \) and a scalar prefactor \( c \). More...
 
Basis filterBasis (Basis const &input, Basis const &site, Basis const &target, Index const remainingSites)
 Returns a new basis which contains only elements from the input basis that are still compatible with the target basis, currently only works with Group::U1 and Group::SU2 symmetries. More...
 
std::array< std::size_t, 3 > free_unused_memory ()
 Instructs MKL and glibc to free unused memory. More...
 
double full_rank_ness (DenseTensor< 2, std::complex< double > > &&a)
 Estimates the full-rank-ness of a complex matrix A (compared to its smaller dimension) using QR with pivoting. More...
 
double full_rank_ness (DenseTensor< 2, std::complex< double > > const &a)
 Estimates the full-rank-ness (compared to its smaller dimension) of a complex matrix A using QR with pivoting. More...
 
double full_rank_ness (DenseTensor< 2, double > &&a)
 Estimates the full-rank-ness of a real matrix A (compared to its smaller dimension) using QR with pivoting. More...
 
double full_rank_ness (DenseTensor< 2, double > const &a)
 Estimates the full-rank-ness (compared to its smaller dimension) of a real matrix A using QR with pivoting. More...
 
Basis gen_vac (Basis in)
 Fuses in with in.adjoint() and removes every sector of the resulting basis which is not the vacuum. More...
 
Tensor< 2 > genCombinator (Basis const &b1)
 Creates a combinator summing up individual contributions in each symmetry sector into a single entry. More...
 
Tensor< 3 > genFuse (Basis const &unsorted_b1, Basis const &unsorted_b2, Index maxBlocksize=std::numeric_limits< Index >::max(), SRDef ratio=1., Index minBlocksize=1, bool ethereal=false)
 Generates a fusing half-isometry map. More...
 
Tensor< 2 > genIINode (Basis const &b1, Basis const &b2)
 Generates a node with two incoming bases b1 and b2. More...
 
Tensor< 2 > genIINode (Basis const &b1)
 Generates a node with two identical incoming bases b1. More...
 
Tensor< 2 > genIONode (Basis const &b1)
 Generates a node with one incoming and one outgoing index. More...
 
Tensor< 2 > genOONode (Basis const &b1, Basis const &b2)
 Generates a node with two outgoing bases b1 and b2. More...
 
Tensor< 2 > genOONode (Basis const &b1)
 Generates a node with two identical outgoing bases b1. More...
 
Tensor< 3 > genRandom (Basis const &firstBasis, Basis const &secondBasis, Index maxBlockSize=200, Ordinal const &resultIndex=Ordinal::Second)
 Generates a random rank-3 tensor. More...
 
Tensor< 3 > genRandom (Basis const &firstBasis, Basis const &secondBasis, Basis const &thirdBasis, bool not_random=false)
 Generates a random rank-3 tensor where the product basis of firstBasis and secondBasis is projected onto thirdBasis More...
 
Rep genRepNil ()
 Generates the sole irrep of Group::Nil, the placeholder for no symmetries. More...
 
std::vector< RepgenReps (Index number, Rep const &start)
 Generate a specific number of unique irreps starting from the specified irrep. More...
 
std::vector< RepgenRepsSU2 (Index number, char phys='S', Fermionic ferm=Fermionic::Never)
 Generate a specific number of unique \( SU(2) \) irreps with the specified physical symmetry description. More...
 
std::vector< RepgenRepsSU3 (Index number, char phys='C', Fermionic ferm=Fermionic::Never)
 Generate a specific number of unique \( SU(3) \) irreps with the specified physical symmetry description. More...
 
std::vector< RepgenRepsU1 (RDef start, Index number=0, char phys='c', Fermionic ferm=Fermionic::Never)
 Generate a specific number of unique \( U(1) \) irreps with the specified physical symmetry description. More...
 
Rep genRepSU2Fundamental (char phys='S', Fermionic ferm=Fermionic::Never)
 Generate the \( SU(2) \) fundamental irrep of the specified physical symmetry. More...
 
Rep genRepSU2Vacuum (char phys='S', Fermionic ferm=Fermionic::Never)
 Generate the \( SU(2) \) vacuum irrep of the specified physical symmetry. More...
 
Rep genRepSU3Fundamental (char phys='C', Fermionic ferm=Fermionic::Never)
 Generate the \( SU(3) \) fundamental irrep of the specified physical symmetry. More...
 
Rep genRepSU3Vacuum (char phys='C', Fermionic ferm=Fermionic::Never)
 Generate the \( SU(3) \) vacuum irrep of the specified physical symmetry. More...
 
Rep genRepU1 (RDef n=0., char phys='c', Fermionic ferm=Fermionic::Never)
 Generate a \( U(1) \) irrep. More...
 
Rep genRepZ (RDef n, RDef m=0., char phys='k', Fermionic ferm=Fermionic::Never)
 Generates an irrep m of Z/n. More...
 
Tensor< 3 > genSplit (Basis const &b1, Basis const &b2, Index maxBlocksize=std::numeric_limits< Index >::max(), SRDef ratio=1., Index minBlocksize=1, bool ethereal=false)
 Generates a splitting half-isometry map. More...
 
Tensor< 4 > genSwap (Basis const &firstBasis, Basis const &secondBasis)
 Constructs a fermionic swap gate of two bases. More...
 
template<Rank rank>
std::vector< SparseTensor< rank, CDef > > genTrivialCGC (Index numSyms=1)
 Generates numSyms trivial CGC tensors of the specified rank. More...
 
std::size_t get_current_rss ()
 Returns the current total memory footprint of the program in bytes. More...
 
template<typename Type , typename GetFunction >
SDef get_result (std::string const &aFile, std::string const &bFile, bool const error, bool const normalise, std::string const &desc, GetFunction f)
 Calculates a result for two objects created by the function f More...
 
template<typename Type >
SDef get_result (std::string const &aFile, std::string const &bFile, bool const bpo_cache, bool const error, bool const normalise, std::string const &desc)
 Calculates a result for two state files loaded via loadInputRef. More...
 
template<typename Scalar >
Scalar getEigenvalue (DenseTensor< 2, Scalar > const &o, DenseTensor< 1, Scalar > const &v)
 Returns the eigenvalue of the specified eigenvector relative to the specified matrix. More...
 
Tensor< 3 > gM (Basis const &b1, Basis const &b2, Index maxBlocksize=std::numeric_limits< Index >::max(), SRDef ratio=1., Index minBlocksize=1, bool ethereal=false)
 Generates either a splitting or fusing half-isometry map. More...
 
Tensor< 3 > gME (Basis const &b1, Basis const &b2)
 Forwards to gM(), setting the ethereal-boolean to true. More...
 
constexpr bool hasCGC (Group const g)
 Returns true if the group g requires using a CGC space. More...
 
template<typename T >
std::hash< T >::result_type hash_value (T const &x)
 For use of Boost's hashing functions with our user-defined types; forwards to std::hash. More...
 
template<typename T >
bool hasMember (std::vector< T > const &v, T const &e)
 Returns true if the vector has an element comparing equal to the second argument. More...
 
template<typename T , std::size_t rank>
bool hasMember (std::array< T, rank > const &v, T const &e)
 Returns true if the array has an element comparing equal to the second argument. More...
 
void herm (Tensor< 2 > &m)
 Transpose and complex conjugate a matrix in place. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > ::type herm (DenseTensor< rank, Scalar > const &a)
 transposes the last two indices and complex-conjugates all entries More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > ::type herm (SparseTensor< rank, Scalar > const &a)
 Transposes the last two indices and complex-conjugates all entries. More...
 
template<typename Scalar >
std::vector< DenseTensor< 1, Scalar > > hsplit (DenseTensor< 2, Scalar > const &matrix)
 \( R[j]_i = in_{ij} \), horizontally splits a matrix into column vectors More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > hstack (std::vector< DenseTensor< 1, Scalar > > const &list)
 \( R_{ij} = v[j]_i \), horizontally stacks vectors into a matrix More...
 
template<typename T , typename std::enable_if<(is_number< T >::value &&std::is_same< T, typename ScalarBase< T >::type >::value), int >::type = 0>
constexpr T imag (T const &)
 Imaginary part of non-complex types, returns zero. More...
 
void initCache (std::string const &c)
 Set the cache directory cacheDir for temporary objects. More...
 
void initialise_terminator (int argc, char **argv)
 Called to initialise the terminator. More...
 
template<typename Type , std::size_t rank>
std::array< Type, rank+1 > insertDummy (std::array< Type, rank > const &a, std::size_t position, typename IdentityType< Type >::type val)
 Copies a with val at 1-indexed position position. More...
 
template<Rank rank>
Tensor< rank+1 > insertDummy (Tensor< rank > const &a, Basis const &vacuum, Index const which)
 Inserts an additional dummy leg transforming as vacuum as the which-th leg of the new tensor. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank+1, Scalar > insertDummy (DenseTensor< rank, Scalar > const &in, Index which)
 Inserts an additional dummy leg as the one-indexed which dense tensor leg. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank+1, Scalar > insertDummy (SparseTensor< rank, Scalar > const &a, Rank position)
 Inserts a 1-dimensional dummy index at the specified position, i.e. for \( a \in [2, 3, 4] \), insertDummy(a, 2) = b with \( b \in [2, 1, 3, 4] \). More...
 
template<Rank rank>
Tensor< rankinsertIOFullHalf (Tensor< rank > const &in, Index const which)
 Flips the which-th leg of the tensor in, product a new output tensor. More...
 
template<Rank rank>
Tensor< rankinsertIOSplitHalf (Tensor< rank > const &in, Index const which)
 Flips the which-th leg of the tensor in, producing a new output tensor. More...
 
template<Rank rank>
Tensor< rankinsertSwap (Tensor< rank > in, Index const a, Index const b, bool const conjugate=false)
 Inserts a swap gate on the two specified tensor legs, which need to point in the same direction. More...
 
Basis intersection (Basis const &b1, Basis const &b2)
 Returns the intersection of the two bases, i.e. the size of a sector in the returned basis is the minimum of the sizes in the two input bases. More...
 
void invertDiagonal (Tensor< 2 > &m)
 Inverts a rank-two tensor in-place by inverting all reduced dense and CGC-space sparse blocks. More...
 
template<typename Scalar >
void invertDiagonal (DenseTensor< 2, Scalar > &a)
 Inverts the diagonal elements of a square matrix in place, leaving zeros untouched. More...
 
template<typename Scalar >
void invertDiagonal (SparseTensor< 2, Scalar > &a)
 Inverts the diagonal data.first of a square matrix in place, leaving zeros untouched. More...
 
template<Rank rank>
bool is_perm_fermionic (TensorBlock< rank > const &in, ConstSpan< int > perms, ConstSpan< Index > current_order)
 Returns true if swapping the legs of in as to conform to perm induces a fermionic factor. More...
 
bool isFermionic (Sector const &a)
 Returns true if the sector is odd/fermionic. More...
 
template<typename T >
bool isnan (std::complex< T > const &x)
 isnan() for complex types, returns true if either real or imaginary part are NaN More...
 
bool isnan (HighPrec const &)
 Returns true if the HighPrec value represents a NaN. More...
 
template<Rank rank, typename Scalar >
std::tuple< ParallelKind, typename ScalarBase< Scalar >::type, typename ScalarBase< Scalar >::type > isParallel (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 Checks if two tensors are parallel, i.e. \( a_i = c \; b_i \quad \forall i \). More...
 
template<Rank rank, typename Scalar >
std::tuple< ParallelKind, Scalar, Scalar > isParallel (SparseTensor< rank, Scalar > const &a, SparseTensor< rank, Scalar > const &b)
 Checks if two tensors are parallel, i.e. \( a_i = c \; b_i \quad \forall i \). More...
 
template<typename Scalar >
std::pair< ParallelKind, Scalar > isParallel_highPrec (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 Checks if two vectors are parallel with very high sensitivity and requiring the factor to be of magnitude between 1e-3 and 1e3. More...
 
template<typename... Args>
void issue_error (std::string const &cond, std::string const &file, std::string const &line, Args &&... others)
 Use the SYTEN_ASSERT() macro instead of this function! More...
 
template<typename... Args>
void issue_info (Args &&... others)
 Use the logGN() function instead of this macro! More...
 
template<typename... Args>
void issue_message (std::string const &file, std::string const &line, Args &&... others)
 Use the SYTEN_MSG() macro instead of this function! More...
 
template<typename... Args>
void issue_warning (std::string const &cond, std::string const &file, std::string const &line, Args &&... others)
 Use the SYTEN_WARN() macro instead of this function! More...
 
bool isVacuum (Sector const &s)
 Returns true iff all reps in the sector return true for rep.isVacuum(). More...
 
template<Rank rank, typename Scalar >
bool isZero (DenseTensor< rank, Scalar > const &a)
 Returns true iff all elements of a are identically zero. More...
 
template<typename Scalar >
DenseTensor< 1, Scalar > kronaa (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 \( R_{i * d_j + j} = A_i B_j \) Kronecker product of two vectors, giving another vector More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > kronbb (DenseTensor< 2, Scalar > const &a, DenseTensor< 2, Scalar > const &b)
 \( R_{i d_k + k, j d_l + l} = A_{ij} B_{kl} \) Kronecker product of two matrices, giving another matrix More...
 
template<typename U >
std::vector< std::vector< U > > kronVector (std::vector< U > const &a, std::vector< U > const &b)
 Kronecker product of two vectors. More...
 
template<typename U >
std::vector< std::vector< U > > kronVector (std::vector< std::vector< U > > const &v, std::vector< U > const &c)
 Kronecker product of a vector of N-vectors and a vector. More...
 
template<typename U , std::size_t rank>
std::vector< std::vector< U > > kronVector (std::vector< std::array< U, rank > > const &v, std::vector< U > const &c)
 Kronecker product of a vector of rank-arrays and a vector. More...
 
void l_free (void *ptr)
 Frees the space of memory pointed to be ptr. More...
 
void * l_malloc (std::size_t const size, std::size_t const alignment=64)
 Allocates a region of heap memory at least size bytes large, aligned to alignment boundary. More...
 
void le_free (void *ptr)
 Frees the space of memory pointed to by ptr. More...
 
void * le_malloc (std::size_t const size, std::size_t const alignment=64)
 Allocates a region of heap memory at least size bytes large, aligned to alignment boundary in a special pool designed for eternal small objects (e.g. reps). More...
 
void linkSites (Index first, Index second, MPS::Lattice &lat, std::map< std::string, std::pair< std::string, std::vector< MPS::Operator > > > &operators, std::string sym, std::string suffix, bool const add_bond_operators, std::vector< Index > const &idx)
 Internal helper: Link sites on lattice. More...
 
std::vector< IndexloadOrder (std::string ordering, Index size=0)
 Reads a file given by ordering as a DenseTensor with reordered position v[i] as entry i. More...
 
template<typename FileStream , typename TerminalStream , typename... Args>
void log_impl (bool prefix, int level, FileStream &file_out, TerminalStream &tty_out, Args &&... data)
 Logs data of the specified level to the specified stream. More...
 
template<typename... Args>
void logE (int level, std::ofstream &file_out, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cerr and prints the prefix. More...
 
template<typename... Args>
void logE (int level, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cerr and prints the prefix. More...
 
template<typename... Args>
void logE (int level, std::ofstream &file_out, NoPrefix, Args &&... data)
 Logs data of the specified level to the specified file stream and std::cerr and does not print the prefix. More...
 
template<typename... Args>
void logE (int level, NoPrefix, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cerr and does not print the prefix. More...
 
template<typename... Args>
void logGD (Args &&... data)
 Logs generic debugging data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logGd (Args &&... data)
 Logs generic extra debugging data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logGE (Args &&... data)
 Logs generic errors to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logGI (Args &&... data)
 Logs generic informational data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logGN (Args &&... data)
 Logs generic notices to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logGW (Args &&... data)
 Logs generic warnings to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logO (int level, std::ofstream &file_out, Args &&... data)
 Logs data of the specified level to the specified file stream and std::cout and prints the prefix. More...
 
template<typename... Args>
void logO (int level, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cout and prints the prefix. More...
 
template<typename... Args>
void logO (int level, std::ofstream &file_out, NoPrefix, Args &&... data)
 Logs data of the specified level to the specified file stream and std::cout and does not print the prefix. More...
 
template<typename... Args>
void logO (int level, NoPrefix, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cout and does not print the prefix. More...
 
template<typename... Args>
void logTI (Args &&... data)
 Logs informational timing data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logTV (Args &&... data)
 Logs verbose timing data to the standard file streams and std::cerr. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, std::complex< typename ScalarBase< Scalar >::type > > make_complex (DenseTensor< rank, Scalar > const &in)
 Returns a tensor of the complexified real base type of in. More...
 
Sector make_vacuum (Sector const &like)
 Returns a vacuum sector of symmetries identical to like. More...
 
template<typename Scalar >
void makeDiagonal (DenseTensor< 2, Scalar > &a, DenseTensor< 1, Scalar > const &d)
 Makes a diagonal with elements from d More...
 
template<typename Scalar >
void makeIdentity (DenseTensor< 2, Scalar > &a)
 Makes a square rank-2 tensor the identity matrix, \( A_{ij} = 1 \mathrm{\; if \;} i \equiv j \mathrm{\; else\; } 0 \). More...
 
template<typename Scalar >
void makeIdentity (DenseTensor< 3, Scalar > &a, Index offset=0)
 Makes a rank-3 tensor a shifted identity tensor, \( A_{ijk} = 1 \mathrm{\; if\;} (i * \mathrm{dim}(2) + j + \mathrm{\; offset \;}) \equiv k \mathrm{\; else \;} 0 \). More...
 
template<typename Scalar >
void makeIdentity (DenseTensor< 4, Scalar > &a)
 Makes a rank-4 tensor a doubled identity tensor, \( A_{ijkl} = 1 \mathrm{\; if\; } i \equiv j \wedge k \equiv l \mathrm{\; else\; } 0 \). More...
 
template<typename Scalar >
void makeIdentity (SparseTensor< 2, Scalar > &a)
 Makes a into a two-dimensional identity matrix. More...
 
template<Rank rank, typename Scalar >
void makeRandom (DenseTensor< rank, Scalar > &a, double b=-2., double e=2.)
 Fills the tensor with random values between b and e. More...
 
template<Rank rank, typename BaseScalar >
void makeRandom (DenseTensor< rank, std::complex< BaseScalar > > &a, double b=-2., double e=2.)
 Fills the tensor with random values between b+bi and e+ei. More...
 
template<Rank rank, typename Scalar >
void makeZero (DenseTensor< rank, Scalar > &a)
 Sets all elements to zero. More...
 
template<typename T , typename U , typename F >
auto mapVector (std::vector< T > const &a, std::vector< U > const &b, F f)
 Maps a binary function over two vectors. More...
 
template<typename I , typename F >
auto mapVector (std::vector< I > const &a, F f)
 Maps a unary function over one vector. More...
 
template<Rank rank>
SRDef max (Tensor< rank > const &a)
 Returns the element with the greatest magnitude. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type max (DenseTensor< rank, Scalar > const &a)
 Returns the element with the greatest magnitude in the dense tensor. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type max (SparseTensor< rank, Scalar > const &a)
 Returns the element with the greatest magnitude in the sparse tensor. More...
 
SRDef min_dist (Basis const &b1, Basis const &b2)
 Returns the minimal distance between elements of the two basis. More...
 
bool minus_on_swap (Sector const &a, Sector const &b)
 Returns true if swapping the two sectors induces a minus sign. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > multi_transpose (SparseTensor< rank, Scalar > const &in, std::array< int, rank > const &perm, bool conjugate=false)
 Transposes the sparse tensor according to the permutation perm. More...
 
template<Rank rank>
Tensor< rankmulti_transpose (Tensor< rank > const &m, [[maybe_unused]] std::array< int, rank > const &perm, Conj conjugate=Conj::n())
 Returns a transposed copy of the input tensor. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > multi_transpose (DenseTensor< rank, Scalar > const &a, std::array< int, rank > perm, bool conjugate=false)
 Multi-transpose. More...
 
template<Rank rank>
SRDef norm (Tensor< rank > const &a, SourceLocation location=SourceLocation::current())
 Calculates the norm of a tensor as the scalar product with itself. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type norm (DenseTensor< rank, Scalar > const &a)
 \( |a| = \textrm{abs}(a) \), see abs() More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type norm (SparseTensor< rank, Scalar > const &a)
 norm of a sparse tensor, i.e. the 2-norm were the tensor reshaped into a vector More...
 
template<Rank rank>
void normalise (Tensor< rank > &a, SourceLocation location=SourceLocation::current())
 Scales the supplied tensor a by its norm. More...
 
template<Rank rank>
Tensor< ranknormalised (Tensor< rank > a, SourceLocation location=SourceLocation::current())
 Destroys the input state and returns it normalised. More...
 
template<Rank rank>
SRDef normSqd (Tensor< rank > const &a, SourceLocation location=SourceLocation::current())
 Calculates the squared norm of a tensor as the scalar product with itself. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type normSqd (DenseTensor< rank, Scalar > const &a)
 \( |a|^2 = \textrm{absSqd}(a) \), see absSqd() More...
 
template<Rank rank, typename Scalar , typename RetScalar = Scalar>
ScalarBase< RetScalar >::type normSqd (SparseTensor< rank, Scalar > const &a)
 Squared norm of a sparse tensor, i.e. the squared 2-norm were the tensor reshaped into a vector. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type nz_abs (DenseTensor< rank, Scalar > const &a)
 Returns the sum of the absolutes of the non-zero elements. More...
 
void onterminate ()
 To be called on terminate(). More...
 
Direction operator! (Direction const &dir)
 Negate the direction of a basis, only valid for Direction::Inc and Direction::Out. More...
 
template<typename TypeA , typename TypeB >
bool operator!= (EternalAllocator< TypeA > const &, EternalAllocator< TypeB > const &)
 All eternal allocators use the same pool, so they are all equal. More...
 
bool operator!= (HighPrec const &, SYTEN_SRDEF_TYPE const)
 Not-equals comparison with SYTEN_SRDEF_TYPEs. More...
 
bool operator!= (SYTEN_SRDEF_TYPE const, HighPrec const &)
 Not-equals comparison with SYTEN_SRDEF_TYPEs. More...
 
template<Rank rank, typename Scalar >
bool operator!= (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 Returns false if all elements of the two tensors are within SYTEN_SMALL_THRESHOLD of each other. More...
 
template<Rank rank>
bool operator!= (Tensor< rank > const &a, Tensor< rank > const &b)
 Returns true if the absolute value of the difference between a and b is large. More...
 
template<typename Base >
bool operator!= (HalfInteger< Base > const a, HalfInteger< typename IdentityType< Base >::type > const b)
 Comparison of two half-integers. More...
 
template<typename Base , typename Other , typename std::enable_if<!std::is_same< HalfInteger< Base >, Other >::value, int >::type = 0>
bool operator!= (HalfInteger< Base > const a, Other const b)
 Comparison of a half-integer with another value. More...
 
SDef operator"" _c (long double value)
 User-defined literal operator to turn a floating-point value into a SDef (potentially complex). More...
 
SDef operator"" _c (unsigned long long int value)
 User-defined literal operator to turn an integer value into a SDef (potentially complex). More...
 
SDef operator"" _i (long double value)
 User-defined literal operator to turn a floating-point value into a purely imaginary SDef. More...
 
SDef operator"" _i (unsigned long long int value)
 User-defined literal operator to turn an integer value into a purely imaginary SDef. More...
 
SRDef operator"" _r (long double value)
 User-defined literal operator to turn a floating-point value into a SRDef. More...
 
SRDef operator"" _r (unsigned long long int value)
 User-defined literal operator to turn an integer into a SRDef. More...
 
template<typename Base >
HalfInteger< Base > operator% (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Modulo of two half-integers. More...
 
template<typename Base >
HalfInteger< Base > operator% (HalfInteger< Base > const a, int const b)
 Modulo of two half-integers. More...
 
template<Rank rank>
Tensor< rankoperator* (SDef const &s, Tensor< rank > const &t)
 \( r_{i\ldots} = s \cdot t_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rankoperator* (Tensor< rank > const &t, SDef const &s)
 \( r_{i\ldots} = s \cdot t_{i\ldots} \) More...
 
HighPrec operator* (HighPrec const &, HighPrec const &)
 Multiplication of two HighPrec values. More...
 
template<Rank rank>
SDef operator* (Tensor< rank > const &a, Tensor< rank > const &b)
 \( r = \sum_{i\ldots} a^\star_{i\ldots} b_{i\ldots} \) More...
 
template<Rank rank, typename ScalarA , typename ScalarB >
DenseTensor< rank, ScalarA > operator* (DenseTensor< rank, ScalarA > const &a, ScalarB const b)
 \( r_{i\ldots} = b \cdot a_{i\ldots} \) More...
 
template<Rank rank, typename ScalarB , typename ScalarA >
DenseTensor< rank, ScalarA > operator* (ScalarB const b, DenseTensor< rank, ScalarA > const &a)
 \( r_{i\ldots} = b \cdot a_{i\ldots} \) More...
 
template<Rank rank, typename Scalar >
Scalar operator* (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 \( r = \sum_{i\ldots} a_{i\ldots}^\star b_{i\ldots} \) More...
 
template<typename Base >
HalfInteger< Base > operator* (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Product of two half-integers. More...
 
template<typename Base , typename Other , typename std::enable_if<!std::is_same< HalfInteger< Base >, Other >::value, int >::type = 0>
HalfInteger< Base > operator* (HalfInteger< Base > const a, Other const b)
 Product of a half-integer and another value. More...
 
template<typename Base , typename Other >
HalfInteger< Base > operator* (Other const b, HalfInteger< Base > const a)
 Product of a half-integer and another value. More...
 
template<Rank rank>
Tensor< rank > & operator*= (Tensor< rank > &t, SDef const &s)
 \( t_{i\ldots} = s \cdot t_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rankoperator*= (Tensor< rank > &&t, SDef const &s)
 \( t_{i\ldots} = s \cdot t_{i\ldots} \) More...
 
template<Rank rank, typename ScalarA , typename ScalarB >
DenseTensor< rank, ScalarA > & operator*= (DenseTensor< rank, ScalarA > &a, ScalarB b)
 \( a_{i\ldots} = b \cdot a_{i\ldots} \) More...
 
template<Rank rank, typename ScalarA , typename ScalarB >
DenseTensor< rank, ScalarA > operator*= (DenseTensor< rank, ScalarA > &&a, ScalarB b)
 \( a_{i\ldots} = b \cdot a_{i\ldots} \) More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > operator+ (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 \( r_{i\ldots} = a_{i\ldots} + b_{i\ldots} \) More...
 
HighPrec operator+ (HighPrec const &, HighPrec const &)
 Addition of two HighPrec values. More...
 
template<Rank rank>
Tensor< rankoperator+ (Tensor< rank > const &a, Tensor< rank > const &b)
 \( r_{i\ldots} = a_{i\ldots} + b_{i\ldots} \) More...
 
template<typename Base >
HalfInteger< Base > operator+ (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Sum of two half-integers. More...
 
template<typename Base , typename Other , typename std::enable_if<!std::is_same< HalfInteger< Base >, Other >::value, int >::type = 0>
HalfInteger< Base > operator+ (HalfInteger< Base > const a, Other const b)
 Sum of a half-integer and another scalar. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > & operator+= (DenseTensor< rank, Scalar > &a, DenseTensor< rank, Scalar > const &b)
 \( a_{i\ldots} = a_{i\ldots} + b_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rank > & operator+= (Tensor< rank > &a, Tensor< rank > const &b)
 \( a_{i\ldots} = a_{i\ldots} + b_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rank > & operator+= (Tensor< rank > &a, Tensor< rank > &&b)
 \( a_{i\ldots} = a_{i\ldots} + b_{i\ldots} \) More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > operator- (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 \( r_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
HighPrec operator- (HighPrec const &, HighPrec const &)
 Subtraction of two HighPrec values. More...
 
template<typename Base >
HalfInteger< Base > operator- (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Difference between two half-integers. More...
 
template<typename Base >
HalfInteger< Base > operator- (HalfInteger< Base > const a)
 Negative of a half-integer. More...
 
template<Rank rank>
Tensor< rankoperator- (Tensor< rank > const &a, Tensor< rank > const &b)
 \( r_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > & operator-= (DenseTensor< rank, Scalar > &a, DenseTensor< rank, Scalar > const &b)
 \( a_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > operator-= (DenseTensor< rank, Scalar > &&a, DenseTensor< rank, Scalar > const &b)
 \( a_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rank > & operator-= (Tensor< rank > &a, Tensor< rank > const &b)
 \( a_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rankoperator-= (Tensor< rank > &&a, Tensor< rank > const &b)
 \( a_{i\ldots} = a_{i\ldots} - b_{i\ldots} \) More...
 
template<Rank rank>
Tensor< rankoperator/ (Tensor< rank > const &t, SDef const &s)
 \( r_{i\ldots} = t_{i\ldots}/s \) More...
 
HighPrec operator/ (HighPrec const &, HighPrec const &)
 Division of two HighPrec values. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > operator/ (DenseTensor< rank, Scalar > const &a, typename IdentityType< Scalar >::type b)
 \( r_{i\ldots} = a_{i\ldots}/b \) More...
 
template<typename Base , typename Other >
HalfInteger< Base > operator/ (HalfInteger< Base > const a, Other const b)
 Division of a half-integer by another value. More...
 
template<Rank rank>
Tensor< rank > & operator/= (Tensor< rank > &t, SDef const &s)
 \( t_{i\ldots} = t_{i\ldots}/s \) More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > & operator/= (DenseTensor< rank, Scalar > &a, typename IdentityType< Scalar >::type b)
 \( a_{i\ldots} = a_{i\ldots}/b \) More...
 
bool operator< (HighPrec const &, SYTEN_SRDEF_TYPE const)
 Less-than comparison with SYTEN_SRDEF_TYPEs. More...
 
bool operator< (SYTEN_SRDEF_TYPE const, HighPrec const &)
 Less-than comparison with SYTEN_SRDEF_TYPEs. More...
 
template<typename Base >
bool operator< (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Less-than comparison for HalfInteger. More...
 
std::ostreamoperator<< (std::ostream &out, Fermionic const when)
 Outputs a Fermionic specification. More...
 
std::ostreamoperator<< (std::ostream &out, DenseTensorTypeData const &td)
 Pretty-prints a dense tensor special type. More...
 
std::ostreamoperator<< (std::ostream &out, Direction const dir)
 Output of the direction of a basis. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeExitReason const &r)
 Prettyprinting of an exit reason. More...
 
std::ostreamoperator<< (std::ostream &out, ParallelKind const &p)
 Output for ParallelKind's. More...
 
std::ostreamoperator<< (std::ostream &out, Group const &g)
 Output of a mathematical group. More...
 
std::ostreamoperator<< (std::ostream &out, TruncationType const &tt)
 Output for TruncationType's. More...
 
std::ostreamoperator<< (std::ostream &out, CtorTester const &c)
 Output of a CtorTester. More...
 
std::ostreamoperator<< (std::ostream &out, HistoryElement const &elem)
 Prints a history record to the output stream, omitting the comment. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeExit const &r)
 Prettyprinting of an exit description. More...
 
template<typename T >
std::ostreamoperator<< (std::ostream &stream, YesNo< T > const &t)
 stream output for YesNo<T> More...
 
std::ostreamoperator<< (std::ostream &out, Verbose< HistoryElement > const &elem)
 Prints a history record to the output stream, including the comment. More...
 
std::ostreamoperator<< (std::ostream &out, Truncation const &trunc)
 Pretty-prints a truncation object. More...
 
std::ostreamoperator<< (std::ostream &out, History const &hist)
 Prints a set of history records to the output stream, omitting comments. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeConfig const &c)
 Short output of an eigensolver configuration struct. More...
 
std::ostreamoperator<< (std::ostream &out, Timer const &timer)
 calculate totals, percentages and writes results to the stream More...
 
std::ostreamoperator<< (std::ostream &out, TimeString const &)
 Shifts the current date, time and cpu time into &out, as if shiftTime(out, false) was called. More...
 
std::ostreamoperator<< (std::ostream &out, TimeOnlyString const &)
 Shifts the current time into &out, as if shiftTime(out, true) was called. More...
 
std::ostreamoperator<< (std::ostream &out, Verbose< History > const &hist)
 Prints a set of history records to the output stream, including comments. More...
 
std::ostreamoperator<< (std::ostream &out, Verbose< IterativeConfig > const &c)
 Verbose output of an eigensolver configuration struct. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, Vec< Type > const &a)
 Formatted output of a vector, using square brackets. More...
 
template<typename First , typename Second >
std::ostreamoperator<< (std::ostream &out, Pair< First, Second > const &pair)
 Writing a Pair<> to an output stream. More...
 
std::ostreamoperator<< (std::ostream &, HighPrec const &)
 Output of a HighPrec value. More...
 
template<typename First , typename Second >
std::ostreamoperator<< (std::ostream &out, Verbose< Pair< First, Second > > const &pair)
 Writing a verbose Pair<> to an output stream. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, syten::Verbose< Vec< Type > > const &a)
 Formatted verbose output of a vector, using square brackets. More...
 
template<typename Scalar >
std::ostreamoperator<< (std::ostream &out, DenseTensor< 1, Scalar > const &t)
 Prettyprinting of a vector. More...
 
std::ostreamoperator<< (std::ostream &out, Rep const &r)
 Output of a physical symmetry irrep. More...
 
template<typename Scalar >
std::ostreamoperator<< (std::ostream &out, DenseTensor< 2, Scalar > const &t)
 Prettyprinting of a matrix. More...
 
template<Rank rank, typename Scalar >
std::ostreamoperator<< (std::ostream &out, DenseTensor< rank, Scalar > const &t)
 Prettyprinting of a rank-3 or higher tensor. More...
 
template<Rank rank>
std::ostreamoperator<< (std::ostream &out, Tensor< rank > const &t)
 Prettyprinting for tensors. More...
 
std::ostreamoperator<< (std::ostream &out, Basis const &b)
 Output of a basis, more concise if basis is silenced. More...
 
template<typename Base >
std::ostreamoperator<< (std::ostream &o, HalfInteger< Base > const b)
 Output for half-integers. More...
 
template<typename Type , Rank max, typename MaxType >
std::ostreamoperator<< (std::ostream &out, LimVec< Type, max, MaxType > const &v)
 Output for a LimVec. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, Cached< Type > const &c)
 Easy output for Cached<>'s. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, DynArray< Type > const &a)
 Formatted output of a DynArray, using square brackets. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, Verbose< DynArray< Type > > const &a)
 Formatted verbose output of a DynArray, using square brackets. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, AsyncCached< Type > const &c)
 Easy output for AsyncCached<>'s. More...
 
template<Rank rank, typename Scalar >
std::ostreamoperator<< (std::ostream &out, SparseTensor< rank, Scalar > const &t)
 Pretty output of sparse tensors. More...
 
template<typename Base >
bool operator<= (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Less-or-equal comparison for HalfInteger. More...
 
template<typename TypeA , typename TypeB >
bool operator== (EternalAllocator< TypeA > const &, EternalAllocator< TypeB > const &)
 All eternal allocators use the same pool, so they are all equal. More...
 
bool operator== (HighPrec const &, SYTEN_SRDEF_TYPE const)
 Equals-comparison with SYTEN_SRDEF_TYPEs. More...
 
bool operator== (SYTEN_SRDEF_TYPE const, HighPrec const &)
 Equals-comparison with SYTEN_SRDEF_TYPEs. More...
 
template<Rank rank, typename Scalar >
bool operator== (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 Returns true if all elements of the two tensors are within SYTEN_SMALL_THRESHOLD of each other. More...
 
template<Rank rank>
bool operator== (Tensor< rank > const &a, Tensor< rank > const &b)
 Returns true if a and b are identical up to error sqrt(N)·ε where N is the average of the number of dense entries in a and b and ε is SYTEN_SMALL_THRESHOLD. More...
 
template<typename Base >
bool operator== (HalfInteger< Base > const a, HalfInteger< typename IdentityType< Base >::type > const b)
 Comparison of two half-integers. More...
 
template<typename Base , typename Other , typename std::enable_if<!std::is_same< HalfInteger< Base >, Other >::value, int >::type = 0>
bool operator== (HalfInteger< Base > const a, Other const b)
 Comparison of a half-integer with another value. More...
 
bool operator> (HighPrec const &, SYTEN_SRDEF_TYPE const)
 Greater-than comparison with SYTEN_SRDEF_TYPEs. More...
 
bool operator> (SYTEN_SRDEF_TYPE const, HighPrec const &)
 Greater-than comparison with SYTEN_SRDEF_TYPEs. More...
 
template<typename Base >
bool operator> (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Greater-than comparison for HalfInteger. More...
 
template<typename Base >
bool operator>= (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Greater-or-equal comparison for HalfInteger. More...
 
template<typename First , typename Second >
std::istreamoperator>> (std::istream &in, Pair< First, Second > &pair)
 Reading a Pair<> from an input stream. More...
 
std::istreamoperator>> (std::istream &in, IterativeConfig &c)
 Parse an eigensolver configuration struct, both short and verbose supported. More...
 
template<typename Scalar >
std::istreamoperator>> (std::istream &in, DenseTensor< 1, Scalar > &v)
 Parse a rank-1 tensor from an input stream. More...
 
template<typename Base >
std::istreamoperator>> (std::istream &i, HalfInteger< Base > &b)
 Input behaves like a SYTEN_SRDEF_TYPE, then do the conversion. More...
 
template<typename Scalar >
std::istreamoperator>> (std::istream &in, DenseTensor< 2, Scalar > &v)
 Parse a rank-2 tensor from an input stream. More...
 
template<typename Scalar >
std::istreamoperator>> (std::istream &in, DenseTensor< 3, Scalar > &v)
 Parse a rank-3 tensor from an input stream. More...
 
template<typename Scalar >
DenseTensor< 1, Scalar > orthogonalise (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 \( R_i = A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i \) More...
 
template<typename T , typename Iterator >
void orthogonalise_arithmetic (T &vec, Iterator first, Iterator last, bool assume_norm_one=false, Truncation const &trunc=Truncation())
 Generic implementation of orthogonalisation against a set of vectors using Gram-Schmidt orthogonalisation. More...
 
template<typename T , typename Iterator >
auto orthogonalise_arithmetic_imp (T &vec, Iterator first, Iterator last, Truncation const &trunc=Truncation(), bool assume_norm_one=false, int=0) -> decltype(vec.truncateKeepNorm(trunc), void())
 orthogonalise_arithmetic(): Preferred implementation, used if truncateKeepNorm() exists. More...
 
template<typename T , typename Iterator >
void orthogonalise_arithmetic_imp (T &vec, Iterator first, Iterator last, Truncation const &=Truncation(), bool assume_norm_one=false, long=0)
 orthogonalise_arithmetic(): Fully generic implementation More...
 
template<typename Scalar >
void orthogonalise_inplace (DenseTensor< 1, Scalar > &a, DenseTensor< 1, Scalar > const &b)
 \( A_i \gets A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i \) (in-place) More...
 
template<typename T >
void orthogonalise_run (int argc, char **argv, std::string const &inpFile, std::vector< std::string > const &ortFiles, std::string const &outFile, std::string const &type, Truncation const &trunc, bool bpo_cache, bool normalise, bool check_ortho, std::string method, std::ostream &err, std::ostream &out)
 Templated implementation for orthogonalisation of states. More...
 
template<typename Vector , typename Iterator >
std::remove_reference< Vector >::type orthogonalise_solve_svd (Vector &&target, Iterator first, Iterator last, DenseTensor< 2 > const &xtxinv, bool careful)
 Generic implementation of orthogonalisation against a set of vectors using SVD-based orthogonalisation. More...
 
template<typename Vector , typename Iterator >
std::pair< typename std::remove_reference< Vector >::type, DenseTensor< 2 > > orthogonalise_solve_svd (Vector &&target, Iterator first, Iterator last, bool careful)
 Generic implementation of orthogonalisation against a set of vectors using SVD-based orthogonalisation. More...
 
template<typename Scalar >
DenseTensor< 1, Scalar > orthonormalise (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 \( R_i = A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i ; \quad R_i = R_i / |R| \) More...
 
template<Rank rank>
SDef overlap (Tensor< rank > const &a, Tensor< rank > const &b)
 Calculates the overlap between two tensors as their scalar product. More...
 
template<typename Scalar , typename ThresholdType , typename std::enable_if< std::is_same< Scalar, typename ScalarBase< Scalar >::type >::value, int >::type = 0>
bool overThreshold (Scalar const &x, ThresholdType const &threshold)
 Returns true if the absolute value of the argument is larger than the threshold. More...
 
Sector parseSector (Sector const &systemReps, std::string desc)
 Parse a string defining a Sector into a Sector. More...
 
template<typename Type >
std::vector< Type > parseVector (std::istream &in, char start='{', char end='}', char delim=',')
 Helper for the rank-3 tensor parser, reads from an input stream into a vector. More...
 
template<Rank rank, typename Scalar >
std::pair< Index, typename ScalarBase< Scalar >::type > partial_abs (DenseTensor< rank, Scalar > const &a, std::array< Index, rank > const &allowed_entries)
 Calculates the partial sum of absolute values of entries. More...
 
template<Rank rank>
std::array< int, rankperm_to_change_fermionic_order (ConstSpan< Index > const &from, ConstSpan< Index > const &to)
 Generates a permutation which, given an existing fermionic order from, changes this order to to. More...
 
HighPrec pow (HighPrec const &, int)
 Integer power of a HighPrec value. More...
 
template<typename T >
void print_avg_abs (T const &a)
 Prints the avgAbs() values of an iterable with operator() (e.g. More...
 
void print_backtrace ()
 Prints a backtrace using logGW(). More...
 
std::string print_result (SDef const result, bool const column, bool const realOnly, bool const imagOnly, Index const prec, std::string const &prefix="")
 Return a string representation of a numerical result. More...
 
template<Rank summed, Rank frank, Rank srank, typename Scalar , std::enable_if_t<(int(frank)+int(srank) - 2 *int(summed) > 0>
DenseTensor< frank+srank - 2 *summed, Scalar > prodD (DenseTensor< frank, Scalar > const &a, DenseTensor< srank, Scalar > const &b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, bool conjugate=false, EliminateZeros const ezeros=EliminateZeros::No)
 Product/Contraction of two dense tensors. More...
 
template<Rank r, typename Scalar >
Scalar prodD (DenseTensor< r, Scalar > const &a, DenseTensor< r, Scalar > const &b, std::array< int, r > const &c_a, std::array< int, r > const &c_b, bool conjugate=false)
 Reordering scalar product of two dense tensors. More...
 
template<Rank summed, Rank frank, typename Scalar >
std::enable_if< frank==summed, Scalar >::type prodD (DenseTensor< frank, Scalar > const &a, DenseTensor< frank, Scalar > const &b, bool conjugate=true)
 Scalar product of two dense tensors. More...
 
template<Rank summed, Rank frank, Rank srank, typename Scalar >
SparseTensor< frank+srank - 2 *summed, Scalar > prodS (SparseTensor< frank, Scalar > const &a, SparseTensor< srank, Scalar > const &b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, bool conjugate=false, bool calc_abs=true)
 Product of two sparse tensors, see prodD for a detailed discussion of the arguments. More...
 
template<Rank r, typename Scalar >
Scalar prodS (SparseTensor< r, Scalar > const &a, SparseTensor< r, Scalar > const &b, std::array< int, r > const &c_a, std::array< int, r > const &c_b, bool conjugate=false, bool=true)
 Complete product of two unordered sparse tensors. More...
 
template<Rank summed, Rank frank, typename Scalar >
std::enable_if< frank==summed, Scalar >::type prodS (SparseTensor< frank, Scalar > const &a, SparseTensor< frank, Scalar > const &b, bool conjugate=true)
 Scalar product/full contraction of two sparse tensors, again see prodD for a full discussion. More...
 
void progress (std::uint64_t i, bool quiet, std::string s="", bool use_error=true)
 Outputs a single character to std::cerr unless quiet. More...
 
template<Rank rank>
Tensor< rankproject (Tensor< rank > const &in, Basis const &b, Index leg, bool nowarn=false)
 Returns the tensor with its leg'th index projected onto the specified basis, i.e. all blocks not in that basis removed and those in it shrunk to match the size specified in the basis. More...
 
void projector (MPS::Lattice &lat, std::string sym)
 Adds two projectors onto the all-down and all-up subspaces for U(1) and no symmetries. More...
 
template<Rank rank, typename Scalar >
void prune_small_reim (DenseTensor< rank, Scalar > &)
 Removes real or imaginary parts if they are much smaller than the other one. More...
 
template<Rank rank, typename Scalar >
void prune_small_reim (DenseTensor< rank, std::complex< Scalar > > &a)
 Removes real or imaginary parts if they are much smaller than the other one. More...
 
template<typename Scalar >
void prune_small_rows (DenseTensor< 2, Scalar > &a)
 Removes elements small relative to the other elements of the row. More...
 
template<typename Scalar >
std::pair< DenseTensor< 2, Scalar >, double > pseudo_inverse_svd (DenseTensor< 2, Scalar > const &input)
 Takes a column-major input and pseudo-inverts it using a SVD. More...
 
template<typename Scalar >
std::pair< DenseTensor< 2, Scalar >, double > pseudo_inverse_svd_cm (DenseTensor< 2, Scalar > &&input_cm)
 Takes a column-major input and pseudo-inverts it using a SVD. More...
 
std::tuple< SRDef, Tensor< 2 > > pseudo_invert (Tensor< 2 > const &a)
 Calculates the SVD-based pseudo-inverse of the input matrix. More...
 
Index rank (DenseTensor< 2, std::complex< double > > &&a)
 Estimates the rank of a complex matrix A using QR with pivoting. More...
 
Index rank (DenseTensor< 2, std::complex< double > > const &a)
 Estimates the rank of a complex matrix A using QR with pivoting. More...
 
Index rank (DenseTensor< 2, double > &&a)
 Estimates the rank of a real matrix A using QR with pivoting. More...
 
Index rank (DenseTensor< 2, double > const &a)
 Estimates the rank of a real matrix A using QR with pivoting. More...
 
template<typename Scalar , Rank rank>
void read (std::istream &in, DenseTensor< rank, Scalar > &v)
 Reads an arbitrary-rank tensor as produced by write() More...
 
template<typename ScalarBase , Rank rank>
void readTabulatedCmplx (std::istream &in, DenseTensor< rank, std::complex< ScalarBase > > &t)
 Reads tabulated complex data into a pre-sized dense tensor. More...
 
template<typename Scalar , Rank rank>
void readTabulatedReal (std::istream &in, DenseTensor< rank, Scalar > &t)
 Reads tabulated real data into a pre-sized dense tensor. More...
 
template<typename T , typename std::enable_if<(is_number< T >::value &&std::is_same< T, typename ScalarBase< T >::type >::value), int >::type = 0>
constexpr T const & real (T const &x)
 Real part of non-complex types, returns the argument. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, typename ScalarBase< Scalar >::type > real (DenseTensor< rank, std::complex< Scalar > > const &in)
 Returns the real part of the complex dense tensor in More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > real (DenseTensor< rank, Scalar > const &in)
 Returns the real part of the real DynArray in More...
 
template<typename Scalar >
void regularise_abs (Scalar *first, Scalar *last, typename ScalarBase< typename IdentityType< Scalar >::type >::type threshold)
 Changes the absolute value of entries with very similar absolute values to the median of those. More...
 
template<typename ScalarBase >
void regularise_imag (std::complex< ScalarBase > *first, std::complex< ScalarBase > *last, ScalarBase threshold)
 Changes the imaginary part of entries with very similar absolute imaginary parts to the median of those. More...
 
template<typename ScalarBase >
void regularise_real (std::complex< ScalarBase > *first, std::complex< ScalarBase > *last, ScalarBase threshold)
 Changes the real part of entries with very similar absolute real parts to the median of those. More...
 
template<typename T >
std::string replace (std::string const &input, std::string const &start_delim, std::string const &end_delim, T func)
 Replaces occurences of delimited substrings by function return values. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > resize (DenseTensor< rank, Scalar > const &a, std::array< Index, rank > const &newDim, Ordinal which=Ordinal::First)
 Returns a resized dense tensor. More...
 
std::int64_t restrict (std::int64_t value, std::int64_t max)
 Restricts value into the range [0,max), mapping -1 to max-1. More...
 
template<typename T >
void save (T &t, std::string const &where)
 Save an object into a file. More...
 
template<typename T >
std::string save (T &t)
 Save an object into a temporary file. More...
 
template<typename ScalarA , typename ScalarB >
void scale (DynArray< ScalarA > &a, ScalarB const b)
 Scales all elements of a in-place by the scalar factor b. More...
 
template<typename Scalar >
void scale_columns_2norm (DenseTensor< 2, Scalar > &a, DenseTensor< 2, Scalar > &s)
 Scales the columns of a in-place to have 2-norm close to one. More...
 
template<typename IterFirst , typename IterLast >
IterFirst select_cutoff_jump (IterFirst beg, IterLast end, SRDef threshold=1e5)
 Returns an iterator to the first element after the first relative jump greater than threshold. More...
 
template<typename IterFirst , typename IterLast >
IterFirst select_cutoff_relative (IterFirst begin, IterLast end)
 Returns the first element which is smaller than the first element by a factor larger than SYTEN_SMALL_THRESHOLD. More...
 
template<typename T >
int serialise_configuration (T &ar, std::string const &file)
 Writes and reads configuration data from files, ensuring compatibility between the read file and the reading binary. More...
 
void setupLattice (std::map< std::string, std::pair< std::string, std::vector< MPS::Operator > > > &operators, Index const width, Index const length, std::string sym, bool const add_bond_operators, bool const add_partial_operators)
 Internal helper: Set up operators on lattice. More...
 
template<typename In >
bool shiftArgs (In &&, NoNew)
 Sequentially shift all arguments into a stream. More...
 
template<typename In , typename First >
bool shiftArgs (In &&in, First &&a)
 Sequentially shift all arguments into a stream. More...
 
template<typename In >
bool shiftArgs (In &&)
 Sequentially shift all arguments into a stream. More...
 
template<typename In , typename First , typename... Rest>
bool shiftArgs (In &&in, First &&a, Rest &&... b)
 Sequentially shift all arguments into a stream. More...
 
template<typename Out >
void shiftTime (Out &out, bool timeonly=false)
 Shift the date and time as well as the used cpu time so far into the stream. More...
 
SRDef singValSqdToError (SRDef const squared_singular_values, SRDef const norm)
 If squared_singular_values is the sum of the squares of the singular values discarded during a truncation step on a tensor of norm norm, this function returns the error between a normalised original state and a normalised version of the new state. More...
 
std::size_t smallest_multiple (std::size_t const factor, std::size_t const lower_bound)
 Returns the smallest multiple of factor that is at equal to or larger than lower_bound. More...
 
template<typename Scalar >
void sort_cols_sparsity (DenseTensor< 2, Scalar > &a, DenseTensor< 2, Scalar > &p)
 Sorts the columns of a in-place to have the sparsest columns first. More...
 
template<typename Scalar >
void sort_rows_infnorm (DenseTensor< 2, Scalar > &a, DenseTensor< 2, Scalar > &p)
 Sorts the rows of a in-place such that the row with the largest absolute value comes first, then the row with the second-largest absolute value etc. More...
 
std::vector< std::stringsplit (std::string const &in, std::string const &splitter)
 Splits a string into substrings at every occurence of 'splitter'. More...
 
std::vector< std::stringsplit (std::string_view const in, std::string const &splitter)
 Splits a string into substrings at every occurence of 'splitter'. More...
 
Tensor< 2 > sqrt (Tensor< 2 > inp)
 Returns the square root of the diagonal input matrix. More...
 
HighPrec sqrt (HighPrec const &)
 Square root of a HighPrec value. More...
 
void staggeredFields (Index site, MPS::Lattice &lat, std::map< std::string, std::pair< std::string, std::vector< MPS::Operator > > > &operators, std::string sym, std::string postfix, std::vector< Index > const &idx)
 Internal helper: Creates staggered magnetic fields. More...
 
std::string stripChars (std::string const &input, std::string const &to_remove=" /:")
 Returns the string input with all characters contained in to_remove removed. More...
 
std::string stripEnd (std::string const &a, std::string const &to_strip)
 Strips all occurences of to_strip from the end of a, if possible. More...
 
Basis sum (Basis const &b1, Basis const &b2)
 Returns the sum/union of two bases, i.e. the size of a sector in the returned basis is the maximum of the sizes in the two input bases. More...
 
template<typename Type , std::size_t rank>
Type sumProd (std::array< Type, rank > const &a, std::array< Type, rank > const &b)
 Scalar product between two arrays, could potentially be replaced by std::inner_prod. More...
 
template<Rank rank>
std::vector< std::vector< Index > > tensorSortBuckets (Tensor< rank > const &input, Index const leg)
 
template<Rank rank>
std::vector< std::vector< TensorBlock< rank > > > tensorSortBuckets (std::vector< TensorBlock< rank > > &&blocks)
 
template<Rank rank, Rank numMatches>
std::vector< std::pair< std::vector< RDef >, std::vector< Index > > > tensorSortBuckets (Tensor< rank > const &input, std::array< Rank, numMatches > const &matches)
 
template<typename Scalar >
Scalar trace (DenseTensor< 2, Scalar > const &a)
 \( \sum_k A_{kk} \) More...
 
SDef trace (Tensor< 2 > const &a)
 Calculates the trace of a rank-2 tensor. More...
 
template<typename Scalar >
Scalar trace (SparseTensor< 2, Scalar > const &a)
 Trace of a sparse matrix. More...
 
template<Rank rank>
void transpose (Tensor< rank > &m, std::array< int, 2 > const axes, bool const conjugate=false)
 Transposes the specified legs of the tensor. More...
 
template<Rank rank, typename Scalar >
void transpose (Scalar const *src, Scalar *out, int *perm, int *dim, bool conjugate=false)
 Multi-transpose implementation helper. More...
 
void transpose (Tensor< 2 > &m)
 Transpose a matrix in place. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > transpose (DenseTensor< rank, Scalar > const &a, std::array< int, 2 > const &axes, bool conjugate=false)
 Generic transpose. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > ::type transpose (DenseTensor< rank, Scalar > const &a)
 transposes the last two indices More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > transpose (SparseTensor< rank, Scalar > const &a, std::array< int, 2 > axes, bool conjugate=false)
 Transposes the two legs specified by axes of the sparse tensor a and conjugates each element if conjugate is true. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > ::type transpose (SparseTensor< rank, Scalar > const &a)
 Transposes the last two indices. More...
 
template<typename Type >
std::vector< SectortransV2S (Type &&v)
 Transforms an iterable of types implicitly convertible into Sector into a vector of sectors. More...
 
void truncate_add_operators (MPS::Lattice &lat, std::map< std::string, std::pair< std::string, std::vector< MPS::Operator > > > &operators)
 Internal helper: Truncate operators defined on the lattice. More...
 
template<typename Type >
bool uncachePair (Cached< Type > const &c)
 Convenience function for backwards-compatibility; do not use. More...
 
template<typename Scalar , typename ThresholdType >
bool underThreshold (Scalar const &x, ThresholdType const &threshold)
 Returns true if the argument is not over the threshold. More...
 
bool validateCGCContraction (SparseTensor< 2 > const &input)
 Returns true if input is proportional to the identity matrix. More...
 
template<Rank rank, typename Scalar >
bool validateCGCTensor (SparseTensor< rank, Scalar > const &a)
 CGC tensors are supposed to give the identity whenever contracted with themselves over all but one leg. More...
 
template<typename Base >
void validateTensorEdge (Base const &, Index const, Rank const, bool const =false)
 Validates that the supplied tensor is a valid edge tensor of a MPS or MPO. More...
 
template<typename Type >
Verbose< Type > verbose (Type const &t)
 Returns Verbose(t) for all t. More...
 
SRDef von_neumann_entropy (Tensor< 2 > const &s)
 Calculates the von Neumann entropy \( \sum_i s_{ii}^2 \mathrm{log}(s_{ii}^2) \). More...
 
template<typename Scalar >
std::vector< DenseTensor< 1, Scalar > > vsplit (DenseTensor< 2, Scalar > const &matrix)
 \( R[i]_j = in_{ij} \), vertically splits a matrix into row vectors More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > vstack (std::vector< DenseTensor< 1, Scalar > > const &list)
 \( R_{ij} = v[i]_j \), vertically stacks vectors into a matrix More...
 
template<typename Scalar , Rank rank>
void write (std::ostream &out, DenseTensor< rank, Scalar > const &t)
 Writes a arbitrary-rank dense tensor at the necessary precision to an output stream. More...
 
template<Rank rank>
void zeroExpand (Tensor< rank > &a, Index which, Basis const &basis, bool const relaxed=false)
 Zero-pads a tensor a along the specified leg which to contain the basis basis. More...
 
Tensor-Tensor-to-Tensor products.
template<Rank summed, Rank frank, Rank srank>
std::enable_if_t< frank+srank - 2 *summed !=0, Tensor< frank+srank - 2 *summed > > prod (Tensor< frank > const &a, Tensor< srank > const &b, std::string_view prodspec, Conj const conj=Conj::n(), EliminateZeros const ezeros=EliminateZeros::No, SourceLocation location=SourceLocation::current())
 Preferred form of the Tensor-Tensor-to-Tensor product. More...
 
template<Rank summed, Rank frank, Rank srank>
std::enable_if_t< frank+srank - 2 *summed !=0, Tensor< frank+srank - 2 *summed > > prod (Tensor< frank > const &a, Tensor< srank > const &b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, bool const conj=false, EliminateZeros const ezeros=EliminateZeros::No, SourceLocation location=SourceLocation::current())
 Legacy variant 1 of the Tensor-Tensor-to-Tensor product. More...
 
template<Rank summed, Rank frank, Rank srank>
std::enable_if_t< frank+srank - 2 *summed !=0, Tensor< frank+srank - 2 *summed > > prod (Tensor< frank > const &a, Tensor< srank > const &b, std::map< int, int > const &m_a, std::map< int, int > const &m_b, bool const conj=false, EliminateZeros const ezeros=EliminateZeros::No, SourceLocation location=SourceLocation::current())
 Legacy variant 2 of the Tensor-Tensor-to-Tensor product. More...
 
template<Rank summed, Rank frank, Rank srank>
std::enable_if_t< frank+srank - 2 *summed !=0, Tensor< frank+srank - 2 *summed > > prod (Tensor< frank > const &a, Tensor< srank > const &b, std::initializer_list< int > l_a, std::initializer_list< int > l_b, bool const conj=false, EliminateZeros const ezeros=EliminateZeros::No, SourceLocation location=SourceLocation::current())
 Legacy variant 3 of the Tensor-Tensor-to-Tensor product. More...
 
Tensor-Tensor-to-Scalar products.
template<Rank rank>
SDef prod (Tensor< rank > const &a, Tensor< rank > const &b, Conj const conj=Conj::y(), SourceLocation location=SourceLocation::current())
 Scalar product of two tensors. More...
 
template<Rank r>
SDef prod (Tensor< r > const &a, Tensor< r > const &b, std::string_view prodspec, Conj const conj=Conj::n(), SourceLocation location=SourceLocation::current())
 Scalar product of two tensors with reordering allowed. More...
 
Convenience functions defined for each block
SDef trace (TensorBlock< 2 > const &a)
 Calculates the trace of this block. More...
 
template<Rank rank>
SRDef abs (TensorBlock< rank > const &a)
 Gives some measure on the absolute value of the block. More...
 
template<Rank rank>
std::pair< std::size_t, SRDefavgAbs (TensorBlock< rank > const &a)
 Returns the average of the absolute values of the non-zero entries of the tensor block in a pair <num_entries, summed_value>. More...
 
template<Rank rank>
SRDef max (TensorBlock< rank > const &a)
 Returns the element with the greatest magnitude in the tensor block. More...
 
template<Rank rank>
std::ostreamoperator<< (std::ostream &out, TensorBlock< rank > const &t)
 Pretty output for a tensor block. More...
 
template<Rank rank>
SRDef absSqd (TensorBlock< rank > const &a)
 Squared version of abs as it is sometimes used in places. More...
 
Operators for scaling of TensorBlock and scalars
template<Rank rank>
TensorBlock< rank > & operator*= (TensorBlock< rank > &t, SDef const s)
 Multiplies each element of t by a scalar s More...
 
template<Rank rank>
TensorBlock< rankoperator* (TensorBlock< rank > const &t, SDef const s)
 Multiplies each element of t and s to return s t More...
 
template<Rank rank>
TensorBlock< rankoperator* (SDef const s, TensorBlock< rank > const &t)
 Multiplies each element of t and s to return s t More...
 
template<Rank rank>
TensorBlock< rank > & operator/= (TensorBlock< rank > &t, SDef const s)
 Divides each element of t by s More...
 
template<Rank rank>
TensorBlock< rankoperator/ (TensorBlock< rank > const &t, SDef const s)
 Divides each element of t by s to return 1/s t More...
 
loading facilities
void clearCache (std::string f)
 If non-empty, delete the corresponding file. More...
 
template<typename Type >
void load_archive (boost::archive::binary_iarchive &ar, Type &r, std::string const &file)
 Loads from the archive ar into the object r. More...
 
template<typename Type >
void loadFile (std::string file, bool const fromCache, Type &r)
 Loads an object of type Type from file into r. More...
 
template<typename Type >
Type loadFile (std::string file, bool const fromCache)
 Returns an object of type Type loaded from file. More...
 
template<typename Type >
void loadInputRef (std::string file, Type &r)
 Loads from an input file file into an object r without deleting the input file or discarding non-overwritten properties of r. More...
 
template<typename Type >
void loadCacheRef (std::string file, Type &r)
 Loads from a cache file file into an object r without discarding non-overwritten properties of r. More...
 
template<typename Type >
bool uncachePair (std::pair< Type, std::string > &c)
 If the string is non-empty, the object is loaded and stored in the Type. More...
 
template<typename Type >
bool cachePair (std::pair< Type, std::string > &c)
 If the string is empty, the type is serialised into a temporary filename, that filename is stored in the string. More...
 

Variables

static std::string cacheDir = "./"
 Cache directory to use for temporary objects, set via initCache(), used by cacheFilename() More...
 
constexpr int file_id_magic = 20150526 + 1
 magic number identitfying SYTEN files (date of first commit in recorded git history plus current version) More...
 
constexpr Index GroupMaxDegree = SYTEN_MAX_DEG
 The maximal number of labels currently allowed per irrep. More...
 
template<typename T >
constexpr bool is_number_v = is_number<T>::value
 Variable template for is_number. More...
 
bool issue_error_backtrace_immediate = false
 if true, issue the print_backtrace() call from within issue_error. More...
 
MemorySampler memory_sampler
 Defined in memory_sampler.cpp, static object which controls the worker to properly terminate it before the process exits. More...
 
int memory_sampler_interval = 10
 Time in milliseconds between measurements. More...
 
int memory_sampler_samples = 100
 Number of samples of which to take the average and maximum. More...
 
int stored_argc = 0
 Stored argc, used by onterminate() More...
 
char ** stored_argv = 0
 Stored argv, used by onterminate() More...
 
std::mutex warning_error_mtx
 Mutex protecting issue_warning() and issue_error() More...
 

Output manipulators. Implemented because libstdc++ doesn't have them yet.

NOut nout
 global NOut object (to be used as cout, eg) More...
 
constexpr OutFix outFix = OutFix()
 When shifted into an ostream str, changes the output formatting to fixed-point by calling str.setf(std::ios_base::fixed, std::ios_base::floatfield). More...
 
constexpr OutDef outDef = OutDef()
 When shifted into an ostream str, changes the output formatting to the default format by calling str.unsetf(std::ios_base::floatfield). More...
 
constexpr OutSci outSci = OutSci()
 When shifted into an ostream str, changes the output formatting to scientific by calling str.setf(std::ios_base::scientific, std::ios_base::floatfield). More...
 
constexpr OutHex outHex = OutHex()
 When shifted into an ostream str, changes the output formatting to hexadecimal by calling str.setf(std::ios_base::fixed | std::ios_base::scientific, std::ios_base::floatfield). More...
 
std::string concatArg (int argc, char **argv)
 Concatenate elements argv[1…argv-1] into a string separated by spaces. More...
 
std::ostreamgetOut (bool b)
 Returns std::cout if b is true, otherwise a dummy output stream. More...
 
std::ostreamgetErr (bool b)
 Returns std::cerr if b is true, otherwise a dummy output stream. More...
 
template<>
std::string describe_scalar_type< float > ()
 Specialisation of describe_scalar_type() for floats. More...
 
template<>
std::string describe_scalar_type< double > ()
 Specialisation of describe_scalar_type() for doubles. More...
 
template<>
std::string describe_scalar_type< std::complex< float > > ()
 Specialisation of describe_scalar_type() for complex floats. More...
 
template<>
std::string describe_scalar_type< std::complex< double > > ()
 Specialisation of describe_scalar_type() for complex doubles. More...
 
template<typename T >
std::string to_string_rd (T const &arg, int precision=3)
 Returns a string representation of the double-representation of the argument with the given precision applied. More...
 
template<typename T >
std::string to_string_def (T const &arg)
 Returns a string representation of the double-representation with default formatting. More...
 
template<typename T >
std::string to_string_def (std::complex< T > const &arg)
 Returns a string representation of the double-representation with default formatting. More...
 
template<typename T >
std::string to_string_real_def (T const &arg)
 Write the real part of the argument and the imaginary part only if it is nonzero with default formatting. More...
 
template<typename T >
std::string to_string_real (T const &arg, int precision=3)
 Write the real part of the argument and the imaginary part only if it is nonzero. More...
 
template<typename Int , typename std::enable_if< std::is_integral< Int >::value, int >::type = 0>
char to_letter (Int const value)
 Given an integral value i, returns the corresponding character from the range [A…Z] taking i%26 More...
 
template<typename Type >
Type to_lower (Type const &in)
 Applies tolower() to each element of the input and returns the output. More...
 
template<typename First , typename... Rest>
void read (std::istream &in, First const &f, Rest const &... r)
 Reads a series of values from the provided input stream. More...
 
template<typename First , typename... Rest>
void write (std::ostream &out, First const &f, Rest const &... r)
 Writes a series of values to the provided output stream. More...
 
template<typename T , typename std::enable_if< is_number< T >::value, int >::type = 0>
void write (std::ostream &out, T const &t)
 Writes a scalar value at the required precision to the specified stream. More...
 
template<typename T >
lexical_cast (std::string const &s)
 Casts the string s to type T, wrapper around boost::lexical_cast<> to silence GCC warning. More...
 
template<typename T >
lexical_cast (const char *const s, std::size_t const n)
 Casts the string [s,s+n] to type T, wrapper around boost::lexical_cast<> to silence GCC warning. More...
 
template<typename T , typename std::enable_if< is_number< T >::value, int >::type = 0>
void read (std::istream &in, T &x)
 Reads a non-complex scalar value from in and stores it in x More...
 
template<typename T >
void read (std::istream &in, std::complex< T > &x)
 Reads a complex scalar value from in and stores it in x More...
 
template<class T >
constexpr auto ostreamshiftable_imp (int) -> decltype(std::declval< std::ostream &>()<< std::declval< T >(), std::true_type
 Implementation helper for ostreamshiftable(). More...
 
template<class T >
constexpr auto ostreamshiftable_imp (...) -> std::false_type
 Implementation helper for ostreamshiftable(). More...
 
template<class T >
constexpr auto ostreamshiftable ()
 constexpr function which returns true if a T const& object is shiftable into a std::ostream&. More...
 

Detailed Description

The topmost namespace for this project.

All functions, namespaces, classes and variables must be defined in this namespace, with the exception of the main() function of each binary.

Typedef Documentation

◆ Array

template<typename T , std::size_t Sz>
using syten::Array = typedef ArrayImpl::Array<T, Sz>

A thin wrapper around std::array.

See ArrayImpl::Array for details.

◆ BondGrid

template<typename T >
using syten::BondGrid = typedef GridImpl::BondGrid<T>

See GridImpl::BondGrid for details.

◆ Bool

using syten::Bool = typedef std::uint8_t

Alternative boolean type to use to avoid std::vector<bool>shenanigans.

◆ CDef

using syten::CDef = typedef HighPrec

The scalar type used in CGC tensors, see also Scalar types.

CDef will support only real-only types (i.e., std::complex<CDef> will generically not work) and is assumed to have at least as many digits of precision as SRDef and a comparable range in orders of magnitude.

◆ Conj

using syten::Conj = typedef YesNo<struct _prod_conj>

Decides whether to complex-conjugate a given tensor; in tensor products: applies to the second tensor.

◆ ConstSpan

template<typename T >
using syten::ConstSpan = typedef SpanImpl::ConstSpan<T>

Range of constant elements.

See SpanImpl::ConstSpan for details.

◆ FullQR

using syten::FullQR = typedef YesNo<struct _fullqr>

Specifies whether we do a full QR (Yes) or a thin QR (No)

◆ Grid

template<typename T >
using syten::Grid = typedef GridImpl::Grid<T>

See GridImpl::Grid for details.

◆ HandleFermions

using syten::HandleFermions = typedef YesNo<struct _prod_handle_fermions>

Decides whether fermions are handled on the level of tensor-tensor products.

If yes, fermionic order is equated with tensor leg order.

◆ Index

using syten::Index = typedef std::uint32_t

The standard index type for tensors, see also Scalar types.

◆ MDef

using syten::MDef = typedef HighPrec

The scalar type used in rep representations (i.e. matrices), typically the same as CDef.

◆ MutSpan

template<typename T >
using syten::MutSpan = typedef SpanImpl::MutSpan<T>

Range of mutable elements.

See SpanImpl::ConstSpan for details.

◆ Rank

using syten::Rank = typedef std::size_t

Compile-time constants, also used for arrays and such, see also Scalar types.

◆ RDef

The scalar type used to label rep representations, see also Scalar types.

◆ RepLabel

Label of single irrep within a group.

◆ SDef

using syten::SDef = typedef SYTEN_SDEF_TYPE

The scalar type used in generic tensors, see also Scalar types.

◆ Sector

typedef LimVec<Rep, SYTEN_MAX_SYM, unsigned char> syten::Sector

Specification of a full sector, i.e. one irrep per symmetry used on e.g. a tensor leg.

◆ Size

using syten::Size = typedef std::size_t

The standard size type for flat arrays, consider this also for loop variables where appropriate, see also Scalar types.

◆ SRDef

using syten::SRDef = typedef SYTEN_SRDEF_TYPE

Real base of the scalar type used in generic tensors, useful for norms etc, see also Scalar types.

Additionally, it will be used for orders-of-magnitude comparisons.

◆ STensor

‘Smart’ tensor class.

Main features compared to the plain Tensor:

  • Hides the tensor rank behind a std::variant
  • attempts to implement the graded algebra needed for fermionic tensor networks. The fermionic ordering of legs does not have to coincide with the computational ordering.
  • Stores a complete, named SBasis for every leg. Information about zero blocks is not lost.

Incoming indices are bras, outgoing indices are kets. Rank-2 tensors can always be contracted with a single leg of any other (even) tensor as long as their outgoing leg comes fermionically first and their incoming leg comes fermionically second.

Remarks
Implemented in the STensorImpl namespace with all associated functions.

Enumeration Type Documentation

◆ DecompRescaleCGC

Whether or not to rescale the CGC spaces during an decomposition.

◆ DenseTensorType

enum syten::DenseTensorType : char
strong

Specific types of special dense tensors.

Enumerator
None 

Tensor is not special.

Identity 

Tensor is an identity as generated by makeIdentity.

EtherealIdentity 

Tensor is an identity with empty data structure.

◆ Direction

enum syten::Direction : char
strong

Direction of the leg from the view of the tensor it belongs to.

Enumerator
Inc 

Incoming leg.

Out 

Outgoing leg.

Invalid 

Invalid direction, usually just initialised.

Silent 

Silenced direction, not usable for computation, output only.

◆ EliminateZeros

enum syten::EliminateZeros
strong

Whether to eliminate zeros in tensor products.

Specifically, in each dense sub-block, it compares the element n_ij, calculated as

\( n_{ij} = \sum_k a_{ik} b_{kj} \)

against a threshold times the absolute values squared, i.e. if

\( n_{ij} < \epsilon \times \left(\sum_k |a_{ik}| |b_{ik}|\right) \)

then \( n_{ij} \) is set to zero.

◆ Fermionic

enum syten::Fermionic : char
strong

Speficiation when a particular label is fermionic.

This is only a rule under which condition an IREP with a given label is fermionic, i.e., here we only specify if a symmetry is never fermionic (such as for bosons), fermionic if the associated label is odd (particle number) or fermionic if the associated label is a half-integer (Sz).

◆ Group

enum syten::Group : char
strong

Implemented mathematical groups.

Group::Z is a special case insofar as the first of its two labels is used to label the actual Z/n, whereas the second label then denotes the irrep in that group.

◆ Init

enum syten::Init : char
strong

Specification whether we should use placement new after allocation.

Only relevant if Type is trivially constructible.

Enumerator
Yes 

Use placement new

No 

Only allocate, do not construct.

◆ IterativeExitReason

Exit reasons for iterative algorithms.

Enumerator
Converged 

the procedure finished as expected

MaxIterations 

the maximal number of iterations was achieved

MaxPossible 

further improvement impossible (e.g.

invariant subspaces)

InexactArithmetic 

Errors from inexact arithmetic became too large.

E_Input 

input is errorneous

E_InvalidMode 

requested mode of operation is invalid

E_InvalidSubMode 

requested sub-mode of operation is invalid

Uninitialised 

the object is not yet initialised

Custom 

some custom reason

◆ Ordinal

enum syten::Ordinal
strong

enum containing the first three ordinals

◆ ParallelKind

enum syten::ParallelKind
strong

enum containing return values of isParallel() calls

◆ Statistics

enum syten::Statistics
strong

enum containing different classes of statistics

◆ TruncationType

enum syten::TruncationType
strong

enum containing the type of truncation to employ in MPO truncation

Function Documentation

◆ abs() [1/4]

template<Rank rank>
SRDef syten::abs ( TensorBlock< rank > const &  a)
inline

Gives some measure on the absolute value of the block.

The only guarantees are:

  • A zero-block Z (at least one of the CGC spaces or the reduced tensor is zero in all entries) has abs(Z) == 0.
  • A tensor block I with all dimensions of the reduced tensor and all dimensions of the CGC spaces 1 and all entries 1 has abs(I) == 1.

References abs(), syten::TensorBlock< rank >::c, and syten::TensorBlock< rank >::m.

◆ abs() [2/4]

HighPrec syten::abs ( HighPrec const &  )

Absolute value of a HighPrec value.

◆ abs() [3/4]

template<Rank rank, typename Scalar >
ScalarBase<Scalar>::type syten::abs ( DenseTensor< rank, Scalar > const &  a)
inline

\( \sqrt{\sum_k A_k * \textrm{conj}(A_k)} = \sqrt{\textrm{absSqd(A)}} \), see absSqd()

References absSqd(), and sqrt().

Referenced by abs(), absSqd(), syten::MPS::DMRG::LBOWorker::adaptAlpha(), syten::MPS::DMRG::Worker::adaptAlpha(), syten::BTT::DMRG::Run::adaptAlpha(), addLog(), addScaled(), syten::MPS::apply_op_orthogonalise_fit(), avgAbs(), calc_expval(), checkedAddParallel(), closeThreshold(), syten::Delinearise::cols_only(), syten::Delinearise::compare_residual(), syten::MPS::DMRG::LBOWorker::converged(), syten::BTT::DMRG::Run::converged(), syten::IPEPS::FullUpdate::cost_function(), diagonal(), syten::IPEPS::dist(), dist(), syten::MPS::ParseOperator::distributeF(), syten::Krylov::Evolution::GreedyHeuristic< Solver >::do_recycle(), syten::Krylov::Evolution::ExtrapolatingHeuristic< Solver >::do_recycle(), syten::MPS::TEBD::doTEBD_parallel(), syten::MPS::TEBD::doTEBD_serial(), elem_abs(), syten::MPS::SwappableTEBD::exponentiate_and_multiply(), syten::MPS::SwappableTEBD::exponentiate_factor_mpo(), full_rank_ness(), syten::IPEPS::gauge_fix(), syten::MPS::RandomState::generateSampledState(), syten::MPS::Lat::Nil::genSpinLattice(), get_result(), getEigenvalue(), syten::EnvVars::init_env_vars(), max(), norm(), syten::MPS::norm(), normSqd(), syten::STensorImpl::normSqd(), syten::IPEPS::Horz2CTM::normSqd(), syten::IPEPS::Vert2CTM::normSqd(), syten::MPS::normSqd(), nz_abs(), syten::Krylov::ClassicImpl::Classic< Matrix, Vector, Solver, Ortho >::operator()(), syten::MPS::Operator::operator*=(), syten::SparseTensor< rank, Scalar >::operator+=(), syten::SparseTensor< rank, Scalar >::operator-=(), orthogonalise_run(), overThreshold(), partial_abs(), prodS(), prune_small_rows(), syten::SparseTensor< rank, Scalar >::regularise(), regularise_abs(), regularise_imag(), regularise_real(), syten::MPS::DMRG::LBOWorker::reportConvergence(), syten::MPS::DMRG::Worker::reportConvergence(), select_cutoff_jump(), select_cutoff_relative(), syten::Krylov::ClassicImpl::ExponentialSolver< Solver >::solveForConvergence(), syten::Krylov::ClassicImpl::EigenSolver< Solver >::solveForConvergence(), sort_rows_infnorm(), syten::Krylov::SolverPolicies::Exponential::sp_convergence(), syten::Krylov::SolverPolicies::Eigen::sp_convergence(), syten::Krylov::SolverPolicies::ExponentialFineOverlap::sp_wrapup(), syten::SVD::svd(), syten::Krylov::Evolution::Evolver< Solver >::trim_dt(), syten::MPS::State::truncateVariational(), syten::Krylov::Evolution::GreedyHeuristic< Solver >::virt_continue_evolution(), and syten::Krylov::Evolution::GreedyHeuristic< Solver >::virt_evolve().

+ Here is the caller graph for this function:

◆ abs() [4/4]

template<Rank rank, typename Scalar >
ScalarBase<Scalar>::type syten::abs ( SparseTensor< rank, Scalar > const &  a)
inline

norm of a sparse tensor, i.e. the 2-norm were the tensor reshaped into a vector

References absSqd(), and sqrt().

◆ absSqd() [1/3]

template<Rank rank, typename Scalar >
ScalarBase<Scalar>::type syten::absSqd ( DenseTensor< rank, Scalar > const &  a)
inline

\( \sum_k A_k * \textrm{conj}(A_k) \)

References syten::DenseTensorTypeData::data, syten::DenseTensor< rank, Scalar >::dim(), EtherealIdentity, Identity, rank(), real(), syten::DenseTensor< rank, Scalar >::special, SYTEN_ASSERT_MSG, and syten::DenseTensorTypeData::type.

Referenced by abs(), and normSqd().

+ Here is the caller graph for this function:

◆ absSqd() [2/3]

template<Rank rank>
SRDef syten::absSqd ( TensorBlock< rank > const &  a)
inline

Squared version of abs as it is sometimes used in places.

References abs().

◆ absSqd() [3/3]

template<Rank rank, typename Scalar , typename RetScalar = Scalar>
ScalarBase<RetScalar>::type syten::absSqd ( SparseTensor< rank, Scalar > const &  a)
inline

Squared norm of a sparse tensor, i.e. the squared 2-norm were the tensor reshaped into a vector.

◆ addLog() [1/4]

template<typename Iterator >
void syten::addLog ( Iterator  first,
Iterator  end 
)

Adds values in the range [first, end) using operator+=, the result is found in *first.

References abs(), dist(), std::distance(), syten::MPS::distance(), and SYTEN_ASSERT.

Referenced by addLog(), and truncate_add_operators().

+ Here is the caller graph for this function:

◆ addLog() [2/4]

template<typename Container >
void syten::addLog ( Container &  c)

Adds values contained in c into c[0].

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References addLog().

◆ addLog() [3/4]

template<typename Iterator , typename Function >
void syten::addLog ( Iterator  first,
Iterator  end,
Function &&  f,
std::size_t  threshold = 2,
std::size_t  avail_threads = 1 
)

Adds values in the range [first, end) using operator+=, the result is found in *first.

Whenever values of in a range larger than threshold have been summed, f is called on the result.

References abs(), addLog(), dist(), std::distance(), syten::MPS::distance(), std::max(), SYTEN_ASSERT, and syten::Caching::threshold.

◆ addLog() [4/4]

template<typename Container , typename Function >
void syten::addLog ( Container &  c,
Function &&  f,
std::size_t  threshold = 2,
std::size_t  avail_threads = 1 
)

Adds values contained in c into c[0], applying f whenever more than threshold terms have been summed.

References addLog(), split(), and syten::Caching::threshold.

◆ addScaled() [1/3]

template<typename Scalar >
void syten::addScaled ( DynArray< Scalar > &  a,
DynArray< Scalar > const &  b,
typename IdentityType< Scalar >::type const  factor 
)
inline

\( A_i \leftarrow A_i + f B_i \), adds b scaled by factor to a

References addScaled< double >(), addScaled< float >(), syten::DynArray< Type >::size(), and SYTEN_ASSERT.

Referenced by addScaled(), checkedAddParallel(), and syten::Pyten::init_stensor().

+ Here is the caller graph for this function:

◆ addScaled() [2/3]

template<Rank rank>
void syten::addScaled ( Tensor< rank > &  a,
Tensor< rank > const &  b,
SDef const  s 
)
inline

Adds the tensor b, scaled by the scalar prefactor s to the tensor a, essentially a fused-multiply-add for Tensor.

References syten::Tensor< rank >::push_back(), syten::Tensor< rank >::reduce(), syten::Tensor< rank >::reserve(), and syten::Tensor< rank >::size().

◆ addScaled() [3/3]

template<Rank rank, typename Scalar >
void syten::addScaled ( DenseTensor< rank, Scalar > &  a,
DenseTensor< rank, Scalar > const &  b,
typename IdentityType< Scalar >::type const  factor,
EliminateZeros const  ezeros 
)
inline

\( A_i \leftarrow A_i + f B_i \), adds b scaled by factor to a, if ezeros = EliminateZeros::Yes, eliminates resulting near-zeros.

References abs(), addScaled(), syten::DenseTensor< rank, Scalar >::dims, syten::DenseTensor< rank, Scalar >::get_data(), syten::DenseTensor< rank, Scalar >::size(), SYTEN_ASSERT, SYTEN_EZERO_THRESHOLD, and underThreshold().

◆ addScaled< double >()

template<>
void syten::addScaled< double > ( DynArray< double > &  a,
DynArray< double > const &  b,
double const  factor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References SYTEN_ASSERT.

Referenced by addScaled().

+ Here is the caller graph for this function:

◆ addScaled< float >()

template<>
void syten::addScaled< float > ( DynArray< float > &  a,
DynArray< float > const &  b,
float const  factor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References SYTEN_ASSERT.

Referenced by addScaled().

+ Here is the caller graph for this function:

◆ addScaled< std::complex< double > >()

template<>
void syten::addScaled< std::complex< double > > ( DynArray< std::complex< double > > &  a,
DynArray< std::complex< double > > const &  b,
std::complex< double > const  factor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References SYTEN_ASSERT.

◆ addScaled< std::complex< float > >()

template<>
void syten::addScaled< std::complex< float > > ( DynArray< std::complex< float > > &  a,
DynArray< std::complex< float > > const &  b,
std::complex< float > const  factor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References SYTEN_ASSERT.

◆ allSiteEntropy()

DenseTensor<2,SRDef> syten::allSiteEntropy ( MPS::State input,
Index const  width 
)

Calculates the two site entropy of a state on all sites i != j and single site entropy on all sites i == j Works identical to entropyTwoSite but reduces the overhead by storing and reusing some Tensors.

Parameters
inputMPS input state
widthIf width != 0 only entropy of sites on the same ring with supplied width is calculated
Returns
Array filled with one and two site entropies on sites i,j (symmetric)

merge the upper and lower indices together

References std::vector< T >::begin(), std::vector< T >::end(), std::endl(), entropy(), entropyOneSite(), entropyTwoSite(), syten::DenseEigensolver::DenseSymEigensolverBase< Scalar >::evectors, syten::Basis::flipped(), std::floor(), genFuse(), genSplit(), syten::Tensor< rank >::getBasis(), getErr(), getOut(), syten::MPS::State::leftnorm(), syten::MPS::State::lIdx, std::move(), syten::k_to_y::ordering(), syten::MPS::State::rIdx, syten::MPS::State::rightnorm(), std::scientific(), std::setprecision(), syten::MPS::State::size(), sum(), SYTEN_BPO_EXEC, SYTEN_BPO_INIT, and syten::MPS::State::uIdx.

◆ avgAbs() [1/4]

template<Rank rank>
std::pair<std::size_t, SRDef> syten::avgAbs ( TensorBlock< rank > const &  a)
inline

Returns the average of the absolute values of the non-zero entries of the tensor block in a pair <num_entries, summed_value>.

References avgAbs(), syten::TensorBlock< rank >::c, and syten::TensorBlock< rank >::m.

◆ avgAbs() [2/4]

template<Rank rank, typename Scalar >
std::pair<std::size_t, typename ScalarBase<Scalar>::type> syten::avgAbs ( DenseTensor< rank, Scalar > const &  a)
inline

Returns the sum of the absolute values and the number of non-zero entries in the tensor.

References abs(), std::make_pair(), nz_abs(), overThreshold(), and SYTEN_SMALL_THRESHOLD.

Referenced by avgAbs(), and print_avg_abs().

+ Here is the caller graph for this function:

◆ avgAbs() [3/4]

template<Rank rank>
SRDef syten::avgAbs ( Tensor< rank > const &  a)
inline

Returns the average of the absolute values of the non-zero entries in the tensor.

References std::accumulate(), avgAbs(), syten::Tensor< rank >::begin(), syten::Tensor< rank >::end(), and std::make_pair().

◆ avgAbs() [4/4]

template<Rank rank, typename Scalar >
std::pair<std::size_t, typename ScalarBase<Scalar>::type> syten::avgAbs ( SparseTensor< rank, Scalar > const &  a)
inline

Returns the sum of the absolute non-zero values and the total number of entries of the sparse tensor.

References abs(), std::make_pair(), and syten::SparseTensor< rank, Scalar >::size().

◆ btt_operator_basis()

void syten::btt_operator_basis ( BTT::Operator::Ptr  sptr,
BinaryTree::Tree< std::array< Index, 5 > >::Ptr  bptr 
)

Recursive helper to build a binary tree of bases information for BTT operators.

References syten::BinaryTree::Node< T >::a, syten::BinaryTree::Node< T >::b, syten::BTT::Operator::rIdx, and syten::BinaryTree::Node< T >::v.

Referenced by btt_operator_fbasis().

+ Here is the caller graph for this function:

◆ btt_operator_fbasis()

void syten::btt_operator_fbasis ( BTT::Operator::Ptr  sptr,
BinaryTree::Tree< Basis >::Ptr  bptr 
)

Recursive helper to build a binary tree of full bases information for BTT states.

References syten::BinaryTree::Node< T >::a, syten::BinaryTree::Node< T >::b, btt_operator_basis(), btt_state_basis(), btt_state_fbasis(), syten::BinaryTree::Node< T >::build_a(), syten::BinaryTree::Node< T >::build_b(), syten::MPS::LBOState::dIdx, entropy(), syten::Tensor< rank >::getAvgBlocksize(), syten::Tensor< rank >::getBasis(), syten::Tensor< rank >::getMaxBlocksize(), getOut(), syten::Tensor< rank >::getReducedDim(), syten::Tensor< rank >::getTotalDim(), syten::BTT::State::history, syten::MPS::LBOState::history, syten::MPS::State::history, std::left(), syten::MPS::LBOState::leftnorm(), syten::MPS::LBOState::lIdx, syten::MPS::State::lIdx, syten::MPS::Operator::lIdx, syten::MPS::LBOState::lInt, syten::MPS::State::lInt, loadInputRef(), syten::Test::log(), logGE(), logGI(), logO(), syten::MPS::LBOState::m(), max(), syten::MPS::State::maybeCache(), syten::BTT::parse(), syten::MPS::parse(), syten::BTT::State::pIdx, std::pow(), pow(), print_avg_abs(), syten::BinaryTree::Tree< T >::r, real(), syten::BTT::Operator::rIdx, syten::MPS::LBOState::rIdx, syten::BTT::State::rIdx, syten::MPS::State::rIdx, syten::MPS::Operator::rIdx, std::right(), syten::MPS::State::rightnorm(), syten::MPS::LBOState::rightnorm(), syten::MPS::LBOState::rInt, syten::MPS::State::rInt, std::scientific(), syten::MPS::State::setMaybeCache(), std::setprecision(), std::setw(), syten::Basis::silenced(), std::vector< T >::size(), syten::MPS::LBOState::size(), syten::MPS::State::size(), syten::Basis::size(), std::sort(), syten::SVD::svd(), SYTEN_BPO_EXEC, SYTEN_BPO_INIT, std::to_string(), syten::MPS::LBOState::uIdx, syten::BTT::Operator::uIdx, syten::MPS::State::uIdx, syten::MPS::Operator::uIdx, syten::MPS::LBOState::uInt, syten::MPS::State::uInt, syten::BinaryTree::Node< T >::v, syten::MPS::LBOState::v(), and verbose().

◆ btt_state_basis()

void syten::btt_state_basis ( BTT::State::Ptr  sptr,
BinaryTree::Tree< std::array< Index, 5 > >::Ptr  bptr 
)

Recursive helper to build a binary tree of bases information for BTT states.

References syten::BinaryTree::Node< T >::a, syten::BinaryTree::Node< T >::b, syten::BTT::State::rIdx, uncachePair(), and syten::BinaryTree::Node< T >::v.

Referenced by btt_operator_fbasis().

+ Here is the caller graph for this function:

◆ btt_state_fbasis()

void syten::btt_state_fbasis ( BTT::State::Ptr  sptr,
BinaryTree::Tree< Basis >::Ptr  bptr 
)

Recursive helper to build a binary tree of full bases information for BTT states.

References syten::BinaryTree::Node< T >::a, syten::BinaryTree::Node< T >::b, syten::BinaryTree::Node< T >::build_a(), syten::BinaryTree::Node< T >::build_b(), syten::BTT::State::rIdx, std::sort(), uncachePair(), and syten::BinaryTree::Node< T >::v.

Referenced by btt_operator_fbasis().

+ Here is the caller graph for this function:

◆ build_hopping()

MPS::Operator syten::build_hopping ( MPS::Lattice const &  lat,
std::string const &  sym,
Index const  first,
Index const  second 
)

Returns the MPO rep of the (non-hermitian/‘half’) hopping term c^\dagger_first \cdot c_second.

References syten::BTT::dot(), and syten::MPS::Lattice::get().

Referenced by create_dg_kinetic_term(), create_sq_inter_ring_kinetic_term(), and create_sq_intra_ring_kinetic_term().

+ Here is the caller graph for this function:

◆ cacheFilename()

std::string syten::cacheFilename ( std::string const &  f)

Given a string f, return the temporary cache filename, i.e. cacheDir + "/" + f

Referenced by clearCache(), loadFile(), and save().

+ Here is the caller graph for this function:

◆ cachePair() [1/2]

template<typename Type >
bool syten::cachePair ( Cached< Type > const &  c)
inline

Convenience function for backwards-compatibility; do not use.

Deprecated:

References BOOST_CLASS_TEMPLATE_VERSION, and syten::Cached< Type >::cache().

Referenced by syten::MPS::TDVP::Worker::calcContrL(), syten::MPS::TDVP::Worker::calcContrR(), syten::MPS::DMRG::LBOWorker::LBOWorker(), syten::BTT::DMRG::Run::load_node(), syten::BTT::DMRG::Run::save_node(), and syten::MPS::DMRG::LBOWorker::singleUpdate().

+ Here is the caller graph for this function:

◆ cachePair() [2/2]

template<typename Type >
bool syten::cachePair ( std::pair< Type, std::string > &  c)

If the string is empty, the type is serialised into a temporary filename, that filename is stored in the string.

If the string is non-empty, returns immediately.

Parameters
cpair to cache
Returns
true if the object was stored on disk, false otherwise

◆ calc_expval()

template<typename Lattice , typename State >
std::string syten::calc_expval ( Lattice const &  lat,
State &&  a,
State &&  b,
SDef const &  norm,
std::string const &  op_expr,
int const  variance,
bool const  column,
bool const  realOnly,
bool const  imagOnly,
Index const  prec 
)

Calculates an expectation value and possibly a variance for given states, lattices and operators.

Returns a string expression for the result without newline termination.

Template Parameters
LatticeLattice type, usually either MPS::Lattice or BTT::Lattice
StateState type, usually either MPS::State or BTT::State
Parameters
latlattice on which the operator is defined
afirst state (complex-conjugated)
bsecond state (not complex-conjugated)
normOverlap of a and b or norm of a, result will be divided by this
op_exproperator expression, parsed with respect to lat
variance0: no variance calculation, 1: extended output (expectation value and variance), 2: only variance
columnif true, prints real and imaginary part separated by some whitespace (overwrites realOnly and columnOnly)
realOnlyif true, only prints real part
imagOnlyif true, only prints imaginary part
precoutput precision
Returns
a string with the result, suitable for directly printing to std::cout or in a file, without trailing newline.

References abs(), syten::BTT::expectation(), norm(), syten::BTT::parse(), and print_result().

Referenced by do_expval().

+ Here is the caller graph for this function:

◆ change_type()

template<typename NewScalar , Rank rank, typename OldScalar >
DenseTensor<rank, NewScalar> syten::change_type ( DenseTensor< rank, OldScalar > const &  in)
inline

◆ checkedAddParallel()

template<Rank rank>
bool syten::checkedAddParallel ( TensorBlock< rank > &  a,
TensorBlock< rank > &  b,
EliminateZeros const  ezeros = EliminateZeros::Yes,
bool  add_cgc = false,
bool  no_zero_check_dense = false 
)
inline

Checks if a and b can be combined additively into a single block.

This is possible if either all CGC spaces are parallel or all but one CGC spaces are parallel and the reduced tensors are parallel.

In the former case, the reduced tensors will be added element-wise (after scaling to make the CGC spaces identical), in the latter case the non-parallel CGC space will be added elementwise (after scaling). That is, if we have:

\[ m_a \otimes c_{a_1} \otimes c_{a_2} + m_b \otimes c_{b_1} \otimes c_{b_2} \]

and \( c_{b_1} = f_{c_1} c_{a_1} \) and \( c_{b_2} = f_{c_2} c_{a_2} \) , with \( f_x \) scalar and real, we can instead write:

\[ \left[m_a + \left(m_b f_{c_1} f_{c_2}\right)\right] \otimes c_{a_1} \otimes c_{a_2} . \]

Similarly, if say \( m_b = f_m m_a \) and \( c_{b_2} = f_{c_2} c_{a_2} \) , we have

\[ m_a \otimes \left[c_{a_1} + \left(c_{b_1} f_m f_{c_2}\right)\right] \otimes c_{a_2} . \]

If more than one of the tensors are non-parallel, returns false. If the above rewriting can be done, it is done with the result in a, b set to zero and a return value of true.

Remarks
In principle, \( f_x \) complex would not hurt. However, our CGC spaces are purely real at the moment, meaning that if we had a complex factor from the reduced tensors and then moved it into the CGC space, that CGC space would become complex as well. Bad.
We currently do not consider reduced tensors to be parallel, as this would introduce Scalars into the CGC spaces for rescaling, getting the nice multiprecision things in there all dirty. This can be overwritten by setting add_cgc to true, but it is likely really not advisable.
The EliminateZeros option is passed through to add_scaled.

References abs(), addScaled(), syten::TensorBlock< rank >::c, closeThreshold(), syten::TensorBlock< rank >::eqTrans(), isParallel(), isZero(), syten::TensorBlock< rank >::isZero, syten::TensorBlock< rank >::m, std::move(), normSqd(), real(), sqrt(), SYTEN_ASSERT, SYTEN_ASSERT_DEBUG, and SYTEN_SMALL_THRESHOLD.

Referenced by syten::Tensor< 6 >::add(), and syten::Tensor< 6 >::reduce().

+ Here is the caller graph for this function:

◆ clear()

template<typename... Args>
void syten::clear ( Args &&...  args)

Calls .clear() on all supplied arguments.

Referenced by syten::IPEPS::State::buildRMVDL(), syten::MPS::State::leftnorm(), syten::Basis::load(), syten::IPEPS::Vert2CTM::normSqd(), syten::SparseTensor< rank, Scalar >::operator*=(), syten::Tensor< 6 >::reduce(), and syten::MPS::State::rightnorm().

+ Here is the caller graph for this function:

◆ clearCache()

void syten::clearCache ( std::string  f)

If non-empty, delete the corresponding file.

References cacheFilename(), std::string::empty(), and std::remove().

Referenced by syten::Cached< syten::Tensor< 4 > >::Cached(), syten::AsyncCached< std::vector< syten::Tensor< 2 > > >::delete_file(), syten::Cached< syten::Tensor< 4 > >::load(), syten::Cached< syten::Tensor< 4 > >::operator=(), and syten::Cached< syten::Tensor< 4 > >::~Cached().

+ Here is the caller graph for this function:

◆ clip() [1/2]

template<Rank rank>
Tensor<rank> syten::clip ( Tensor< rank in,
SRDef  t 
)

Clips all elements of the dense tensor blocks below the given threshold to zero; useful for displaying purposes.

References clip().

◆ clip() [2/2]

template<Rank rank, typename Scalar >
DenseTensor<rank, Scalar> syten::clip ( DenseTensor< rank, Scalar >  in,
typename ScalarBase< Scalar >::type  t 
)

Clips all elements of the dense tensor below the given threshold to zero.

References underThreshold().

Referenced by clip().

+ Here is the caller graph for this function:

◆ closest_power_two()

template<typename T >
constexpr T syten::closest_power_two ( T const &  in)
inline

Returns an power-of-two approximation to in

References pow().

Referenced by syten::MPS::equiscale(), and scale_columns_2norm().

+ Here is the caller graph for this function:

◆ closeThreshold()

template<typename Scalar , typename ThresholdType , typename std::enable_if< std::is_same< Scalar, typename ScalarBase< Scalar >::type >::value, int >::type = 0>
bool syten::closeThreshold ( Scalar const &  x,
typename IdentityType< Scalar >::type const &  y,
ThresholdType const &  threshold 
)

Returns true if the two arguments are within threshold distance to each other relative to their magnitude.

Returns true if the two arguments are within threshold distance to each other relative to their magnitude (std::complex<> specialisation).

Using the standard formulation from reals would call abs(), which requires sqrt(), the latter being rather expensive on Boost multiprecision scalars.

References abs(), conj(), real(), and syten::Caching::threshold.

Referenced by syten::IPEPS::FullUpdate::apply_op(), checkedAddParallel(), syten::Krylov::Evolution::Conf::Conf(), entropy(), syten::Krylov::Evolution::Evolver< Solver >::evolve(), syten::MPS::SwappableTEBD::exponentiate_factor_mpo(), syten::Krylov::Evolution::Evolver< Solver >::loop_evolve(), syten::Krylov::ClassicImpl::OrthoMat< Lanczos >::newOverlapsOK(), operator==(), syten::SparseTensor< rank, Scalar >::operator==(), syten::Delinearise::postprocess_coefficient(), syten::SparseTensor< rank, Scalar >::regularise(), regularise_abs(), regularise_imag(), regularise_real(), syten::Krylov::Evolution::run_evolution(), syten::Krylov::ClassicImpl::ExponentialSolver< Solver >::solveForConvergence(), syten::Krylov::SolverPolicies::Exponential::sp_convergence(), syten::Krylov::SolverPolicies::Exponential::sp_result(), and validateCGCContraction().

+ Here is the caller graph for this function:

◆ combineBasisExpansion()

Basis syten::combineBasisExpansion ( Basis const &  a,
Basis const &  b 
)

Given two bases a and b, returns a combined basis a + b considering symmetries: Sectors s occuring in both bases have size a[s]+b[s], sectors only occuring in one basis keep their size.

References syten::Basis::add(), syten::Basis::dir, syten::Basis::elementSize(), syten::Basis::hasSymmetry(), syten::Basis::size(), and SYTEN_ASSERT_DEBUG.

Referenced by expansion(), and syten::Basis::load().

+ Here is the caller graph for this function:

◆ compat_exact_equal()

template<Rank rank>
bool syten::compat_exact_equal ( Tensor< rank > const &  a,
Tensor< rank > const &  b 
)
inline

Returns true if both tensors are compatible on every leg and their difference has norm zero.

References syten::Tensor< rank >::getBasisMap(), normSqd(), and rank().

Referenced by syten::MPS::dot(), and syten::MPS::Operator::operator*=().

+ Here is the caller graph for this function:

◆ concatArg()

std::string syten::concatArg ( int  argc,
char **  argv 
)

Concatenate elements argv[1…argv-1] into a string separated by spaces.

Parameters
argcnumber of elements in argv
argvarray of arrays if characters

References operator<<(), std::ostream::setf(), std::stringstream::str(), and std::ostream::unsetf().

Referenced by do_apply_op(), onterminate(), orthogonalise_run(), syten::MPS::TDVP::Worker::run(), syten::MPS::DMRG::LBOPDMRG::saveState(), syten::MPS::DMRG::PDMRG::saveState(), syten::BTT::DMRG::Run::saveState(), and to_string_real().

+ Here is the caller graph for this function:

◆ conj() [1/3]

template<typename T , typename std::enable_if<(is_number< T >::value &&std::is_same< T, typename ScalarBase< T >::type >::value), int >::type = 0>
constexpr T const& syten::conj ( T const &  x)
inline

Complex conjugate of non-complex types, returns the argument.

◆ conj() [2/3]

template<Rank rank>
Tensor<rank> syten::conj ( Tensor< rank in)
inline

Complex-conjugates the tensor, inverting tensor directions and complex-conjugating all dense tensors.

References diagonal(), syten::Tensor< rank >::dirs, invertDiagonal(), sqrt(), trace(), and von_neumann_entropy().

◆ conj() [3/3]

template<Rank rank, typename Scalar >
DenseTensor<rank, Scalar> syten::conj ( DenseTensor< rank, Scalar > const &  a)

Returns the element-wise complex-conjugate of a

References syten::DenseTensor< rank, Scalar >::getDims(), No, and syten::DenseTensor< rank, Scalar >::size().

Referenced by syten::SparseTensor< rank, Scalar >::absSqd(), syten::MPS::apply_op_orthogonalise_fit(), syten::IPEPS::State::buildRMVDL(), closeThreshold(), syten::DenseTensor< 1, typename syten::ScalarBase< Scalar >::type >::conjugate(), syten::DenseProduct::dot(), eigenDavidson(), syten::Eigen::eigenGen(), syten::Krylov::ClassicImpl::OrthoMat< Lanczos >::fhf(), syten::Krylov::TensorNetworksImpl::HEffDenseExpectation::H_eff(), syten::DenseProduct::impl(), syten::DenseProduct::impl< 1 >(), syten::Pyten::init_stensor(), syten::Pyten::init_tensor(), insertSwap(), syten::Krylov::ClassicImpl::OrthoMat< Lanczos >::mat(), multi_transpose(), syten::Krylov::ClassicImpl::OrthoMat< Lanczos >::newOverlapsOK(), syten::DenseProduct::one_times_many(), syten::DenseProduct::one_times_one(), syten::Krylov::ClassicImpl::OrthoMat< Lanczos >::operator()(), orthogonalise_solve_svd(), syten::MPS::orthogonalise_variational(), syten::MPS::orthogonalise_variational_two_site(), overThreshold(), prod(), syten::TensorProd::prod_impl(), prodS(), scale_columns_2norm(), syten::Krylov::ClassicImpl::ExponentialSolver< Solver >::solveForConvergence(), syten::Krylov::ClassicImpl::EigenSolver< Solver >::solveForConvergence(), syten::MPS::DMRG::Worker::solveLocal(), syten::MPS::DMRG::Worker::solveLocalTwoSite(), syten::Krylov::SolverPolicies::Exponential::sp_convergence(), syten::Krylov::SolverPolicies::Eigen::sp_convergence(), syten::Krylov::SolverPolicies::Eigen::sp_result(), and transpose().

+ Here is the caller graph for this function:

◆ construct_product_targer_order_a()

template<Rank contracted, Rank rank>
std::array<Index, rank> syten::construct_product_targer_order_a ( std::array< int, rank > const &  c_a)

Given a product specifier c_a, constructs a "target order" where each leg fermionically should be such as to not induce further swaps during the product for the A-tensor.

This order can then be fed into perm_to_change_fermionic_order as the "target order" to which in turn generates a permutation. The permutation goes into is_perm_fermionic() to decide, for one specific block, if a minus sign is generated.

References std::array< T >::begin(), std::distance(), std::array< T >::end(), std::find(), rank(), std::sort(), and SYTEN_ASSERT.

◆ construct_product_targer_order_b()

template<Rank contracted, Rank rank>
std::array<Index, rank> syten::construct_product_targer_order_b ( std::array< int, rank > const &  c_b)

Given a product specifier c_b, constructs a "target order" where each leg fermionically should be such as to not induce further swaps during the product for the B-tensor.

This order can then be fed into perm_to_change_fermionic_order as the "target order" to which in turn generates a permutation. The permutation goes into is_perm_fermionic() to decide, for one specific block, if a minus sign is generated.

References std::distance(), std::find(), rank(), std::sort(), and SYTEN_ASSERT.

◆ correct_cgc_tensors()

template<Rank r>
void syten::correct_cgc_tensors ( Tensor< r > &  in,
bool  recursive = false,
SourceLocation  loc = SourceLocation::current() 
)

Corrects the CGC space by reconstructing it from a fusion tree.

This function iteratively merges legs of the tensor together until it is reduced to a rank-2 tensor. The rank-2 tensor has a well-defined CGC space proportional to the identity matrix. The elements of the CGC block are equalised and the tensor legs un-merged until the original tensor is obtained.

Parameters
in[in,out] Tensor to be corrected. Needs to have at least one incoming leg and one outgoing leg.
recursiveSet to true on recursive calls from within the function
locCallsite identifier

References syten::Tensor< rank >::b(), std::vector< T >::begin(), syten::Tensor< rank >::clear(), syten::Tensor< rank >::dirs, std::vector< T >::end(), syten::Basis::f(), syten::Tensor< rank >::getTotalDim(), gME(), syten::Tensor< rank >::hasCGC(), Inc, insertIOFullHalf(), logGW(), Out, std::vector< T >::push_back(), std::vector< T >::size(), syten::Tensor< rank >::size(), std::sort(), and SYTEN_ASSERT_MSG.

Referenced by syten::IPEPS::grow_bottom_rung(), syten::IPEPS::grow_left_rung(), syten::IPEPS::grow_right_rung(), syten::IPEPS::grow_top_rung(), syten::IPEPS::FullUpdate::horizontal(), syten::IPEPS::horz2_norm(), syten::Pyten::init_tensor(), syten::IPEPS::vert2_norm(), syten::IPEPS::vert2r_norm(), and syten::IPEPS::FullUpdate::vertical().

+ Here is the caller graph for this function:

◆ create_dg_kinetic_term()

void syten::create_dg_kinetic_term ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

Creates a kinetic term in the diagonal lattice lat.

References syten::MPS::Lattice::add(), build_hopping(), std::exp(), progress(), std::to_string(), and syten::MPS::Operator::truncate().

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ create_interaction_term()

void syten::create_interaction_term ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

Creates the interaction term in the lattice lat.

References syten::MPS::Lattice::add(), syten::BTT::dot(), genRepZ(), syten::MPS::Lattice::get(), progress(), std::to_string(), syten::MPS::Operator::truncate(), and syten::MPS::Lattice::vacSector.

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ create_ring_repulsion()

◆ create_rs_occ_operators()

void syten::create_rs_occ_operators ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

For every point of the lattice, creates a real-space occupation number operator to facilitate the calculation of real-space expectation values.

References syten::MPS::Lattice::add(), syten::BTT::dot(), std::exp(), genRepZ(), syten::MPS::Lattice::get(), progress(), std::to_string(), syten::MPS::Operator::truncate(), and syten::MPS::Lattice::vacSector.

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ create_rs_spin_operators()

void syten::create_rs_spin_operators ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

For every point of the lattice, creates a real-space spin operator to facilitate the calculation of real-space expectation values.

References progress(), and syten::MPS::Lattice::vacSector.

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ create_sq_inter_ring_kinetic_term()

void syten::create_sq_inter_ring_kinetic_term ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

Creates a length-wise kinetic term in the square lattice lat.

References syten::MPS::Lattice::add(), build_hopping(), progress(), std::to_string(), and syten::MPS::Operator::truncate().

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ create_sq_intra_ring_kinetic_term()

void syten::create_sq_intra_ring_kinetic_term ( MPS::Lattice lat,
std::string const &  sym,
Index const  length,
Index const  width,
bool const  bpo_quiet,
std::ostream out,
std::function< Index(int, int)>  coord,
std::function< Index(int)>  kfun,
std::vector< Index idx 
)

Creates a width-wise kinetic term in the square lattice lat.

References syten::MPS::Lattice::add(), build_hopping(), std::cos(), progress(), std::to_string(), and syten::MPS::Operator::truncate().

Referenced by create_ring_repulsion().

+ Here is the caller graph for this function:

◆ degree()

constexpr Index syten::degree ( Group const  g)

The degree of a specific group.

Referenced by syten::Rep::degree(), syten::RepRegister::reg(), and syten::Rep::Rep().

+ Here is the caller graph for this function:

◆ demangle_symbol()

std::tuple< std::string, std::string, std::string, std::string > syten::demangle_symbol ( const char *  symbol_name)

Returns a tuple <module, demangled_name, location, hexoffset>

References exec_get_cout(), std::string::find(), std::free(), std::hex(), std::make_tuple(), std::stoull(), std::string::substr(), and std::to_string().

Referenced by print_backtrace().

+ Here is the caller graph for this function:

◆ demangle_type()

std::string syten::demangle_type ( std::string_view const  mangled)

Given a type name as returned by e.g.

std::type_info::name(), attempts to return the demangled name. If demangling fails, the input name is returned.

Remarks
Small wrapper around boost::core::demangle.

Referenced by syten::Pyten::expose_syten_class().

+ Here is the caller graph for this function:

◆ describe_scalar_type()

template<typename T >
std::string syten::describe_scalar_type ( )

Template used to generate a std::string describing the type in question.

◆ describe_scalar_type< double >()

template<>
std::string syten::describe_scalar_type< double > ( )

Specialisation of describe_scalar_type() for doubles.

References std::to_string().

Referenced by read().

+ Here is the caller graph for this function:

◆ describe_scalar_type< float >()

template<>
std::string syten::describe_scalar_type< float > ( )

Specialisation of describe_scalar_type() for floats.

References std::to_string().

Referenced by read().

+ Here is the caller graph for this function:

◆ describe_scalar_type< HalfInteger< std::int16_t > >()

◆ describe_scalar_type< HalfInteger< std::int32_t > >()

◆ describe_scalar_type< HalfInteger< std::int64_t > >()

◆ describe_scalar_type< HighPrec >()

Specialisation of describe_scalar_type() for HighPrec values.

◆ describe_scalar_type< std::complex< double > >()

Specialisation of describe_scalar_type() for complex doubles.

References std::to_string().

◆ describe_scalar_type< std::complex< float > >()

Specialisation of describe_scalar_type() for complex floats.

References std::to_string().

◆ diagonal()

Vec< SDef > syten::diagonal ( Tensor< 2 > const &  m)

Returns a vector of diagonal values, repeated according to the multiplicities of the tensor blocks.

References abs(), std::vector< T >::begin(), std::vector< T >::end(), syten::IPEPS::mult(), std::vector< T >::push_back(), and std::sort().

Referenced by syten::IPEPS::cond_number(), conj(), create_ring_repulsion(), syten::IPEPS::horizontal_simple_update(), syten::Pyten::init_stensor(), syten::Pyten::init_tensor(), pseudo_invert(), syten::IPEPS::vertical_simple_update(), and syten::IPEPS::vertical_simple_update_remover().

+ Here is the caller graph for this function:

◆ dist() [1/3]

SRDef syten::dist ( Sector const &  s1,
Sector const &  s2 
)

Returns the distance between two sectors, i.e. the sum of the distances between constituent irreps.

References dist(), syten::LimVec< Type, max, MaxType >::size(), and SYTEN_ASSERT_DEBUG.

◆ dist() [2/3]

SRDef syten::dist ( Rep const &  r1,
Rep const &  r2 
)

Returns the distance between two representations, i.e. the absolute value of the sum of the differences in labels.

References abs(), syten::Rep::degree(), syten::Rep::label, and SYTEN_ASSERT_DEBUG.

Referenced by addLog(), dist(), genTrivialCGC(), syten::Basis::load(), min_dist(), and syten::MPS::SwappableTEBD::multiply_factors().

+ Here is the caller graph for this function:

◆ dist() [3/3]

SRDef syten::dist ( Basis const &  b1,
Sector const &  s2 
)

Returns the distance between a sector and a basis.

References dist().

◆ do_apply_op()

template<typename State , typename Operator , typename FunctionParse , typename FunctionRoot >
int syten::do_apply_op ( int  argc,
char **  argv,
std::string  inpFile,
std::string  oprDesc,
FunctionParse  parser,
FunctionRoot  root_node,
std::string  extension,
std::string  outFile,
std::string  funcDesc,
std::string  secDesc,
bool  bpo_cache,
SRDef  threshold,
SRDef  weight,
Index  maxBlocksize,
Index  maxStates,
bool  notrunc,
std::string  msg_state,
std::string  msg_op,
Index  fit_max_exp_sweeps,
Index  fit_max_opt_sweeps,
SRDef  fit_threshold 
)

◆ do_expval()

template<typename State , typename Lattice >
int syten::do_expval ( std::string const &  aFile,
std::string const &  bFile,
bool  bpo_cache,
std::string const &  oprDesc,
bool  variance,
bool  column,
bool  realOnly,
bool  imagOnly,
bool  no_normalise,
Index  precision,
std::string const &  templateFile,
std::string const &  templateStart,
std::string const &  templateEnd,
std::string const &  abbrev 
)

◆ dropDummy() [1/2]

template<typename Type , std::size_t rank>
template< typename Type, std::size_t rank > std::array< Type, rank-1 > syten::dropDummy ( std::array< Type, rank > const &  a,
std::size_t  position 
)

Copies a dropping the element at 1-indexed position position.

Parameters
ainput array
positionelement to drop out.
Returns
a new array with all elements copied except for the one at the specified 1-indexed position.

[2, 3, 4, 5], 2 → [2, 4, 5]

References rank(), and SYTEN_ASSERT_DEBUG.

◆ dropDummy() [2/2]

template<Rank rank, typename Scalar >
SparseTensor<rank-1, Scalar> ::type syten::dropDummy ( SparseTensor< rank, Scalar > const &  a,
Rank  position 
)
inline

Drops a one-dimensional dummy index at the specified position, i.e. for \( a \in [2, 3, 1] \), dropDummy(a, 3) = b` with \( b \in [2, 3] \).

References syten::SparseTensor< rank, Scalar >::dim(), syten::SparseTensor< rank, Scalar >::dims(), syten::SparseTensor< rank, Scalar >::isSingleton(), std::make_pair(), SYTEN_ASSERT_DEBUG, validateCGCContraction(), and syten::SparseTensor< rank, Scalar >::valSingleton().

◆ eigenDavidson()

template<typename Vector , typename Matrix >
IterativeExit syten::eigenDavidson ( Vector &&  vec,
Matrix const &  mat,
IterativeConfig const &  conf,
Vector &  evec 
)
inline

Davidson eigensolver, closely follows Davidson, JOURNAL OF COMPUTATIONAL PHYSICS 17, 87-94, (1975).

The idea to just leave off the preconditioner is taken from ITensor.

Start Step A

End Step A; End Step I

Start Step B

End Step B

Start Step C

End Step C

Step D intentionally left off

Start Step E

End Step E

Start Step F

End Step F

Start Step G

End Step G

Start Step H

End Step H

Start Step I (continue with next loop)

References std::vector< T >::back(), conj(), Converged, syten::DenseTensor< rank, Scalar >::dim(), E_Input, syten::IterativeExit::error, syten::IterativeConfig::errTolerance, syten::DenseEigensolver::DenseSymEigensolverBase< Scalar >::evalues, syten::DenseEigensolver::DenseSymEigensolverBase< Scalar >::evectors, InexactArithmetic, syten::IterativeConfig::inxTolerance, syten::IterativeExit::iter, syten::IterativeConfig::maxIter, MaxIterations, MaxPossible, syten::IterativeExit::message, syten::IterativeConfig::minIter, syten::IterativeConfig::mode, std::move(), norm(), overlap(), overThreshold(), std::vector< T >::push_back(), real(), syten::IterativeExit::reason, std::vector< T >::size(), SYTEN_ZNORM_THRESHOLD, to_string_rd(), underThreshold(), and syten::IterativeExit::value.

◆ elem_abs() [1/2]

template<Rank rank, typename Scalar , typename RetType = typename ScalarBase<Scalar>::type>
DenseTensor<rank, RetType> syten::elem_abs ( DenseTensor< rank, Scalar > const &  a)
inline

Returns a dense tensor of the real base type with each element equal to the absolute value of that element in a: \( r_{ij} = |a_{ij}| \).

Remarks
Would be better to put this into dense_convenience.h, but prodD needs it below.

References abs(), syten::DenseTensor< rank, Scalar >::getDims(), and syten::DenseTensor< rank, Scalar >::size().

Referenced by syten::Delinearise::cols_only().

+ Here is the caller graph for this function:

◆ elem_abs() [2/2]

template<Rank rank, typename Scalar , typename RetScalar = Scalar>
SparseTensor<rank, RetScalar> syten::elem_abs ( SparseTensor< rank, Scalar > const &  a)
inline

◆ eliminate_to_zero() [1/2]

template<typename Scalar , typename ThresholdType >
void syten::eliminate_to_zero ( Scalar &  n,
ThresholdType const &  t 
)
inline

Checks if n is over the threshold t · SYTEN_EZERO_THRESHOLD.

If yes, returns false. If not, sets n to 0 and returns true.

References SYTEN_EZERO_THRESHOLD, and underThreshold().

Referenced by prodD().

+ Here is the caller graph for this function:

◆ eliminate_to_zero() [2/2]

template<typename Scalar , typename ThresholdType >
void syten::eliminate_to_zero ( std::complex< Scalar > &  n,
ThresholdType const &  t 
)
inline

Checks if n is over the threshold t · SYTEN_EZERO_THRESHOLD.

If yes, returns false. If not, sets n to 0 and returns true.

References imag(), overThreshold(), real(), SYTEN_EZERO_THRESHOLD, and underThreshold().

◆ entropy()

SRDef syten::entropy ( Tensor< 2 >  densityMatrix)

Calculates the entropy of a density matrix.

Parameters
densityMatrixDensity matrix, Tensor<2>
Returns
Entropy of density matrix

References closeThreshold(), syten::DenseEigensolver::DenseSymEigensolverBase< Scalar >::evalues, kronaa(), std::log(), std::move(), overThreshold(), and SYTEN_SMALL_THRESHOLD.

Referenced by allSiteEntropy(), btt_operator_fbasis(), entropyOneSite(), and entropyTwoSite().

+ Here is the caller graph for this function:

◆ entropyOneSite()

SRDef syten::entropyOneSite ( MPS::State input,
Index const  site 
)

Calculates the single site entropy of a state.

Parameters
inputInput state.
siteSingle site for which the entropy shall be calculated.
Returns
Single site entropy.

References entropy(), syten::MPS::State::leftnorm(), syten::MPS::State::lIdx, syten::MPS::State::rIdx, syten::MPS::State::rightnorm(), syten::MPS::State::size(), and syten::MPS::State::uIdx.

Referenced by allSiteEntropy(), and entropyTwoSite().

+ Here is the caller graph for this function:

◆ entropyTwoSite()

SRDef syten::entropyTwoSite ( MPS::State input,
Index  site1,
Index  site2 
)

Calculates the two site entropy of a state.

Parameters
inputInput state.
site1First site of the subsystem for which the entropy shall be calculated.
site2Second site of the subsystem.
Returns
Entropy of the subsystem consisting of site1 and site2.

merge the upper and lower indices together

References entropy(), entropyOneSite(), genFuse(), genSplit(), syten::MPS::State::leftnorm(), syten::MPS::State::lIdx, syten::DenseProduct::merge(), syten::MPS::State::rIdx, syten::MPS::State::rightnorm(), syten::MPS::State::size(), sum(), std::swap(), and syten::MPS::State::uIdx.

Referenced by allSiteEntropy().

+ Here is the caller graph for this function:

◆ equalArrayInitList()

template<typename T , std::size_t rank>
bool syten::equalArrayInitList ( std::array< T, rank > const &  a,
std::array< T, rank > const &  b 
)

Compares two arrays, i.e.

forces an initializer list to be converted to an array.

Used for the implementation of dense products.

◆ exec_get_cout()

std::string syten::exec_get_cout ( std::string const &  command)

Executes the supplied command and writes the STDOUT from the command into the supplied string.

Returns only once the command returned.

References std::string::c_str(), std::shared_ptr::get(), std::string::size(), and std::string::substr().

Referenced by demangle_symbol().

+ Here is the caller graph for this function:

◆ expansion() [1/2]

template<Rank rank, typename Scalar >
DenseTensor<rank, Scalar> syten::expansion ( DenseTensor< rank, Scalar > const &  a,
DenseTensor< rank, Scalar > const &  b,
std::array< Index, rank > const &  w 
)
inline

Tensor-sums a and b together along the dimensions which have non-zero entries in which.

That is,

r_{i_1 i_2 i_3...} = [ a_{i_1 i_2 i_3...} if for all x in [1...rank] with w[x] != 0, i_x <= a.dim(x) b_{i_1-a.dim(1), i_2-a.dim(2), i_3 - a.dim(3)...} if for all x in [1...rank] with w[x] != 0, i_x > a.dim(x) 0 otherwise ]

if w[x] != 0, then r.dim(x) = a.dim(x) + b.dim(x)

if w[x] == 0, then r.dim(x) = a.dim(x) = b.dim(x)

e.g.:

a = [ 1 2 3 ] b = [ 7 8 9 ] expansion(a,b,{0,1}) = [ 1 2 3 7 8 9 ] [ 4 5 6 ] [ x y z ] [ 4 5 6 x y z ]

expansion(a,b,{1,0}) = [ 1 2 3 ] expansion(a,b,{1,1}) = [ 1 2 3 0 0 0 ] [ 4 5 6 ] [ 4 5 6 0 0 0 ] [ 7 8 9 ] [ 0 0 0 7 8 9 ] [ x y z ] [ 0 0 0 x y z ]

References syten::DenseTensor< rank, Scalar >::dim(), syten::DenseTensor< rank, Scalar >::getDims(), rank(), and SYTEN_ASSERT_DEBUG.

Referenced by syten::BTT::addScaled(), syten::MPS::addScaled(), syten::STensorImpl::expand(), syten::MPS::expand_to_left(), syten::MPS::expand_to_left_lbo(), syten::MPS::expand_to_right(), syten::MPS::expand_to_right_lbo(), syten::MPS::expand_to_top(), syten::Pyten::init_tensor(), syten::BTT::Operator::oper_add_rec(), syten::MPS::Operator::operator+=(), syten::MPS::State::operator+=(), syten::MPS::LBOState::operator+=(), syten::MPS::Operator::operator-=(), and syten::BTT::State::state_add_rec().

+ Here is the caller graph for this function:

◆ expansion() [2/2]

template<Rank rank>
Tensor<rank> syten::expansion ( Tensor< rank > const &  a,
Tensor< rank > const &  b,
ConstSpan< Index > const &  w 
)
inline

Combines the two tensors a and b into a new tensor.

For each leg i, if w[i] is positive, the two bases of a and b are combined, if it is zero, they are taken to be identical. See the relevant function for dense tensors for examples.

References combineBasisExpansion(), syten::Basis::compatible(), syten::Basis::dir, syten::Tensor< rank >::dirs, syten::Tensor< rank >::emplace_back(), syten::Tensor< rank >::getBasis(), std::vector< T >::push_back(), rank(), syten::Tensor< rank >::reserve(), resize(), syten::Tensor< rank >::size(), SYTEN_ASSERT, and SYTEN_ASSERT_DEBUG.

◆ exponentialTensorSym()

Tensor< 2 > syten::exponentialTensorSym ( Tensor< 2 > const &  in,
SDef const  prefactor,
Basis const &  full_basis = Basis() 
)

Builds the exponential \( e^{c A} \) of a hermitian rank-2 tensor \( A \) and a scalar prefactor \( c \).

The directions of the legs of the tensor are arbitrary, but you must ensure that the CGC space is proportional to the identity (i.e. one of the legs has to be incoming and the other has to be outgoing).

Explicitly diagonalises the dense tensor, hence this is only useful for small problems.

Remarks
Since \( e^0 \) is 1, but zero blocks are not stored in tensors explicitly, you should usually specify the 'full' basis of the input tensor, i.e. the basis in which you would like the exponential to live. Appropriately-sized identity blocks will then be added to the result.
Parameters
[in]intensor \( A \)
[in]prefactorscalar factor \( c \)
[in]full_basisthe full basis of the first tensor leg
Returns
exponential tensor \( e^{c A} \)

References syten::Basis::dir, syten::Tensor< rank >::dirs, std::exp(), syten::Tensor< rank >::getBasisMap(), hasCGC(), herm(), makeIdentity(), std::move(), std::vector< T >::push_back(), syten::Tensor< rank >::push_back(), syten::Basis::size(), SYTEN_ASSERT, SYTEN_ASSERT_MSG, and transpose().

Referenced by syten::MPS::TEBD::build_local_T(), syten::IPEPS::exp(), syten::STensorImpl::exp(), and syten::MPS::SwappableTEBD::exponentiate_rank6_tensor().

+ Here is the caller graph for this function:

◆ filterBasis()

Basis syten::filterBasis ( Basis const &  input,
Basis const &  site,
Basis const &  target,
Index const  remainingSites 
)

Returns a new basis which contains only elements from the input basis that are still compatible with the target basis, currently only works with Group::U1 and Group::SU2 symmetries.

References syten::Basis::dir, and syten::Basis::numSymmetries.

Referenced by syten::BTT::RandomState::generateCompleteState_rec(), and syten::Basis::load().

+ Here is the caller graph for this function:

◆ free_unused_memory()

std::array< std::size_t, 3 > syten::free_unused_memory ( )

Instructs MKL and glibc to free unused memory.

Returns
An array { total_rss_remaining, total_freed, mkl_freed } denoting the number of bytes still kept in memory (current RSS), those released back to the system and those released from MKL. The third parameter is always zero if MKL is not used.

References get_current_rss().

◆ full_rank_ness() [1/4]

double syten::full_rank_ness ( DenseTensor< 2, std::complex< double > > &&  a)

Estimates the full-rank-ness of a complex matrix A (compared to its smaller dimension) using QR with pivoting.

Does not perform row sorting or row pivoting. For optimal stability, you should do both, using scale_columns_2norm and sort_rows_infnorm.

Returns the ratio of largest to smallest (absolute-value-wise) diagonal element of R. A ratio of 1 indicates an identity matrix, a very large ratio a near-degenerate matrix and a value of inf a matrix not of full rank.

References abs(), syten::DynArray< Type >::begin(), syten::DynArray< Type >::end(), std::min(), syten::DynArray< Type >::size(), std::sort(), and SYTEN_MSG.

Referenced by full_rank_ness().

+ Here is the caller graph for this function:

◆ full_rank_ness() [2/4]

double syten::full_rank_ness ( DenseTensor< 2, std::complex< double > > const &  a)

Estimates the full-rank-ness (compared to its smaller dimension) of a complex matrix A using QR with pivoting.

Does not perform row sorting or row pivoting. For optimal stability, you should do both, using scale_columns_2norm and sort_rows_infnorm.

Returns the ratio of largest to smallest (absolute-value-wise) diagonal element of R. A ratio of 1 indicates an identity matrix, a very large ratio a near-degenerate matrix and a value of inf a matrix not of full rank.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References full_rank_ness(), and std::move().

◆ full_rank_ness() [3/4]

double syten::full_rank_ness ( DenseTensor< 2, double > &&  a)

Estimates the full-rank-ness of a real matrix A (compared to its smaller dimension) using QR with pivoting.

Does not perform row sorting or row pivoting. For optimal stability, you should do both, using scale_columns_2norm and sort_rows_infnorm.

Returns the ratio of largest to smallest (absolute-value-wise) diagonal element of R. A ratio of 1 indicates an identity matrix, a very large ratio a near-degenerate matrix and a value of inf a matrix not of full rank.

References abs(), syten::DynArray< Type >::begin(), syten::DynArray< Type >::end(), std::min(), syten::DynArray< Type >::size(), std::sort(), and SYTEN_MSG.

◆ full_rank_ness() [4/4]

double syten::full_rank_ness ( DenseTensor< 2, double > const &  a)

Estimates the full-rank-ness (compared to its smaller dimension) of a real matrix A using QR with pivoting.

Does not perform row sorting or row pivoting. For optimal stability, you should do both, using scale_columns_2norm and sort_rows_infnorm.

Returns the ratio of largest to smallest (absolute-value-wise) diagonal element of R. A ratio of 1 indicates an identity matrix, a very large ratio a near-degenerate matrix and a value of inf a matrix not of full rank.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References full_rank_ness(), and std::move().

◆ gen_vac()

Basis syten::gen_vac ( Basis  in)

Fuses in with in.adjoint() and removes every sector of the resulting basis which is not the vacuum.

References syten::Basis::add(), gM(), syten::Basis::isVacuum(), and SYTEN_ASSERT_MSG.

Referenced by syten::MPS::Lat::SU3::genSpinLattice(), syten::IPEPS::FullCTM::init_vac(), syten::IPEPS::ldot(), and syten::Basis::load().

+ Here is the caller graph for this function:

◆ genCombinator()

◆ genFuse()

Tensor< 3 > syten::genFuse ( Basis const &  unsorted_b1,
Basis const &  unsorted_b2,
Index  maxBlocksize = std::numeric_limitsIndex >::max(),
SRDef  ratio = 1.,
Index  minBlocksize = 1,
bool  ethereal = false 
)

Generates a fusing half-isometry map.

Takes two incoming bases b1 and b2 and maps onto a third basis product-decomposed outgoing basis b3:

–b1–→[ ] [ genFuse(b1,b2) ]–b3–→ –b2–→[ ]

References std::vector< T >::at(), std::array< T >::begin(), std::vector< T >::begin(), std::copy(), syten::Basis::dir, std::vector< T >::end(), Inc, kronVector(), std::make_pair(), syten::Basis::numSymmetries, Out, syten::RepRegister::Decomp::productDecomp(), std::vector< T >::push_back(), std::vector< T >::reserve(), std::vector< T >::size(), syten::Basis::size(), std::sort(), and SYTEN_ASSERT_MSG.

Referenced by allSiteEntropy(), syten::MPS::apply_op_itrunc(), syten::MPS::apply_op_naive(), syten::MPS::apply_op_orthogonalise_fit(), syten::BTT::apply_operator_directly_rec(), syten::BTT::apply_operator_itrunc_node(), syten::MPS::build_exchange_tensors_above(), syten::MPS::build_exchange_tensors_below(), syten::MPS::coarse_grain(), syten::MPS::dot(), syten::BTT::dot_rec(), entropyTwoSite(), syten::MPS::error_estimate_2svariance(), syten::MPS::DMRG::Worker::eval_observables(), syten::MPS::TDVP::Worker::evolveTwo(), syten::IPEPS::exp(), syten::MPS::DMRG::Worker::expand_to_left(), syten::MPS::expand_to_left(), syten::MPS::expand_to_left_lbo(), syten::MPS::expectation(), syten::BTT::expectation(), syten::MPS::SwappableTEBD::exponentiate_rank6_tensor(), syten::MPS::fine_grain(), syten::BTT::genBTTOCmp(), syten::BTT::genBTTOId(), syten::MPS::genMPOId(), syten::BTT::RandomState::genRandom(), syten::IPEPS::genRandomCompleteState(), syten::IPEPS::genRandomTensor(), genSplit(), genSwap(), gM(), syten::Pyten::init_tensor(), syten::IPEPS::FullCTM::init_vac(), syten::MPS::DMRG::LBOWorker::LBOWorker(), syten::IPEPS::lmult(), syten::MPS::TEBD::merge(), syten::MPS::mpo_cmp_prod(), syten::BTT::Operator::oper_mul_rec(), syten::MPS::right_complement(), syten::BTT::DMRG::Run::Run(), syten::MPS::DMRG::Worker::solveLocalTwoSite(), syten::MPS::TEBD::split(), syten::MPS::SwappableTEBD::split_rank6_into_mpos(), syten::MPS::split_rank_4_into_mps_lnorm(), syten::MPS::split_rank_4_into_mps_rnorm(), syten::MPS::DMRG::Worker::sweepLeftTwoSite(), syten::MPS::DMRG::Worker::sweepRightTwoSite(), syten::MPS::TDVP::Worker::Worker(), and syten::MPS::DMRG::Worker::Worker().

+ Here is the caller graph for this function:

◆ genIINode() [1/2]

Tensor< 2 > syten::genIINode ( Basis const &  b1,
Basis const &  b2 
)

Generates a node with two incoming bases b1 and b2.

A dummy trivially transforming vacuum basis is created to join the two incoming bases.

–b1–→[ ] [ genIINode(b1, b2) ] (– dummy vacuum basis –→) –b2–→[ ]

Remarks
To build a proper IONode from an IINode and an OONode, you a) need to connect the two adjointed legs (or the two unadjointed legs) and b) connect either the two first legs or the two second legs. That is, given an incoming basis b, you need to use:

auto i = genIINode(b); // first leg: b, second leg: ba auto i = genIINode(b, b.adjointed()); // equivalent to the above auto o = genOONode(b.flipped()); // first leg: bf, second leg: bfa auto o = genOONode(b.flipped(), b.flippedAdjointed()); // equivalent to the above auto io = prod<1>(i, o, {-1, 1}, {-2, 1}); // connect two second legs and two adjointed legs!

Remarks
Combinations which connect the first to the second leg will lead to wrong minus signs for \( \mathrm{SU}(2) \) symmetries, combinations which connect an adjointed to an unadjointed leg will lead to empty tensors for \( \mathrm{U}(1) \) and \( \mathbb{Z}_k \) symmetries.

References syten::Basis::dir, Inc, kronVector(), syten::Basis::numSymmetries, syten::RepRegister::Decomp::productDecomp(), and SYTEN_ASSERT.

Referenced by syten::MPS::build_exchange_tensors_above(), syten::MPS::build_exchange_tensors_below(), syten::MPS::TEBD::build_local_T(), syten::MPS::dot(), syten::BTT::dot_rec(), syten::STensorImpl::gen_ii(), genIINode(), genOONode(), syten::IPEPS::genRandomCompleteState(), syten::Pyten::init_tensor(), syten::IPEPS::FullCTM::init_vac(), insertIOFullHalf(), insertIOSplitHalf(), syten::MPS::left_complement(), syten::IPEPS::mult(), and syten::MPS::SwappableTEBD::split_rank6_into_mpos().

+ Here is the caller graph for this function:

◆ genIINode() [2/2]

Tensor< 2 > syten::genIINode ( Basis const &  b1)

Generates a node with two identical incoming bases b1.

See remark in genIINode() on the correct construction of IONode-equivalents from IINode and OONode tensors.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References syten::Basis::adjointed(), and genIINode().

◆ genIONode()

◆ genOONode() [1/2]

Tensor< 2 > syten::genOONode ( Basis const &  b1,
Basis const &  b2 
)

Generates a node with two outgoing bases b1 and b2.

A dummy trivially transforming vacuum basis is created to split the two outgoing bases.

←–b1–[ ] [ genOONode(b1, b2) ] (←– dummy vacuum basis –) ←–b2–[ ]

See remark in genIINode() on the correct construction of IONode-equivalents from IINode and OONode tensors.

References syten::Basis::dir, syten::Tensor< rank >::dirs, syten::Basis::flipped(), genIINode(), Out, and SYTEN_ASSERT.

Referenced by syten::MPS::build_exchange_tensors_above(), syten::MPS::build_exchange_tensors_below(), syten::MPS::TEBD::build_local_T(), syten::MPS::dot(), syten::BTT::dot_rec(), syten::STensorImpl::gen_oo(), genOONode(), syten::IPEPS::genRandomCompleteState(), syten::Pyten::init_tensor(), syten::IPEPS::FullCTM::init_vac(), insertIOFullHalf(), insertIOSplitHalf(), and syten::MPS::SwappableTEBD::split_rank6_into_mpos().

+ Here is the caller graph for this function:

◆ genOONode() [2/2]

Tensor< 2 > syten::genOONode ( Basis const &  b1)

Generates a node with two identical outgoing bases b1.

See remark in genIINode() on the correct construction of IONode-equivalents from IINode and OONode tensors.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References syten::Basis::adjointed(), and genOONode().

◆ genRandom() [1/2]

Tensor< 3 > syten::genRandom ( Basis const &  firstBasis,
Basis const &  secondBasis,
Index  maxBlockSize = 200,
Ordinal const &  resultIndex = Ordinal::Second 
)

Generates a random rank-3 tensor.

Parameters
firstBasisfirst basis of the tensor
secondBasissecond basis
maxBlockSizemaximal blocksize on the resulting product basis
resultIndexwhether the resulting product basis is first, second or third

Referenced by syten::MPS::DMRG::Worker::expand_to_left(), syten::MPS::DMRG::Worker::expand_to_right(), syten::MPS::RandomState::generateCompleteState(), syten::MPS::RandomState::generateNearVacuumState(), syten::IPEPS::genRandomTensor(), syten::Pyten::init_tensor(), syten::MPS::DMRG::Worker::solveLocal(), syten::MPS::DMRG::LBOWorker::solveLocalM(), syten::MPS::DMRG::Worker::solveLocalTwoSite(), and syten::MPS::DMRG::Worker::sync().

+ Here is the caller graph for this function:

◆ genRandom() [2/2]

Tensor< 3 > syten::genRandom ( Basis const &  firstBasis,
Basis const &  secondBasis,
Basis const &  thirdBasis,
bool const  not_random 
)

Generates a random rank-3 tensor where the product basis of firstBasis and secondBasis is projected onto thirdBasis

References std::array< T >::begin(), std::copy(), syten::Basis::dir, kronVector(), syten::Basis::numSymmetries, syten::RepRegister::Decomp::productDecomp(), and SYTEN_ASSERT_MSG.

◆ genRepNil()

Rep syten::genRepNil ( )

Generates the sole irrep of Group::Nil, the placeholder for no symmetries.

Referenced by syten::MPS::Lat::Nil::genBosonLattice(), syten::IPEPS::Lat::Nil::genSpinKagomeSquare(), syten::IPEPS::Lat::Nil::genSpinLattice(), and syten::MPS::Lat::Nil::genSpinLattice().

+ Here is the caller graph for this function:

◆ genReps()

std::vector< Rep > syten::genReps ( Index  number,
Rep const &  start 
)

Generate a specific number of unique irreps starting from the specified irrep.

Parameters
numbernumber of unique irreps to generate
startinitial irrep
Returns
a vector of unique irreps in the same physical symmetry group as start

Repeatedly product-decomposes the known irreps (starting from start) until number unique irreps have been generated.

References hasMember(), syten::RepRegister::Decomp::productDecomp(), std::vector< T >::push_back(), std::vector< T >::size(), and SYTEN_ASSERT.

Referenced by genRepsSU2(), and genRepsSU3().

+ Here is the caller graph for this function:

◆ genRepsSU2()

std::vector< Rep > syten::genRepsSU2 ( Index  number,
char  phys = 'S',
Fermionic  ferm = Fermionic::Never 
)

Generate a specific number of unique \( SU(2) \) irreps with the specified physical symmetry description.

Parameters
numbernumber of irreps to generate
physphysical symmetry description
fermfermionic spec for the to-be-generated IREP(s)
Returns
a vector of \( SU(2) \) irreps belonging to the specified physical symmetry description

References genReps(), and genRepSU2Fundamental().

Referenced by syten::IPEPS::Lat::SU2U1::genFermiHubbard(), syten::MPS::Lat::SU2U1Z::genFermiHubbardKNS(), syten::MPS::Lat::SU2U1::genFermiHubbardSpinCharge(), syten::MPS::Lat::SU2U1::genKondoModel(), syten::MPS::Lat::SU2::genSpinEdgeLattice(), syten::IPEPS::Lat::SU2::genSpinLattice(), and syten::MPS::Lat::SU2::genSpinLattice().

+ Here is the caller graph for this function:

◆ genRepsSU3()

std::vector< Rep > syten::genRepsSU3 ( Index  number,
char  phys = 'C',
Fermionic  ferm = Fermionic::Never 
)

Generate a specific number of unique \( SU(3) \) irreps with the specified physical symmetry description.

Parameters
numbernumber of irreps to generate
physphysical symmetry description
fermfermionic spec for the to-be-generated IREP(s)
Returns
a vector of \( SU(3) \) irreps belonging to the specified physical symmetry description

References genReps(), and genRepSU3Fundamental().

Referenced by syten::MPS::Lat::SU3::genSpinLattice().

+ Here is the caller graph for this function:

◆ genRepsU1()

std::vector< Rep > syten::genRepsU1 ( RDef  start,
Index  number = 0,
char  phys = 'c',
Fermionic  ferm = Fermionic::Never 
)

Generate a specific number of unique \( U(1) \) irreps with the specified physical symmetry description.

Parameters
startlabel of the first irrep. Suggested value is either \( -S_z\) if it is a spin symmetry or \( 0 \) if it is a charge symmetry.
numbernumber of irreps to generate. If number is 0 and start is negative, generate irreps [start, start+1, …, -start]. If number is 0 and start is 0 or greater, generate [start, start+1].
physphysical symmetry description
fermfermionic spec for the to-be-generated IREP(s)
Returns
a vector of \( U(1) \) irreps belonging to the specified physical symmetry description
Example
  • genRepsU1(-2.5, 0, "Sz") → [U(1)_Sz:[-2.5]@1, U(1)_Sz:[-1.5]@1, U(1)_Sz:[-0.5]@1, U(1)_Sz:[0.5]@1, U(1)_Sz:[1.5]@1, U(1)_Sz:[2.5]@1]
  • genRepsU1(0, 3, "N") → [U(1)_N:[0]@1, U(1)_N:[1]@1, U(1)_N:[2]@1]

References genRepU1().

Referenced by syten::MPS::Lat::U1::genBosonLattice(), syten::MPS::Lat::U1::genFermiLattice(), syten::IPEPS::Lat::U1::genFermiSpinless(), syten::IPEPS::Lat::U1::genSpinDisorder(), syten::MPS::Lat::U1::genSpinDisorderLattice(), syten::IPEPS::Lat::U1::genSpinKagomeSquare(), syten::IPEPS::Lat::U1::genSpinLattice(), syten::MPS::Lat::GCE::U1::genSpinLattice(), and syten::MPS::Lat::U1::genSpinLattice().

+ Here is the caller graph for this function:

◆ genRepSU2Fundamental()

Rep syten::genRepSU2Fundamental ( char  phys = 'S',
Fermionic  ferm = Fermionic::Never 
)

Generate the \( SU(2) \) fundamental irrep of the specified physical symmetry.

Parameters
physdescription of the physical symmetry
fermfermionic spec for the to-be-generated IREP(s)
Returns
the fundamental \( SU(2) \) irrep with the specified physical symmetry description

Referenced by syten::MPS::Lat::SU2U1Z::genFermiHubbardKNS(), syten::MPS::Lat::SU2U1::genFermiHubbardSpinCharge(), syten::MPS::Lat::SU2U1::genKondoModel(), genRepsSU2(), and syten::IPEPS::Lat::SU2::genSpinKagomeSquare().

+ Here is the caller graph for this function:

◆ genRepSU2Vacuum()

Rep syten::genRepSU2Vacuum ( char  phys = 'S',
Fermionic  ferm = Fermionic::Never 
)

Generate the \( SU(2) \) vacuum irrep of the specified physical symmetry.

Parameters
physdescription of the physical symmetry
fermfermionic spec for the to-be-generated IREP(s)
Returns
the vacuum \( SU(2) \) irrep with the specified