SyTen
syten::MPS::Lattice Class Reference

Stores a physical lattice and associated operators and bases. More...

#include <lattice.h>

+ Collaboration diagram for syten::MPS::Lattice:

Classes

struct  SSO
 The representation of a single-site operator. More...
 
class  UndefinedOperator
 Thrown when an undefined operator is requested via MPS::Operator::get(). More...
 

Public Types

typedef std::tuple< std::vector< std::vector< Tensor< 4 > > >, std::vector< Tensor< 4 > >, std::vector< std::vector< Tensor< 4 > > > > SSORep
 Returned by getSSO, representing a single-site operator. More...
 

Public Member Functions

 Lattice (Index length_, std::string const &description_, Basis const &site_, Basis const &vac_)
 Standard constructor for uniform lattices. More...
 
 Lattice (std::string const &description_, std::vector< Index > const &siteType_, std::vector< Basis > const &typeBasis_, Basis const &vac_)
 Standard constructor for nonuniform lattices. More...
 
 Lattice ()=default
 Default ctor for boost archiving. More...
 
Index size () const
 Returns the number of sites of the lattice. More...
 
Basis and type information
template<typename IndexType >
Index siteType (IndexType i) const
 Returns the type of a specific site. More...
 
Basis typeBasis (Index i) const
 Returns the basis of the i-th type. More...
 
template<typename IndexType >
Basis siteBasis (IndexType i) const
 Returns the basis on the specified site. More...
 
bool isUniform () const
 Returns true if the basis is uniform throughout the lattice. More...
 
Index numTypes () const
 Returns the number of different basis types existing. More...
 
std::vector< std::pair< Index, char > > pairedSiteTypes () const
 Returns a vector of pairs <site index, type index> More...
 
void swap_types (Index const first, Index const second)
 Swaps the types of the two specified sites. More...
 
Operator saving to the lattice
void add (std::string const &id, std::string const &desc, Operator const &op, bool const overwrite=false)
 Add a global operator. More...
 
void add (std::string const &id, std::string const &desc, Tensor< 4 > const &leftI, Tensor< 4 > const &op, Tensor< 4 > const &rightI, bool const overwrite=false)
 Add a single-site operator, valid only for uniform lattices. More...
 
void add (std::string const &id, std::string const &desc, std::vector< std::vector< Tensor< 4 > > > const &lI, std::vector< Tensor< 4 > > const &op, std::vector< std::vector< Tensor< 4 > > > const &rI, bool const overwrite=false)
 Add a single-site operator to any lattice. More...
 
Operator retrieval from the lattice
Operator const & get (std::string id) const
 Returns a global operator. More...
 
Operatorget (std::string id)
 Returns a global operator. More...
 
Operator const & get (std::string id, Index where) const
 Constructs and returns a single-site operator. More...
 
Operator const & get (std::string id, int where) const
 Constructs and returns a single-site operator. More...
 
template<typename IndexTypeA , typename IndexTypeB >
Tensor< 4 > const & getIdLeft (std::string const &id, IndexTypeA const active, IndexTypeB const current) const
 Returns the identity matrix to be used to the left of a local operator on the specified site. More...
 
template<typename IndexTypeA , typename IndexTypeB >
Tensor< 4 > const & getIdRight (std::string const &id, IndexTypeA const active, IndexTypeB const current) const
 Returns the identity matrix to be used to the right of a local operator on the specified site. More...
 
template<typename IndexType >
Tensor< 4 > const & getLocal (std::string const &id, IndexType const active) const
 Returns the local operator to be used on the specified site. More...
 
std::vector< Tensor< 4 > > const & getLocal (std::string const &id) const
 Returns a vector of local site operators for the specified single-site operator. More...
 
SSORep getSSO (std::string const &id) const
 Returns a tuple <left, op, right> defining a single-site operator. More...
 
std::vector< std::tuple< std::string, bool, std::string > > listOps () const
 Returns a vector describing all operators existing on the lattice. More...
 
MemoryUsage::MemorySize allocSize () const
 allocSize()/memory_size.h support. More...
 
Boost serialisation
template<class Archive >
void serialize (Archive &ar, const unsigned int in_version)
 Boost archiving. More...
 

Public Attributes

std::string description
 a free-form description of this lattice More...
 
Basis vac
 the vacuum bases for the symmetries used in this lattice More...
 
Sector vacSector
 the vacuum quantum number sector on this lattice More...
 

Static Public Attributes

static const std::string uuid = "f1944de9-9b47-4a3d-8366-6ccb090ea2af"
 UUID of lattice files to differentiate them from state files. More...
 
static constexpr unsigned int version = 2
 current version, bump if you change one of the data structures here More...
 

Private Member Functions

Index restrict (int where) const
 Maps an integer into the range [0, length) by subtracting/adding length repeatedly. More...
 
Index restrict (Index where) const
 Maps an index into the range [0, length) by subtracting length repeatedly. More...
 

Private Attributes

std::map< std::string, std::pair< std::string, Operator > > globalOperators
 the set of global operators in the format map<key, pair<description, MPO>> More...
 
Index length
 number of sites on the lattice More...
 
std::vector< Indexm_siteType
 For each site, contains the type of that site. More...
 
std::vector< Basism_typeBasis
 For each type of site, contains the associated basis. More...
 
std::map< std::string, std::pair< std::string, SSO > > siteOperators
 the set of single-site operators in the format map<key, pair<description, SSO> > More...
 
std::unordered_map< std::pair< std::string, Index >, Operator, boost::hash< std::pair< std::string, Index > > > sso_cache
 Cache of previously-requested SSOs. More...
 

Detailed Description

Stores a physical lattice and associated operators and bases.


The documentation for this class was generated from the following files: