SyTen
syten::STensorImpl::SBasis Class Reference

A smart basis class. More...

#include <sbasis.h>

+ Collaboration diagram for syten::STensorImpl::SBasis:

Public Member Functions

SBasis a () const
 Returns an adjointed copy of the basis (with changed identifiers). More...
 
void add (Sector const &sec, Index const sz)
 Adds a quantum number sector of size sz to the basis, does not affect the identifiers. More...
 
SBasisadjoint ()
 Adjoints the basis. More...
 
SBasis adjointed () const
 Returns an adjointed copy of the basis (with changed identifiers). More...
 
MemoryUsage::MemorySize allocSize () const
 allocSize()/memory_size.h support. More...
 
SRDef average_blocksize () const
 Returns the average blocksize in the basis. More...
 
std::unordered_map< Sector, Index >::iterator begin ()
 Iterator access to sector map. More...
 
std::unordered_map< Sector, Index >::const_iterator begin () const
 Iterator access to sector map. More...
 
SBasis cprime (std::int8_t value=1) const
 Returns a copy with increased prime level by value. More...
 
SBasis cunprime (std::int8_t value=1) const
 Returns a copy with decreased the prime level by value. More...
 
Direction dir () const
 Returns the direction of the basis. More...
 
Index elementSize (Sector const &sec) const
 Returns the size of the specified sector or zero if it is not stored. More...
 
std::unordered_map< Sector, Index >::iterator end ()
 Iterator access to sector map. More...
 
std::unordered_map< Sector, Index >::const_iterator end () const
 Iterator access to sector map. More...
 
void erase (Sectors::const_iterator which)
 Erases the element. More...
 
SBasis f () const
 Returns a flipped copy of the basis (with the same identifiers). More...
 
SBasis fa () const
 Returns a flipped and adjointed copy of the basis (with changed identifiers). More...
 
SBasisflip ()
 Flips the basis direction, does not affect the identifiers. More...
 
SBasis flipped () const
 Returns a flipped copy of the basis (with the same identifiers). More...
 
Basis gen_basis () const
 Generates a Basis object from this basis. More...
 
SBasisId get_id () const
 Returns the inner SBasisId object. More...
 
std::tuple< std::uint32_t, std::uint32_t, std::uint32_tget_ids () const
 Returns a tuple with the three identifying integers. More...
 
std::uint8_t get_prlvl () const
 Returns the prime level of the basis. More...
 
bool hasSymmetry (Sector const &sec) const
 Returns true if this basis contains the specified sector. More...
 
bool is_vacuum () const
 Returns true if this basis is a vacuum basis (single element, all 0 labels) More...
 
Index maximal_blocksize () const
 Returns the maximal blocksize in the basis. More...
 
std::string_view name () const
 Returns the name of the basis. More...
 
Index num_sectors () const
 Returns the number of different sectors in this basis. More...
 
 operator SBasisId () const
 Implicit conversion to an SBasisId. More...
 
bool operator!= (SBasis const &other) const
 Compares the identifiers of this basis with the other basis for inequality. More...
 
bool operator!= (SBasisId const &other) const
 Compares the identifiers of this basis with the other basis for inequality. More...
 
SBasisoperator++ ()
 Increases the prime level. More...
 
SBasisoperator-- ()
 Decreases the prime level. More...
 
SBasisoperator= (SBasis &&)=default
 Move assignment op. More...
 
SBasisoperator= (SBasis const &)=default
 Copy assignment op. More...
 
bool operator== (SBasis const &other) const
 Compares the identifiers of this basis with the other basis for equality. More...
 
bool operator== (SBasisId const &other) const
 Compares the identifiers of this basis with the other basis for equality. More...
 
SBasisprime (std::int8_t value=1)
 Increases the prime level by value. More...
 
Index reduced_size () const
 Returns the reduced number of states in the basis (counting multiplicities once) More...
 
std::string_view rename (std::string_view name_)
 Sets the name of the basis to something else. More...
 
SBasis renamed (std::string_view name) const
 Returns a copy of this with the name set to name_. More...
 
SBasis repro () const
 "Reproduces" the basis. More...
 
 SBasis ()=default
 Default ctor, creates an empty unique basis. More...
 
 SBasis (Basis const &basis, std::string_view name_="autogen")
 Standard ctor, takes an existing Basis and a nickname. More...
 
 SBasis (Direction dir_, std::string_view name_="undefined")
 Standard ctor, takes a direction and a basis nickname. More...
 
 SBasis (SBasis &&)=default
 Move ctor. More...
 
 SBasis (SBasis const &)=default
 Copy ctor. More...
 
template<typename Archive >
void serialize (Archive &ar, unsigned int const in_version)
 Boost serialisation. More...
 
Direction set_dir (Direction dir_)
 Sets the direction of the basis, does not affect the identifiers. More...
 
void set_id (SBasisId const &v, bool const force=false)
 Set the id to the specified object. More...
 
void set_ids (std::tuple< std::uint32_t, std::uint32_t, std::uint32_t > const &v, bool const force=false)
 Sets the three identifying integers. More...
 
Index total_size () const
 Returns the total number of states in the basis (counting multiplicities multiple times) More...
 
SBasisunprime (std::int8_t value=1)
 Decreases the prime level by value. More...
 

Static Public Attributes

static constexpr unsigned int version = 2
 Boost serialisation version. More...
 

Private Types

typedef std::unordered_map< Sector, IndexSectors
 Data container type. More...
 

Private Attributes

LimVec< char, 9 > cname = {'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd' }
 Nickname of the basis. More...
 
Direction direc = Direction::Invalid
 Direction of the basis. More...
 
SBasisId id
 id of the basis. More...
 
Sectors sectors
 Map of vectors and sizes. More...
 

Friends

std::ostreamoperator<< (std::ostream &out, SBasis const &sb)
 Outputs the basis. More...
 

Detailed Description

A smart basis class.

This basis has a unique identifier (consisting three 32-bit integers) and a ‘nickname’ which can be used to refer to the basis temporarily and has a maximum length of nine characters. In addition, a prime level is carried around to temporarily ‘mask’ the basis during tensor-tensor contractions.

The nickname can be changed even if the basis itself is constant.

The basis stores all quantum number sectors with associated sizes, as such it fully defines the extend of any vector space.


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