SyTen
syten Namespace Reference

Syten namespace. More...

Namespaces

namespace  ArrayImpl
 Implementation namespace for our Array.
 
namespace  BinaryTree
 Binary tree implementation.
 
namespace  Caching
 Only contains the Caching::threshold variable.
 
namespace  Cuda
 Support functions (memory allocation etc.) for CUDA-based GPUs.
 
namespace  CudaDenseTensorImpl
 Implementation namespace for CUDA dense tensors.
 
namespace  Delinearise
 Delinearisation decomposition.
 
namespace  DenseEigensolver
 Implementation of dense eigensolvers.
 
namespace  DenseImpl
 Namespace for helper functions for dense tensors.
 
namespace  DenseProduct
 Contains helper functions related to the product of two dense tensors, see syten::prodD() for the main entry point.
 
namespace  Deparallelise
 Deparallelisers.
 
namespace  DMRG
 General DMRG-related classes for both MPS and BTT.
 
namespace  Eigen
 Eigendecomposition.
 
namespace  EnvVars
 Namespace for generic static variables initialised from environment variables.
 
namespace  EternalMalloc
 Implementation namespace for le_malloc() and le_free()
 
namespace  Excp
 Namespace for exceptions otherwise polluting the global syten:: namespace.
 
namespace  Generators
 Generators namespace.
 
namespace  GenericDenseTensorImpl
 Implementation for the generic dense tensor.
 
namespace  GradientOpt
 Namespace for gradient-based optimisers.
 
namespace  IdentityDenseTensorImpl
 Implementation for identity dense tensors.
 
namespace  IPEPS
 IPEPS-related functionality and tools.
 
namespace  IPEPSv2
 Namespace for the second-generation iPEPS code (iPEPSv2).
 
namespace  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.
 
namespace  Krylov
 Krylov subspace methods.
 
namespace  Log
 Global variables for the logging subsystem.
 
namespace  LZ4
 Namespace for implementation of LZ4 Boost iostream filter.
 
namespace  MemoryUsage
 Memory usage reporting with allocSize(), totalSize() and stackSize()
 
namespace  mpi
 MPI related namespace.
 
namespace  MPS
 The namespace containing all MPS-related tools, classes and objects.
 
namespace  OffsetDenseTensorImpl
 Implementation for offset dense tensors.
 
namespace  Pyten
 Contains the initialisation functions for Python bindings.
 
namespace  QR
 QR Decompositions.
 
namespace  Random
 The random number generation engine generation subsystem.
 
namespace  RepRegister
 All representation-related registers.
 
namespace  Signals
 Signal catching support.
 
namespace  SpanImpl
 Implementation namespace for MutSpan and ConstSpan.
 
namespace  SQL
 Contains functions dealing with square lattices.
 
namespace  STensorImpl
 Contains all ‘smart’ tensor related classes and functions.
 
namespace  SVD
 Singular Value Decomposition.
 
namespace  T3N
 Namespace for T3N.
 
namespace  TensorBlocks
 Functions to sort the blocks of a tensor according to various criteria.
 
namespace  TensorProd
 Implementation helpers for tensor products.
 
namespace  Test
 Helper functions for executables in test/.
 
namespace  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  DenseIterDual
 Iterator over a dense tensor-like object with a secondary index running. More...
 
struct  DenseIterRestricted
 Restricted iterator. More...
 
struct  DenseTensor
 Dense tensor class. More...
 
class  DynArray
 "Light" version of std::vector that supports malloc() allocation. More...
 
struct  EternalAllocator
 STL-compatible allocator using le_malloc() More...
 
struct  Fmt
 Used by the logging infrastructure to indicate that the first argument is a format string and a newline should be added automatically. More...
 
struct  FmtNN
 Used by the logging infrastructure to indicate that the first argument is a format string and no newline should be added automatically. 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  InsertBase
 Helper class. More...
 
struct  InsertColumns
 Helper class, basically empty, useful if one wants to also implement InsertRows. More...
 
struct  InsertColumns< double >
 Specialisation. More...
 
struct  InsertColumns< float >
 Specialisation. More...
 
struct  InsertColumns< std::complex< double > >
 Specialisation. More...
 
struct  InsertColumns< std::complex< float > >
 Specialisation. 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  loadCheckpoint
 Loads file and deletes it from disk afterwards. 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  requires_inmemory_rump_during_cache
 Specialise this class template for any types which require special treatment during caching. More...
 
struct  requires_inmemory_rump_during_cache< STensorImpl::STensor >
 
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  SourceLocation
 Dummy struct to stand in until the compiler supports the proper source location. 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  TensorInfoStorageSum
 Data structure holding summarised storage information for a single 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...
 
using AutodiffRescale = YesNo< struct _autodiffrescale >
 Whether or not to rescale the output adjoints during autodifferentiation. More...
 
template<class T >
using BaseType = typename std::remove_cv_t< std::remove_reference_t< T > >
 Template alias to obtain the base type of some (potentially reference-) type T. 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...
 
template<typename T >
using CudaConstSpan = Cuda::CudaConstSpan< T >
 Range of constant elements. More...
 
template<Rank rank, typename Scalar = SDef>
using CudaDenseTensor = CudaDenseTensorImpl::CudaDenseTensor< rank, Scalar >
 Convenience typedef, see CudaDenseTensorImpl::CudaDenseTensor for details. More...
 
template<typename Type >
using CudaDynArray = Cuda::CudaDynArray< Type >
 Convenience typedef, see Cuda::CudaDynArray for details. More...
 
template<typename T >
using CudaMutSpan = Cuda::CudaMutSpan< T >
 Range of mutable elements. More...
 
template<typename T >
using CudaPtr = Cuda::CudaPtr< T >
 A pointer to a CUDA-allocated region (if SYTEN_USE_CUDA is true) or a host-allocated memory area which knows its CUDA device. More...
 
using CudaStream = Cuda::CudaStream
 Represents a CUDA stream. More...
 
using FullQR = YesNo< struct _fullqr >
 Specifies whether we do a full QR (Yes) or a thin QR (No) More...
 
using GaugeFixSVD = YesNo< struct _gauge_fix_svd >
 Whether to gauge-fix the SVD. More...
 
template<Rank rank, typename Scalar = SDef>
using GenericDenseTensor = GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >
 Generic dense tensor class. 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<Rank rank, typename Scalar = SDef>
using IdentityDenseTensor = IdentityDenseTensorImpl::IdentityDenseTensor< rank, Scalar >
 Specialised identity dense tensor. More...
 
template<typename T >
using MutSpan = SpanImpl::MutSpan< T >
 Range of mutable elements. More...
 
template<Rank rank, typename Scalar = SDef>
using OffsetDenseTensor = OffsetDenseTensorImpl::OffsetDenseTensor< rank, Scalar >
 A specialised offset dense tensor. 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 IndexNumber = std::uint8_t
 Index numbers, i.e. 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 class  DecompRescaleCGC { Yes , No }
 Whether or not to rescale the CGC spaces during an decomposition. More...
 
enum class  Direction : char { Inc , Out , Invalid , Silent }
 Direction of the leg from the view of the tensor it belongs to. More...
 
enum class  EliminateZeros { Yes , No }
 Whether to eliminate zeros in tensor products. More...
 
enum class  Fermionic : char { Never , Odd , Half }
 Speficiation when a particular label is fermionic. More...
 
enum class  Group : char {
  Nil , U1 , SU2 , SU3 ,
  Z
}
 Implemented mathematical groups. More...
 
enum class  Init : char { Yes , No }
 Specification whether we should use placement new after allocation. More...
 
enum class  IterativeExitReason {
  Converged , MaxIterations , MaxPossible , InexactArithmetic ,
  E_Input , E_InvalidMode , E_InvalidSubMode , Uninitialised ,
  Custom
}
 Exit reasons for iterative algorithms. More...
 
enum class  Ordinal { First , Second , Third }
 enum containing the first three ordinals More...
 
enum class  ParallelKind { True , False , FirstZero , SecondZero }
 enum containing return values of isParallel() calls More...
 
enum class  PhysicalPosition { Left , Right }
 Is the physical site left or right of the bath site? More...
 
enum class  RDMType { Particle1 , Particle2 , Orbital , Undefined }
 
enum class  Statistics { Bosonic , Fermionic }
 enum containing different classes of statistics More...
 
enum class  TransposeMethod {
  Default , IterWSeq , IterRSeq , Recursive ,
  CUDAKernel
}
 Dense/CUDA tensor transposition method. More...
 
enum class  TruncationType {
  Default , SVD , Deparallelise , Delinearise ,
  DelineariseRelaxed
}
 enum containing the type of truncation to employ in MPO truncation More...
 

Functions

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...
 
HighPrec abs (HighPrec const &)
 Absolute value of a HighPrec value. 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 Container >
void addLog (Container &c)
 Adds values contained in c into c[0]. 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 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 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<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<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<typename Scalar >
void addScaled (Scalar *a, Scalar const *b, typename IdentityType< Scalar >::type const factor, Size sz)
 \( 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<>
void addScaled< double > (double *a, double const *b, double const factor, Size sz)
 
template<>
void addScaled< double > (double *a, double const *b, double const factor, Size sz)
 
template<>
void addScaled< float > (float *a, float const *b, float const factor, Size sz)
 
template<>
void addScaled< float > (float *a, float const *b, float const factor, Size sz)
 
template<>
void addScaled< std::complex< double > > (std::complex< double > *a, std::complex< double > const *b, std::complex< double > const factor, Size sz)
 
template<>
void addScaled< std::complex< double > > (std::complex< double > *a, std::complex< double > const *b, std::complex< double > const factor, Size sz)
 
template<>
void addScaled< std::complex< float > > (std::complex< float > *a, std::complex< float > const *b, std::complex< float > const factor, Size sz)
 
template<>
void addScaled< std::complex< float > > (std::complex< float > *a, std::complex< float > const *b, std::complex< float > const factor, Size sz)
 
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...
 
DenseTensor< 2, SRDefallSiteEntropy (MPS::State &input, std::set< Index > const &bath)
 Overload for PP-states. 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, 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...
 
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...
 
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. syten::cacheDir + "/" + f More...
 
template<typename T >
std::string cacheFilename (T const &t, Index const l, std::string const &add="")
 Returns an unique identifier for files. 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, 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<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<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...
 
std::string concatArg (int argc, char **argv)
 Concatenate elements argv[1…argv-1] into a string separated by spaces. 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<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<typename Scalar >
void conj_inplace (MutSpan< Scalar > out)
 Complex-conjugates data in out in-place. More...
 
template<Rank contracted, Rank rank>
std::array< Index, rankconstruct_product_target_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_target_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...
 
void correct_cgc_tensors (STensor &in, bool recursive=false, SourceLocation loc=SourceLocation::current())
 An overload for STensors. 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...
 
DenseTensor< 2 > dense (Tensor< 2 > t)
 Converts rank 2 Tensor into rank 2 DenseTensor. More...
 
std::vector< SDefdense (Tensor< 2 > t, bool const)
 Converts and returns as data inside as row-major vector. 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< double > ()
 Specialisation of describe_scalar_type() for doubles. More...
 
template<>
std::string describe_scalar_type< double > ()
 Specialisation of describe_scalar_type() for doubles. More...
 
template<>
std::string describe_scalar_type< float > ()
 Specialisation of describe_scalar_type() for floats. More...
 
template<>
std::string describe_scalar_type< float > ()
 Specialisation of describe_scalar_type() for floats. 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...
 
template<>
std::string describe_scalar_type< std::complex< double > > ()
 Specialisation of describe_scalar_type() for complex doubles. More...
 
template<>
std::string describe_scalar_type< std::complex< double > > ()
 Specialisation of describe_scalar_type() for complex 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< float > > ()
 Specialisation of describe_scalar_type() for complex floats. More...
 
Vec< SDefdiagonal (Tensor< 2 > const &m, bool const order=true)
 Returns a vector of diagonal values, repeated according to the multiplicities of the tensor blocks. More...
 
SRDef dist (Basis const &b1, Sector const &s2)
 Returns the distance between a sector and a basis. 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 (Sector const &s1, Sector const &s2)
 Returns the distance between two sectors, i.e. the sum of the distances between constituent irreps. 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 Scalar >
Scalar dot (DynArray< Scalar > const &a, DynArray< Scalar > const &b, bool const conjugate)
 Calculates the scalar product of two DynArray's. More...
 
template<>
double dot< double > (DynArray< double > const &a, DynArray< double > const &b, bool const)
 
template<>
double dot< double > (DynArray< double > const &a, DynArray< double > const &b, bool const)
 
template<>
float dot< float > (DynArray< float > const &a, DynArray< float > const &b, bool const)
 
template<>
float dot< float > (DynArray< float > const &a, DynArray< float > const &b, bool const)
 
template<>
std::complex< double > dot< std::complex< double > > (DynArray< std::complex< double > > const &a, DynArray< std::complex< double > > const &b, bool const conjugate)
 
template<>
std::complex< double > dot< std::complex< double > > (DynArray< std::complex< double > > const &a, DynArray< std::complex< double > > const &b, bool const conjugate)
 
template<>
std::complex< float > dot< std::complex< float > > (DynArray< std::complex< float > > const &a, DynArray< std::complex< float > > const &b, bool const conjugate)
 
template<>
std::complex< float > dot< std::complex< float > > (DynArray< std::complex< float > > const &a, DynArray< std::complex< float > > const &b, bool const conjugate)
 
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...
 
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<>
Tensor< 0 > dropDummy (Tensor< 1 > const &in, Index const which)
 Specialisation for a rank-1 tensor which asserts dummyness and then uses trace to obtain the value. More...
 
template<Rank rank>
Tensor< rank-1 > dropDummy (Tensor< rank > const &in, Index const which)
 Removes (drops) a dummy leg from the tensor. 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...
 
std::tuple< STensor, STensoreigenSym (STensor in)
 
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, std::set< Index > const &bath)
 Calculates the single site entropy of a state. More...
 
SRDef entropyTwoSite (MPS::State &input, Index site1, Index site2)
 Declaration. More...
 
SRDef entropyTwoSite (MPS::State &input, Index site1, Index site2, std::set< Index > const &bath)
 Overload for PP-states. 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 > exponentialTensorGen (Tensor< 2 > const &in, SDef const t, Basis const &full_basis)
 And overload which works for generic matrices by brute force exponentiating the sum after rescaling each summand. 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...
 
template<typename... Args>
std::string format (std::string_view const &fmstr, Args &&... args)
 Wrapper around fmt::format() to catch exceptions and provide better error messages. 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, 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...
 
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...
 
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 make_special=false)
 Generates a fusing half-isometry map. More...
 
Tensor< 2 > genIINode (Basis const &b1)
 Generates a node with two identical incoming bases b1. More...
 
Tensor< 2 > genIINode (Basis const &b1, Basis const &b2)
 Generates a node with two incoming bases b1 and b2. More...
 
Tensor< 2 > genIONode (Basis const &b1)
 Generates a node with one incoming and one outgoing index. More...
 
Tensor< 2 > genOONode (Basis const &b1)
 Generates a node with two identical outgoing bases b1. More...
 
Tensor< 2 > genOONode (Basis const &b1, Basis const &b2)
 Generates a node with two outgoing bases b1 and b2. 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...
 
Tensor< 3 > genRandom (Basis const &firstBasis, Basis const &secondBasis, Index maxBlockSize=200, Ordinal const &resultIndex=Ordinal::Second)
 Generates a random rank-3 tensor. More...
 
Rep genRepNil (Fermionic ferm=Fermionic::Never)
 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 make_special=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...
 
void get_coefficient (MPS::State const &psi, Index first_site, Tensor< 2 > partial_contraction, Vec< Pair< Index, Sector > > &partial_bases)
 Recursively called helper to compute coefficients of a state. More...
 
std::size_t get_current_rss ()
 Returns the current total memory footprint of the program in bytes. 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 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 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...
 
std::ostreamgetErr (bool b)
 Returns std::cerr if b is true, otherwise a dummy output stream. More...
 
std::ostreamgetOut (bool b)
 Returns std::cout if b is true, otherwise a dummy output stream. More...
 
Tensor< 3 > gM (Basis const &b1, Basis const &b2, Index maxBlocksize=std::numeric_limits< Index >::max(), SRDef ratio=1., Index minBlocksize=1, bool make_special=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 , 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...
 
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 Scalar >
DenseTensor< 2, Scalar > herm (DenseTensor< 2, Scalar > const &in)
 Convenience entry point for hermitian conjugation of a matrix. More...
 
template<typename Scalar >
SparseTensor< 2, Scalar > herm (SparseTensor< 2, Scalar > const &a)
 Transposes the last two indices and complex-conjugates all entries. More...
 
void herm (Tensor< 2 > &m)
 Transpose and complex conjugate a matrix in place. 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 syten::cacheDir for temporary objects. More...
 
void initialise_terminator (int argc, char **argv)
 Called to initialise the terminator. 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<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>
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...
 
template<typename Scalar >
void invertDiagonal (DenseTensor< 2, Scalar > &a, typename ScalarBase< Scalar >::type scale)
 Approximately inverts the diagonal elements of a square matrix in place, leaving zeros untouched and using a Lorentzian broadening, i.e. replacing \( x_{i,i} \to \frac{x_{i,i}}{x_{i,i}^2 + \varepsilon} \) with \( \varepsilon \) equal to SYTEN_BROADENING_EPSILON times the supplied scale, which should be the magnitude of the overall largest inverted singular value. 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...
 
SRDef invertDiagonal (Tensor< 2 > &m)
 Inverts a rank-two tensor in-place by inverting all reduced dense and CGC-space sparse blocks. More...
 
template<typename T >
constexpr auto is_complex ()
 Returns true if T is of the form std::complex<X>. 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...
 
bool isnan (HighPrec const &)
 Returns true if the HighPrec value represents a NaN. 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...
 
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_view const cond, std::string_view const file, std::string_view const line, Args &&... others)
 Use the SYTEN_ASSERT() macro instead of this function! More...
 
template<typename... Args>
void issue_warning (std::string_view const cond, std::string_view const file, std::string_view 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::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...
 
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::vector< std::vector< U > > kronVector (std::vector< U > const &a, std::vector< U > const &b)
 Kronecker product of two vectors. 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...
 
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 >
lexical_cast (std::string const &s)
 Casts the string s to type T, wrapper around boost::lexical_cast<> to silence GCC warning. 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... 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, 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 logGI_O (Args &&... data)
 Logs generic informational data to the standard file streams and std::cout. 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, 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, 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<typename... Args>
void logTx (Args &&... data)
 Logs extra-verbose timing data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void logTX (Args &&... data)
 Logs EXTRA-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<Rank r>
void makeZero (Tensor< r > &input)
 Return the tensor with the same structure but all elements set to zero. More...
 
template<typename I , typename F >
auto mapVector (std::vector< I > const &a, F f)
 Maps a unary function over one vector. 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<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...
 
template<Rank rank>
SRDef max (Tensor< rank > const &a)
 Returns the element with the greatest magnitude. 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 , TransposeMethod method = TransposeMethod::Default>
DenseTensor< rank, Scalar > multi_transpose (DenseTensor< rank, Scalar > const &in, ConstSpan< Index > perm, Conj do_conj=Conj::n())
 Standard entry point for the transposition of a syten::DenseTensor. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > multi_transpose (SparseTensor< rank, Scalar > const &in, ConstSpan< Index > const perm, bool conjugate=false)
 Transposes the sparse tensor according to the permutation perm. More...
 
template<Rank rank>
Tensor< rankmulti_transpose (Tensor< rank > m, ConstSpan< Index > const &perm, Conj conjugate=Conj::n())
 Returns a transposed copy of the input tensor. More...
 
template<typename First , typename... Rest>
Vec< std::decay_t< First > > mve (First &&f, Rest &&... rest)
 Helper function to _m_ake a _v_ector from some _e_lements while potentially moving out of those elements. 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>
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>
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, 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>
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 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<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<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...
 
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)
 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>
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...
 
constexpr SDef operator""_c (long double value)
 User-defined literal operator to turn a floating-point value into a SDef (potentially complex). More...
 
constexpr SDef operator""_c (unsigned long long int value)
 User-defined literal operator to turn an integer value into a SDef (potentially complex). More...
 
constexpr SDef operator""_i (long double value)
 User-defined literal operator to turn a floating-point value into a purely imaginary SDef. More...
 
constexpr SDef operator""_i (unsigned long long int value)
 User-defined literal operator to turn an integer value into a purely imaginary SDef. More...
 
constexpr SRDef operator""_r (long double value)
 User-defined literal operator to turn a floating-point value into a SRDef. More...
 
constexpr 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, 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<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<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...
 
HighPrec operator* (HighPrec const &, HighPrec const &)
 Multiplication of two HighPrec values. 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, 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>
Tensor< rankoperator* (SDef const &s, Tensor< rank > const &t)
 \( r_{i\ldots} = s \cdot t_{i\ldots} \) 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>
Tensor< rankoperator* (Tensor< rank > const &t, SDef const &s)
 \( r_{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>
Tensor< rankoperator*= (Tensor< rank > &&t, SDef const &s)
 \( t_{i\ldots} = s \cdot t_{i\ldots} \) 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, 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...
 
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...
 
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<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 > &&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, 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...
 
template<typename Base >
HalfInteger< Base > operator- (HalfInteger< Base > const a)
 Negative of a half-integer. More...
 
template<typename Base >
HalfInteger< Base > operator- (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Difference between two half-integers. More...
 
HighPrec operator- (HighPrec const &, HighPrec const &)
 Subtraction 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<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< rankoperator-= (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 > const &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, 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...
 
HighPrec operator/ (HighPrec const &, HighPrec const &)
 Division of two HighPrec values. More...
 
template<Rank rank>
Tensor< rankoperator/ (Tensor< rank > const &t, SDef const &s)
 \( r_{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...
 
template<Rank rank>
Tensor< rank > & operator/= (Tensor< rank > &t, SDef const &s)
 \( t_{i\ldots} = t_{i\ldots}/s \) More...
 
template<typename Base >
bool operator< (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Less-than comparison for HalfInteger. 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...
 
std::ostreamoperator<< (std::ostream &, HighPrec const &)
 Output of a HighPrec value. More...
 
template<typename Base >
std::ostreamoperator<< (std::ostream &o, HalfInteger< Base > const b)
 Output for half-integers. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, AsyncCached< Type > const &c)
 Easy output for AsyncCached<>'s. More...
 
std::ostreamoperator<< (std::ostream &out, Basis const &b)
 Output of a basis, more concise if basis is silenced. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, Cached< Type > const &c)
 Easy output for Cached<>'s. More...
 
std::ostreamoperator<< (std::ostream &out, CtorTester const &c)
 Output of a CtorTester. More...
 
template<typename Scalar >
std::ostreamoperator<< (std::ostream &out, DenseTensor< 1, Scalar > const &t)
 Prettyprinting of a vector. 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...
 
std::ostreamoperator<< (std::ostream &out, Direction const dir)
 Output of the direction of a basis. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, DynArray< Type > const &a)
 Formatted output of a DynArray, using square brackets. More...
 
std::ostreamoperator<< (std::ostream &out, Fermionic const when)
 Outputs a Fermionic specification. More...
 
std::ostreamoperator<< (std::ostream &out, Group const &g)
 Output of a mathematical group. 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, HistoryElement const &elem)
 Prints a history record to the output stream, omitting the comment. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeConfig const &c)
 Short output of an eigensolver configuration struct. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeExit const &r)
 Prettyprinting of an exit description. More...
 
std::ostreamoperator<< (std::ostream &out, IterativeExitReason const &r)
 Prettyprinting of an exit reason. More...
 
template<typename Type , Rank max, typename MaxType >
std::ostreamoperator<< (std::ostream &out, LimVec< Type, max, MaxType > const &v)
 Output for a LimVec. More...
 
std::ostreamoperator<< (std::ostream &out, NoNew)
 NoNew has an empty result when streamed to an ostream. 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 &out, ParallelKind const &p)
 Output for ParallelKind's. More...
 
std::ostreamoperator<< (std::ostream &out, PhysicalPosition const &pos)
 
std::ostreamoperator<< (std::ostream &out, Rep const &r)
 Output of a physical symmetry irrep. More...
 
template<Rank rank, typename Scalar >
std::ostreamoperator<< (std::ostream &out, SparseTensor< rank, Scalar > const &t)
 Pretty output of sparse tensors. 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...
 
std::ostreamoperator<< (std::ostream &out, Tensor< 0 > const &t)
 Prettyprinting for rank-0 tensors. More...
 
template<Rank rank>
std::ostreamoperator<< (std::ostream &out, Tensor< rank > const &t)
 Prettyprinting for tensors. More...
 
std::ostreamoperator<< (std::ostream &out, TensorInfoStorageSum const &info)
 Output for a TensorInfoStorageSum object. 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, 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, Truncation const &trunc)
 Pretty-prints a truncation object. More...
 
std::ostreamoperator<< (std::ostream &out, TruncationType const &tt)
 Output for TruncationType's. More...
 
template<typename Type >
std::ostreamoperator<< (std::ostream &out, Vec< Type > const &a)
 Formatted output of a vector, 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...
 
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< HistoryElement > const &elem)
 Prints a history record to the output stream, including the comment. More...
 
std::ostreamoperator<< (std::ostream &out, Verbose< IterativeConfig > const &c)
 Verbose output of an eigensolver configuration struct. 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 T >
std::ostreamoperator<< (std::ostream &stream, YesNo< T > const &t)
 stream output for YesNo<T> More...
 
template<typename Base >
bool operator<= (HalfInteger< Base > const a, HalfInteger< Base > const b)
 Less-or-equal comparison for HalfInteger. 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<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...
 
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)
 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>
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< Base > const b)
 Greater-than comparison for HalfInteger. 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-or-equal comparison for HalfInteger. 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< 1, Scalar > &v)
 Parse a rank-1 tensor from an input stream. 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...
 
std::istreamoperator>> (std::istream &in, IterativeConfig &c)
 Parse an eigensolver configuration struct, both short and verbose supported. 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, PhysicalPosition &pos)
 Reading in. More...
 
std::istreamoperator>> (std::istream &in, RDMType &t)
 
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 >
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 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 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::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 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 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<class T >
constexpr auto ostreamshiftable ()
 constexpr function which returns true if a T const& object is shiftable into a std::ostream&. More...
 
template<class T >
constexpr auto ostreamshiftable_imp (...) -> std::false_type
 Implementation helper for ostreamshiftable(). 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<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...
 
std::string prepare_exception_message (std::string_view const cond, std::string_view const file, std::string_view const line)
 Prepares the exeption message and returns it as a std::string. 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...
 
void print_version (char const *argv0)
 Print version information to std::cerr, taking argv0 as the command-line binary name. More...
 
void print_version_diff ()
 Prints the difference between the git head and worktree at build time to std::cerr. More...
 
template<typename Lattice , typename Constructor , typename State >
void proceed_1prdm (std::ostream &out, State &state, std::string const &lattice_name, Vec< std::string > const &ops_list, std::string const &output, bool const eigensystem, bool const sum)
 
template<typename Lattice , typename Constructor , typename State >
void proceed_2prdm (std::ostream &out, State &state, std::string const &lattice_name, Vec< std::string > const &ops_list, std::string const &output, bool const sum)
 
template<typename Constructor , typename State >
void proceed_ordm (std::ostream &out, std::string const &output, State &state, Vec< Index > const &sites, bool const eigensystem, bool const sym)
 
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 , std::enable_if_t<(int(frank)+int(srank) - 2 *int(summed) > 0), int > = 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, DenseProduct::TemporaryTransposeStorage< Scalar, frank, srank > *tts=nullptr)
 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 prodS (SparseTensor< frank, Scalar > const &a, SparseTensor< frank, Scalar > const &b, bool conjugate=true)
 Scalar product/full contraction of two sparse tensors, again see syten::prodD for a full discussion. 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 syten::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...
 
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 row-major input and pseudo-inverts it using a SVD. More...
 
template<typename Scalar >
std::pair< DenseTensor< 2, Scalar >, typename ScalarBase< Scalar >::type > 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...
 
std::string random_hash (Index const length, std::string allowed="")
 Returns random hash. 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...
 
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...
 
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 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 T >
void read (std::istream &in, std::complex< T > &x)
 Reads a complex scalar value from in and stores it in x, explicitly instantiated for std::complex<double> and std::complex<float>. 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 void read< double > (std::istream &in, std::complex< double > &x)
 Explicit instantiation of read() for complex doubles. More...
 
template void read< float > (std::istream &in, std::complex< float > &x)
 Explicit instantiation of read() for complex floats. 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<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > real (DenseTensor< rank, Scalar > const &in)
 Returns the real part of the real DynArray in 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<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<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 >
std::string save (T &t)
 Save an object into a temporary file. More...
 
template<typename T >
void save (T &t, std::string const &where)
 Save an object into a 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<>
void scale< double, double > (DynArray< double > &a, double const b)
 
template<>
void scale< double, double > (DynArray< double > &a, double const b)
 
template<>
void scale< float, float > (DynArray< float > &a, float const b)
 
template<>
void scale< float, float > (DynArray< float > &a, float const b)
 
template<>
void scale< std::complex< double >, double > (DynArray< std::complex< double > > &a, double const b)
 
template<>
void scale< std::complex< double >, double > (DynArray< std::complex< double > > &a, double const b)
 
template<>
void scale< std::complex< float >, float > (DynArray< std::complex< float > > &a, float const b)
 
template<>
void scale< std::complex< float >, float > (DynArray< std::complex< float > > &a, float const b)
 
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...
 
bool shiftArgs (std::ostream &)
 Sequentially shift all arguments into a stream. More...
 
bool shiftArgs (std::ostream &, NoNew)
 Sequentially shift all arguments into a stream. More...
 
template<typename First , std::enable_if_t<!std::is_invocable_v< First >, int > = 0>
bool shiftArgs (std::ostream &out, First &&a)
 Sequentially shift all arguments into a stream. More...
 
template<typename First , typename... Rest>
bool shiftArgs (std::ostream &out, 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<Rank rank>
void sort (Tensor< rank > &t)
 Sorts Tensor (hopefully) uniquely. 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...
 
HighPrec sqrt (HighPrec const &)
 Square root of a HighPrec value. More...
 
Tensor< 2 > sqrt (Tensor< 2 > inp)
 Returns the square root of the diagonal input matrix. 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...
 
template<Rank rank>
TensorInfoStorageSum storage_blocks_summed (Tensor< rank > const &t)
 Create a TensorInfoStorageSum object given an input tensor. More...
 
template<typename T >
void streamed_replace (std::ostream &out, 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...
 
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< TensorBlock< rank > > > tensorSortBuckets (std::vector< TensorBlock< rank > > &&blocks)
 
template<Rank rank>
std::vector< std::vector< Index > > tensorSortBuckets (Tensor< rank > const &input, Index const leg)
 
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 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 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_def (T const &arg)
 Returns a string representation of the double-representation with default formatting. 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_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 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 Scalar >
Scalar trace (DenseTensor< 2, Scalar > const &a)
 \( \sum_k A_{kk} \) More...
 
template<typename Scalar >
Scalar trace (SparseTensor< 2, Scalar > const &a)
 Trace of a sparse matrix. More...
 
SDef trace (Tensor< 1 > const &a)
 Calculates the trace of a rank-1 tensor. More...
 
SDef trace (Tensor< 2 > const &a)
 Calculates the trace of a rank-2 tensor. More...
 
MPS::Operator trans_cd (MPS::Lattice &lat, DenseTensor< 2, SDef > &U, Index id)
 
MPS::Operator trans_chd (MPS::Lattice &lat, DenseTensor< 2, SDef > &U, Index id)
 
MPS::Operator trans_chu (MPS::Lattice &lat, DenseTensor< 2, SDef > &U, Index id)
 
MPS::Operator trans_cu (MPS::Lattice &lat, DenseTensor< 2, SDef > &U, Index id)
 
MPS::Lattice trans_U1U1 (DenseTensor< 2, SDef > &U, MPS::Lattice &lat, Index length)
 
void transform_one_elec (DenseTensor< 2, SDef > &U, DenseTensor< 2, SDef > &one)
 
void transform_one_elec_mat (DenseTensor< 2, SDef > &U, DenseTensor< 2, SDef > &one)
 
void transform_two_elec (DenseTensor< 2, SDef > &U, DenseTensor< 4, SDef > &two)
 
template<Rank rank, typename Scalar , TransposeMethod method = TransposeMethod::Default, typename Indices = std::make_index_sequence<(rank < 2 ? 0 : (rank - 2))>>
void transpose (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< Index > in_perm, ConstSpan< Index > in_dim, Conj do_conj=Conj::n(), bool do_checks=true)
 Entry point for transposition of a continuous array into another array. More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > transpose (DenseTensor< 2, Scalar > const &in, Conj const conj=Conj::n())
 Convenience entry point for transposition of a matrix. More...
 
template<typename Scalar >
SparseTensor< 2, Scalar > transpose (SparseTensor< 2, Scalar > const &a)
 Transposes the last two indices. More...
 
void transpose (Tensor< 2 > &m)
 Transpose a matrix in place. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > transpose_exchange (DenseTensor< rank, Scalar > const &a, ConstSpan< Index > const &axes, Conj conjugate=Conj::n())
 Transposes two axes of a dense tensor using DenseIter objects. More...
 
template<Rank rank, typename Scalar >
SparseTensor< rank, Scalar > transpose_exchange (SparseTensor< rank, Scalar > const &a, ConstSpan< Index > 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>
void transpose_exchange (Tensor< rank > &m, std::array< Index, 2 > const axes, bool const conjugate=false)
 Transposes the specified legs of the tensor. More...
 
template<Rank rank, typename Scalar , TransposeMethod method = TransposeMethod::Default, Rank... Ranks>
void transpose_impl (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< Index > in_perm, ConstSpan< Index > in_dim, Conj do_conj=Conj::n(), bool do_checks=true, std::index_sequence< Ranks... >={})
 Implementation of syten::transpose() below. More...
 
template<Rank rank, typename Scalar >
void transpose_iter_rseq (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< IndexNumber > perm, ConstSpan< Index > dim, Conj do_conj=Conj::n())
 Dense tensor transposition using a DenseIterDual and reading sequentially. More...
 
template<Rank rank, typename Scalar >
void transpose_iter_wseq (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< IndexNumber > perm, ConstSpan< Index > dim, Conj do_conj=Conj::n())
 Dense tensor transposition using a DenseIterDual and writing sequentially. More...
 
template<typename Scalar , Index use_library = 1>
void transpose_r2 (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, Index const inp_rows, Index const inp_cols, Conj const conj=Conj::n())
 Standard entry point for rank-2 transposition of any continous array, handles used backend as necessary. More...
 
template<typename Scalar , Index use_library = 1>
DenseTensor< 2, Scalar > transpose_r2 (DenseTensor< 2, Scalar > const &in, Conj const conj=Conj::n())
 Standard entry point for rank-2 transposition of a DenseTensor. More...
 
template<typename Scalar >
void transpose_r2_direct (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, Index const inp_rows, Index const inp_cols, Conj const do_conj=Conj::n())
 Direct, naive, error-free transposition. More...
 
template<typename Scalar >
void transpose_r2_lib (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, Index const inp_rows, Index const inp_cols, Conj const conj=Conj::n())
 Entry point for library-backed transposition of arrays. More...
 
template<Rank rank, typename Scalar >
void transpose_recursive (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< IndexNumber > in_perm, ConstSpan< Index > in_dim, Conj do_conj=Conj::n())
 Recursive dense tensor transposition. More...
 
template<Rank rank, typename Scalar >
void transpose_recursive_impl (ConstSpan< Scalar > const inp, MutSpan< Scalar > out, MutSpan< Scalar > workspace, ConstSpan< IndexNumber > perm, ConstSpan< Index > dim)
 Implementation of the recursive dense tensor transposition. 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 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...
 
std::string version (char const *argv0)
 Returns the version information stringstream, taking argv0 as the command-line binary name. 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<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<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 syten::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 const &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, bool const clearAfter, Type &r)
 Loads an object of type Type from file into r. More...
 
template<typename Type >
Type loadFile (std::string file, bool const fromCache, bool const clearAfter)
 Returns an object of type Type loaded from file. More...
 
template<typename Type >
void loadInputRef (std::string const &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 const &file, Type &r)
 Loads from a cache file file into an object r without discarding non-overwritten properties of r. More...
 
template<typename Type >
void loadCheckpointRef (std::string const &file, Type &r)
 Load file into reference and deletes file on disk. 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...
 
constexpr SYTEN_SRDEF_TYPE nan = NAN
 a NAN as a real-valued scalar. More...
 
NOut nout
 global NOut object (to be used as cout, eg) More...
 
constexpr SYTEN_SRDEF_TYPE pi = M_PI
 \( \pi \) as a real-valued scalar. 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.
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...
 

Detailed Description

Syten namespace.

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.