VMPS++
Loading...
Searching...
No Matches
Multipede< Nlegs, Symmetry, MatrixType > Struct Template Reference

Detailed Description

template<size_t Nlegs, typename Symmetry, typename MatrixType>
struct Multipede< Nlegs, Symmetry, MatrixType >

General tensor with quantum number blocks.

Template Parameters
Nlegs: Amount of tensor legs, must be >=2. A two-legged tensor is coded separately as Biped.
Symmetry: A class providing all relevant functions and infos that are determined by the Symmetry. Click here for more information.
MatrixType: MatrixXd or MatrixXcd
Note
special typedefs not caught by Doxygen:
Tripod<Symmetry,MatrixType> (Nlegs=3, e.g. the transfer matrix in $\left<\Psi|H|\Psi\right>$)
Quadruped<Symmetry,MatrixType> (Nlegs=4, e.g. the transfer matrix in $\left<\Psi|H^2|\Psi\right>$).

Definition at line 32 of file Multipede.h.

#include <Multipede.h>

Public Types

typedef Symmetry::qType qType
 
typedef MatrixType::Scalar Scalar
 

Public Member Functions

 Multipede ()
 
 Multipede (const Biped< Symmetry, MatrixType > &B, qType Q=Symmetry::qvacuum())
 
constexpr size_t rank () const
 
Multipede< Nlegs, Symmetry, MatrixType > & operator= (const Multipede< Nlegs, Symmetry, MatrixType > &Vin)
 
double memory (MEMUNIT memunit=GB) const
 
double overhead (MEMUNIT memunit=MB) const
 
string dict_info () const
 
string print (const bool &SHOW_MATRICES=false, const size_t &precision=3) const
 
void clear ()
 
void setZero ()
 
void setVacuum ()
 
void setTarget (std::array< qType, Nlegs > Q)
 
void setTarget (vector< std::array< qType, Nlegs > > Q)
 
void setIdentity (size_t Drows, size_t Dcols, size_t amax=1, size_t bmax=1)
 
void setIdentity (size_t amax, size_t bmax, const Qbasis< Symmetry > &base, const qarray< Symmetry::Nq > &Q=Symmetry::qvacuum())
 
void addScale (const Scalar &factor, const Multipede< Nlegs, Symmetry, MatrixType > &Mrhs)
 
void save (string filename, bool PRINT=false) const
 
void load (string filename, bool PRINT=false)
 
qType in (size_t q) const
 
qType out (size_t q) const
 
qType mid (size_t q) const
 
qType bot (size_t q) const
 
qType top (size_t q) const
 
void push_back (std::array< qType, Nlegs > quple, const boost::multi_array< MatrixType, LEGLIMIT > &M)
 
void push_back (std::initializer_list< qType > qlist, const boost::multi_array< MatrixType, LEGLIMIT > &M)
 
void insert (std::pair< qType, size_t > ab, const Multipede< Nlegs, Symmetry, MatrixType > &Trhs)
 
template<typename OtherMatrixType >
Multipede< Nlegs, Symmetry, OtherMatrixType > cast () const
 
Scalar compare (const Multipede< Nlegs, Symmetry, MatrixType > &Mrhs) const
 
Biped< Symmetry, MatrixType > BipedSliceQmid (qType qslice=Symmetry::qvacuum()) const
 
size_t dim = 0
 
vector< std::array< qType, Nlegs > > index
 
vector< boost::multi_array< MatrixType, LEGLIMIT > > block
 
unordered_map< std::array< qType, Nlegs >, size_t > dict
 
std::size_t size () const
 

Member Typedef Documentation

◆ qType

template<size_t Nlegs, typename Symmetry , typename MatrixType >
typedef Symmetry::qType Multipede< Nlegs, Symmetry, MatrixType >::qType

Definition at line 34 of file Multipede.h.

◆ Scalar

template<size_t Nlegs, typename Symmetry , typename MatrixType >
typedef MatrixType::Scalar Multipede< Nlegs, Symmetry, MatrixType >::Scalar

Definition at line 35 of file Multipede.h.

Constructor & Destructor Documentation

◆ Multipede() [1/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
Multipede< Nlegs, Symmetry, MatrixType >::Multipede ( )
inline

Definition at line 37 of file Multipede.h.

◆ Multipede() [2/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
Multipede< Nlegs, Symmetry, MatrixType >::Multipede ( const Biped< Symmetry, MatrixType > &  B,
qType  Q = Symmetry::qvacuum() 
)
inlineexplicit

Converts a Biped to a Tripod, adding a trivial middle leg equal to the vacuum. Made explicit to prohibit automatic conversion between Biped and Multipede.

Definition at line 43 of file Multipede.h.

Member Function Documentation

◆ addScale()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::addScale ( const Scalar factor,
const Multipede< Nlegs, Symmetry, MatrixType > &  Mrhs 
)

Deletes the contents of index, block, dict.

Definition at line 257 of file Multipede.h.

◆ BipedSliceQmid()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
Biped< Symmetry, MatrixType > Multipede< Nlegs, Symmetry, MatrixType >::BipedSliceQmid ( qType  qslice = Symmetry::qvacuum()) const

Takes Biped-slice from a Tripod over the middle quantum number qslice.

Definition at line 716 of file Multipede.h.

◆ bot()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
qType Multipede< Nlegs, Symmetry, MatrixType >::bot ( size_t  q) const
inline

Convenience function to return a quantum number of the block q to preserve the sanity of the programmer. For the naming convention see Multipede::index.

Definition at line 156 of file Multipede.h.

◆ cast()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
template<typename OtherMatrixType >
Multipede< Nlegs, Symmetry, OtherMatrixType > Multipede< Nlegs, Symmetry, MatrixType >::cast ( ) const
inline

Casts tensors to OtherMatrixType, i.e. usually from real to complex.

Definition at line 180 of file Multipede.h.

◆ clear()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::clear

Deletes the contents of index, block, dict.

Definition at line 408 of file Multipede.h.

◆ compare()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
MatrixType::Scalar Multipede< Nlegs, Symmetry, MatrixType >::compare ( const Multipede< Nlegs, Symmetry, MatrixType > &  Mrhs) const

Shifts qin and qout by Q, qmid is unchanged Shifts qmid and qout by Q, qin is unchanged

Definition at line 698 of file Multipede.h.

◆ dict_info()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
string Multipede< Nlegs, Symmetry, MatrixType >::dict_info

Prints Multipede<Nlegs,Symmetry,MatrixType>::dict into a string.

Definition at line 359 of file Multipede.h.

◆ in()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
qType Multipede< Nlegs, Symmetry, MatrixType >::in ( size_t  q) const
inline

Convenience function to return a quantum number of the block q to preserve the sanity of the programmer. For the naming convention see Multipede::index.

Definition at line 152 of file Multipede.h.

◆ insert()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::insert ( std::pair< qType, size_t >  ab,
const Multipede< Nlegs, Symmetry, MatrixType > &  Trhs 
)

Adds a new block to the tensor specified by the incoming quantum numbers quple.

Warning
Does not check whether the block for these quantum numbers already exists.

Definition at line 555 of file Multipede.h.

◆ load()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::load ( string  filename,
bool  PRINT = false 
)

Definition at line 797 of file Multipede.h.

◆ memory()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
double Multipede< Nlegs, Symmetry, MatrixType >::memory ( MEMUNIT  memunit = GB) const

Calculates the (theoretically) allocated memory (note: by default in GB).

Definition at line 374 of file Multipede.h.

◆ mid()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
qType Multipede< Nlegs, Symmetry, MatrixType >::mid ( size_t  q) const
inline

Convenience function to return a quantum number of the block q to preserve the sanity of the programmer. For the naming convention see Multipede::index.

Definition at line 154 of file Multipede.h.

◆ operator=()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
Multipede< Nlegs, Symmetry, MatrixType > & Multipede< Nlegs, Symmetry, MatrixType >::operator= ( const Multipede< Nlegs, Symmetry, MatrixType > &  Vin)
inline

Definition at line 216 of file Multipede.h.

◆ out()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
qType Multipede< Nlegs, Symmetry, MatrixType >::out ( size_t  q) const
inline

Convenience function to return a quantum number of the block q to preserve the sanity of the programmer. For the naming convention see Multipede::index.

Definition at line 153 of file Multipede.h.

◆ overhead()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
double Multipede< Nlegs, Symmetry, MatrixType >::overhead ( MEMUNIT  memunit = MB) const

Calculates the (theoretical) additional memory associated with the subspace blocks (note: by default in MB).

Definition at line 387 of file Multipede.h.

◆ print()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
std::string Multipede< Nlegs, Symmetry, MatrixType >::print ( const bool &  SHOW_MATRICES = false,
const size_t &  precision = 3 
) const

Calculates the (theoretically) allocated memory (note: by default in GB).

Definition at line 593 of file Multipede.h.

◆ push_back() [1/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::push_back ( std::array< qType, Nlegs >  quple,
const boost::multi_array< MatrixType, LEGLIMIT > &  M 
)

Adds a new block to the tensor specified by the incoming quantum numbers quple.

Warning
Does not check whether the block for these quantum numbers already exists.

Definition at line 438 of file Multipede.h.

◆ push_back() [2/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::push_back ( std::initializer_list< qType qlist,
const boost::multi_array< MatrixType, LEGLIMIT > &  M 
)

Adds a new block to the tensor specified by the initializer list qlist (must be of size Nlegs). For the ordering convention see Multipede::index.

Warning
Does not check whether the block for these quantum numbers already exists.

Definition at line 452 of file Multipede.h.

◆ rank()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
constexpr size_t Multipede< Nlegs, Symmetry, MatrixType >::rank ( ) const
inlineconstexpr

Const reference to the number of legs Nlegs

Definition at line 59 of file Multipede.h.

◆ save()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::save ( string  filename,
bool  PRINT = false 
) const

Definition at line 734 of file Multipede.h.

◆ setIdentity() [1/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setIdentity ( size_t  amax,
size_t  bmax,
const Qbasis< Symmetry > &  base,
const qarray< Symmetry::Nq > &  Q = Symmetry::qvacuum() 
)

Deletes the contents of index, block, dict.

Definition at line 529 of file Multipede.h.

◆ setIdentity() [2/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setIdentity ( size_t  Drows,
size_t  Dcols,
size_t  amax = 1,
size_t  bmax = 1 
)

Deletes the contents of index, block, dict.

Definition at line 508 of file Multipede.h.

◆ setTarget() [1/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setTarget ( std::array< qType, Nlegs >  Q)

Creates a single block of size 1x1 containing 1 and the corresponding quantum numbers according to the input Q. Needed for the transfer matrix from the last site in matrix element calculations.

Definition at line 479 of file Multipede.h.

◆ setTarget() [2/2]

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setTarget ( vector< std::array< qType, Nlegs > >  Q)

Deletes the contents of index, block, dict.

Definition at line 492 of file Multipede.h.

◆ setVacuum()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setVacuum

Creates a single block of size 1x1 containing 1 and the corresponding quantum numbers to the vacuum (all of them). Needed in for the transfer matrix to the first site in matrix element calculations.

Definition at line 462 of file Multipede.h.

◆ setZero()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
void Multipede< Nlegs, Symmetry, MatrixType >::setZero

Sets all matrices in Multipede<Nlegs,Symmetry,MatrixType>::block to zero, preserving the rows and columns.

Definition at line 397 of file Multipede.h.

◆ size()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
std::size_t Multipede< Nlegs, Symmetry, MatrixType >::size ( ) const
inline

Convenience access to the amount of blocks. Equal to either of the following: index.size(), block.size()

Definition at line 67 of file Multipede.h.

◆ top()

template<size_t Nlegs, typename Symmetry , typename MatrixType >
qType Multipede< Nlegs, Symmetry, MatrixType >::top ( size_t  q) const
inline

Convenience function to return a quantum number of the block q to preserve the sanity of the programmer. For the naming convention see Multipede::index.

Definition at line 157 of file Multipede.h.

Member Data Documentation

◆ block

template<size_t Nlegs, typename Symmetry , typename MatrixType >
vector<boost::multi_array<MatrixType,LEGLIMIT> > Multipede< Nlegs, Symmetry, MatrixType >::block

Vector of quantum number blocks. The matrix block[q] is characterized by the quantum number array index[q]. Since the handling of template-sized arrays is no fun at all, the implementation is done in the following way: block[q] is always a boost multi_array of dimension LEGLIMIT which is set = 2. Tripods need only one dimension (two are already absorbed into MatrixType), therefore the rest needs to be set to 1 and the access goes by T.block[q][a][0]. LEGLIMIT can be increased and some code adjustment can be made (filling in dummy "[0]") if bigger tensors are required.

Definition at line 88 of file Multipede.h.

◆ dict

template<size_t Nlegs, typename Symmetry , typename MatrixType >
unordered_map<std::array<qType,Nlegs>,size_t> Multipede< Nlegs, Symmetry, MatrixType >::dict

Dictionary allowing one to find the index of block for a given array of Nlegs quantum numbers in $O(1)$ operations without looping over the blocks. For the ordering convention see Multipede::index.

Definition at line 95 of file Multipede.h.

◆ dim

template<size_t Nlegs, typename Symmetry , typename MatrixType >
size_t Multipede< Nlegs, Symmetry, MatrixType >::dim = 0

Convenience access to the amount of blocks. Equal to either of the following: index.size(), block.size()

Definition at line 66 of file Multipede.h.

◆ index

template<size_t Nlegs, typename Symmetry , typename MatrixType >
vector<std::array<qType,Nlegs> > Multipede< Nlegs, Symmetry, MatrixType >::index

Vector of all incoming quantum numbers. The entries are arrays of size Nlegs. The sorting is according to the following convention:

  1. incoming 2. outgoing 3. middle (Nlegs=3)
  1. incoming 2. outgoing 3. bottom 4. top (Nlegs=4) The middle, bottom and top quantum numbers are always outgoing for the left transfer matrix and incoming for the right transfer matrix in matrix element calculations.

Definition at line 77 of file Multipede.h.


The documentation for this struct was generated from the following file: