VMPS++
Loading...
Searching...
No Matches
Qbasis< Symmetry > Class Template Reference

Detailed Description

template<typename Symmetry>
class Qbasis< Symmetry >
Template Parameters
Symmetry: A class providing all relevant functions and infos that are determined by the Symmetry. Click here for more information.

This class is a container like class for a basis of a Hilbert space in which global symmetries are present. For each irreducible representation irrep of the global symmetry (for each quantum number), the states of the Hilbert states that transforms under that irrep are collected together in a plain Basis object.

One central function is the combine() method, which combine two instances of Qbasis to the tensor product basis, already proper sorted into irreps.

Note
Optionally an ident string can be added to each basis state, which give a convinient access for SiteOperatorQ instances.

Definition at line 38 of file Qbasis.h.

#include <Qbasis.h>

Classes

struct  fuseData
 

Public Member Functions

 Qbasis ()
 
template<typename Container >
 Qbasis (const Container &qins, const Eigen::Index &dim)
 
 Qbasis (const vector< qarray< Symmetry::Nq > > &base_input)
 
qType find (const std::string &ident) const
 
qType find (const Eigen::Index &num) const
 
bool find (const qType &q) const
 
Eigen::Index inner_num (const Eigen::Index &outer_num) const
 
Eigen::Index location (const std::string &ident) const
 
Eigen::Index inner_dim (const Eigen::Index &num_in) const
 
Eigen::Index inner_dim (const qType &q) const
 
Eigen::Index outer_num (const qType &q) const
 
Eigen::Index leftAmount (const qType &qnew, const std::array< qType, 2 > &qold) const
 
Eigen::Index leftOffset (const qType &qnew, const std::array< qType, 2 > &qold, const std::array< Eigen::Index, 2 > &plain_old) const
 
Eigen::Index rightAmount (const qType &qnew, const std::array< qType, 2 > &qold) const
 
void clear ()
 
template<typename MatrixType >
void pullData (const vector< Biped< Symmetry, MatrixType > > &A, const Eigen::Index &leg)
 
template<typename MatrixType >
void pullData (const vector< vector< vector< Biped< Symmetry, MatrixType > > > > &W, const Eigen::Index &leg)
 
void pullData (const std::vector< std::array< qType, 3 > > &qvec, const std::size_t &leg, const Eigen::Index &inner_dim_in)
 
void pullData (const std::vector< qarray< Symmetry::Nq > > &qs)
 
Qbasis< Symmetry > combine (const Qbasis< Symmetry > &other, bool FLIP=false) const
 
void setHistoryEntry (const qType &Qval, const qType &Q1, const qType &Q2, Eigen::Index dim)
 
Qbasis< Symmetry > add (const Qbasis< Symmetry > &other) const
 
std::string print () const
 
std::string printHistory () const
 
bool operator== (const Qbasis< Symmetry > &other) const
 
std::vector< std::tuple< qType, Eigen::Index, Basis > >::iterator begin ()
 
std::vector< std::tuple< qType, Eigen::Index, Basis > >::iterator end ()
 
std::vector< std::tuple< qType, Eigen::Index, Basis > >::const_iterator cbegin () const
 
std::vector< std::tuple< qType, Eigen::Index, Basis > >::const_iterator cend () const
 
void swap (Qbasis< Symmetry > &other)
 
void sort ()
 
std::size_t size () const
 
std::size_t M () const
 
std::size_t fullM () const
 
std::size_t Dmax () const
 
std::size_t Nq () const
 
const std::vector< qTypeqloc () const
 
const std::vector< qTypeqs () const
 
const std::unordered_set< qTypeunordered_qs () const
 
qType operator[] (const std::size_t index) const
 
qTypeoperator[] (const std::size_t index)
 
void push_back (const std::tuple< qType, Eigen::Index, std::vector< std::string > > &state)
 
void push_back (const qType &q_number, const Eigen::Index &inner_dim)
 
void push_back (const qType &q_number, const Eigen::Index &inner_dim, const std::vector< std::string > &idents)
 

Public Attributes

std::vector< std::tuple< qType, Eigen::Index, Basis > > data_
 
Eigen::Index curr_dim =0
 
std::unordered_map< qType, std::vector< fuseData > > history
 

Private Types

typedef Symmetry::qType qType
 

Member Typedef Documentation

◆ qType

template<typename Symmetry >
typedef Symmetry::qType Qbasis< Symmetry >::qType
private

Definition at line 40 of file Qbasis.h.

Constructor & Destructor Documentation

◆ Qbasis() [1/3]

template<typename Symmetry >
Qbasis< Symmetry >::Qbasis ( )
inline

Does nothing.

Definition at line 45 of file Qbasis.h.

◆ Qbasis() [2/3]

template<typename Symmetry >
template<typename Container >
Qbasis< Symmetry >::Qbasis ( const Container &  qins,
const Eigen::Index &  dim 
)
inline

Inserts all quantum numbers in the Container qins with constant dimension dim into the basis.

Definition at line 51 of file Qbasis.h.

◆ Qbasis() [3/3]

template<typename Symmetry >
Qbasis< Symmetry >::Qbasis ( const vector< qarray< Symmetry::Nq > > &  base_input)
inline

Construct the basis from an object as used in Mpo, Mps for qloc.

Definition at line 62 of file Qbasis.h.

Member Function Documentation

◆ add()

template<typename Symmetry >
Qbasis< Symmetry > Qbasis< Symmetry >::add ( const Qbasis< Symmetry > &  other) const

Adds to bases together.

Definition at line 639 of file Qbasis.h.

◆ begin()

template<typename Symmetry >
std::vector< std::tuple< qType, Eigen::Index, Basis > >::iterator Qbasis< Symmetry >::begin ( )
inline

Definition at line 186 of file Qbasis.h.

◆ cbegin()

template<typename Symmetry >
std::vector< std::tuple< qType, Eigen::Index, Basis > >::const_iterator Qbasis< Symmetry >::cbegin ( ) const
inline

Definition at line 189 of file Qbasis.h.

◆ cend()

template<typename Symmetry >
std::vector< std::tuple< qType, Eigen::Index, Basis > >::const_iterator Qbasis< Symmetry >::cend ( ) const
inline

Definition at line 190 of file Qbasis.h.

◆ clear()

template<typename Symmetry >
void Qbasis< Symmetry >::clear ( )
inline

Completely clear the basis.

Definition at line 147 of file Qbasis.h.

◆ combine()

template<typename Symmetry >
Qbasis< Symmetry > Qbasis< Symmetry >::combine ( const Qbasis< Symmetry > &  other,
bool  FLIP = false 
) const

Returns the tensor product basis, already properly sorted with respect to the resulting irreps. This function also saves the history of the combination process for later use. See leftAmount() and rightAmount().

Definition at line 685 of file Qbasis.h.

◆ Dmax()

template<typename Symmetry >
std::size_t Qbasis< Symmetry >::Dmax

Returns the largest state sector.

Definition at line 256 of file Qbasis.h.

◆ end()

template<typename Symmetry >
std::vector< std::tuple< qType, Eigen::Index, Basis > >::iterator Qbasis< Symmetry >::end ( )
inline

Definition at line 187 of file Qbasis.h.

◆ find() [1/3]

template<typename Symmetry >
Symmetry::qType Qbasis< Symmetry >::find ( const Eigen::Index &  num) const

Returns the quantum number of the state with number num.

Cosmetic Todo:
Bad name for this function...

Definition at line 308 of file Qbasis.h.

◆ find() [2/3]

template<typename Symmetry >
bool Qbasis< Symmetry >::find ( const qType q) const

Checks whether states with quantum number q are in the basis. Returns true if the state is present.

Definition at line 322 of file Qbasis.h.

◆ find() [3/3]

template<typename Symmetry >
Symmetry::qType Qbasis< Symmetry >::find ( const std::string &  ident) const

Returns the quantum number of the state with ident ident.

Cosmetic Todo:
Bad name for this function...

Definition at line 296 of file Qbasis.h.

◆ fullM()

template<typename Symmetry >
std::size_t Qbasis< Symmetry >::fullM ( ) const
inline

Returns the full number of basis states. If irreps has internal states, the basis states transforming under this irreps are multiplied by this degeneracy.

Definition at line 86 of file Qbasis.h.

◆ inner_dim() [1/2]

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::inner_dim ( const Eigen::Index &  num_in) const

Definition at line 390 of file Qbasis.h.

◆ inner_dim() [2/2]

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::inner_dim ( const qType q) const

Definition at line 364 of file Qbasis.h.

◆ inner_num()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::inner_num ( const Eigen::Index &  outer_num) const

Definition at line 334 of file Qbasis.h.

◆ leftAmount()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::leftAmount ( const qType qnew,
const std::array< qType, 2 > &  qold 
) const

Definition at line 420 of file Qbasis.h.

◆ leftOffset()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::leftOffset ( const qType qnew,
const std::array< qType, 2 > &  qold,
const std::array< Eigen::Index, 2 > &  plain_old 
) const

Definition at line 439 of file Qbasis.h.

◆ location()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::location ( const std::string &  ident) const

Definition at line 352 of file Qbasis.h.

◆ M()

template<typename Symmetry >
std::size_t Qbasis< Symmetry >::M ( ) const
inline

Convinient name for the size() function, when the basis is used for the auxilary legs of an Mps tensor.

Definition at line 80 of file Qbasis.h.

◆ Nq()

template<typename Symmetry >
std::size_t Qbasis< Symmetry >::Nq ( ) const
inline

Returns the number of quantum numbers (irreps) contained in this basis.

Definition at line 92 of file Qbasis.h.

◆ operator==()

template<typename Symmetry >
bool Qbasis< Symmetry >::operator== ( const Qbasis< Symmetry > &  other) const

Definition at line 632 of file Qbasis.h.

◆ operator[]() [1/2]

template<typename Symmetry >
qType & Qbasis< Symmetry >::operator[] ( const std::size_t  index)
inline

Returns the quantum number which is located at index in the data_ member.

Definition at line 109 of file Qbasis.h.

◆ operator[]() [2/2]

template<typename Symmetry >
qType Qbasis< Symmetry >::operator[] ( const std::size_t  index) const
inline

Returns the quantum number which is located at index in the data_ member.

Definition at line 108 of file Qbasis.h.

◆ outer_num()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::outer_num ( const qType q) const

Definition at line 377 of file Qbasis.h.

◆ print()

template<typename Symmetry >
std::string Qbasis< Symmetry >::print

Prints the basis.

Definition at line 801 of file Qbasis.h.

◆ printHistory()

template<typename Symmetry >
std::string Qbasis< Symmetry >::printHistory

Prints the history.

Definition at line 845 of file Qbasis.h.

◆ pullData() [1/4]

template<typename Symmetry >
void Qbasis< Symmetry >::pullData ( const std::vector< qarray< Symmetry::Nq > > &  qs)

Definition at line 572 of file Qbasis.h.

◆ pullData() [2/4]

template<typename Symmetry >
void Qbasis< Symmetry >::pullData ( const std::vector< std::array< qType, 3 > > &  qvec,
const std::size_t &  leg,
const Eigen::Index &  inner_dim_in 
)

Definition at line 554 of file Qbasis.h.

◆ pullData() [3/4]

template<typename Symmetry >
template<typename MatrixType >
void Qbasis< Symmetry >::pullData ( const vector< Biped< Symmetry, MatrixType > > &  A,
const Eigen::Index &  leg 
)

Pulls the info from a given MPS site tensor A. If leg=0 the basis from the incoming leg is pulled. If leg=1 from the outgoing.

Definition at line 485 of file Qbasis.h.

◆ pullData() [4/4]

template<typename Symmetry >
template<typename MatrixType >
void Qbasis< Symmetry >::pullData ( const vector< vector< vector< Biped< Symmetry, MatrixType > > > > &  W,
const Eigen::Index &  leg 
)

Definition at line 519 of file Qbasis.h.

◆ push_back() [1/3]

template<typename Symmetry >
void Qbasis< Symmetry >::push_back ( const qType q_number,
const Eigen::Index &  inner_dim 
)

Insert the state into the basis.

Definition at line 221 of file Qbasis.h.

◆ push_back() [2/3]

template<typename Symmetry >
void Qbasis< Symmetry >::push_back ( const qType q_number,
const Eigen::Index &  inner_dim,
const std::vector< std::string > &  idents 
)

Insert the state into the basis.

Definition at line 229 of file Qbasis.h.

◆ push_back() [3/3]

template<typename Symmetry >
void Qbasis< Symmetry >::push_back ( const std::tuple< qType, Eigen::Index, std::vector< std::string > > &  state)

Insert the state into the basis.

Definition at line 213 of file Qbasis.h.

◆ qloc()

template<typename Symmetry >
const std::vector< typename Symmetry::qType > Qbasis< Symmetry >::qloc

Returns a vector of size size(), where for every entry of the vector the quantum number (irrep) is inserted to the vector.

Definition at line 269 of file Qbasis.h.

◆ qs()

template<typename Symmetry >
const std::vector< typename Symmetry::qType > Qbasis< Symmetry >::qs

Returns a vector containing all quantum numbers (irreps) contained in the basis. The size of the vector is Nq().

Definition at line 278 of file Qbasis.h.

◆ rightAmount()

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::rightAmount ( const qType qnew,
const std::array< qType, 2 > &  qold 
) const

Definition at line 402 of file Qbasis.h.

◆ setHistoryEntry()

template<typename Symmetry >
void Qbasis< Symmetry >::setHistoryEntry ( const qType Qval,
const qType Q1,
const qType Q2,
Eigen::Index  dim 
)

Sets the history of a Qbasis which only has one quantum number Qval with inner dimension 1 so that the quantum number is arised from combining Q1 and Q2

Definition at line 673 of file Qbasis.h.

◆ size()

template<typename Symmetry >
std::size_t Qbasis< Symmetry >::size ( ) const
inline

Returns the number of (reduced) basis states.

Definition at line 77 of file Qbasis.h.

◆ sort()

template<typename Symmetry >
void Qbasis< Symmetry >::sort

Definition at line 600 of file Qbasis.h.

◆ swap()

template<typename Symmetry >
void Qbasis< Symmetry >::swap ( Qbasis< Symmetry > &  other)
inline

Swaps with another Qbasis.

Definition at line 193 of file Qbasis.h.

◆ unordered_qs()

template<typename Symmetry >
const std::unordered_set< typename Symmetry::qType > Qbasis< Symmetry >::unordered_qs

Same as qs(), but the quantum numbers are inserted to an std::unordered_set.

Definition at line 287 of file Qbasis.h.

Member Data Documentation

◆ curr_dim

template<typename Symmetry >
Eigen::Index Qbasis< Symmetry >::curr_dim =0

Definition at line 208 of file Qbasis.h.

◆ data_

template<typename Symmetry >
std::vector<std::tuple<qType,Eigen::Index,Basis> > Qbasis< Symmetry >::data_

Definition at line 207 of file Qbasis.h.

◆ history

template<typename Symmetry >
std::unordered_map<qType,std::vector<fuseData> > Qbasis< Symmetry >::history

Definition at line 209 of file Qbasis.h.


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