SyTen
syten::TensorBlock< rank > Class Template Reference

Represents one symmetry-protected block of a full tensor. More...

#include <tensorblock.h>

+ Collaboration diagram for syten::TensorBlock< rank >:

Public Types

typedef SparseTensor< rank, CDefCGC
 The sparse tensor type for the sparse/CGC tensors. More...
 
typedef std::vector< CGCCGCSet
 Type of the set of all CGC tensors. More...
 
typedef std::array< RDef, rank *SYTEN_MAX_SYM *SYTEN_MAX_DEGCmps
 Type of the set of labels used for comparison. More...
 
typedef DenseTensor< rank, SDefDense
 The dense tensor type for the reduced tensor. More...
 
typedef std::array< Sector, rankSym
 Type of the transformation definition of all legs in all symmetries. More...
 

Public Member Functions

MemoryUsage::MemorySize allocSize () const
 allocSize()/memory_size.h support. More...
 
template<typename TypeDense , typename TypeSym , typename TypeCGC >
 TensorBlock (TypeDense &&m_, TypeSym &&s_, TypeCGC &&c_)
 Standard ctor. More...
 
 TensorBlock ()=default
 Default ctor, mainly for boost serialisation. More...
 
template<typename TypeDense , typename TypeSym >
 TensorBlock (TypeDense &&m_, TypeSym &&s_)
 Standard ctor, default-initialises the CGC blocks (no non-abelian quantum numbers). More...
 
Symmetry sector information
std::array< Sector, rank > const & trans () const
 Returns the symmetry sector information of all legs. More...
 
Sector const & trans (Index leg) const
 Returns the symmetry sector information on the specified leg. More...
 
Rep const & trans (Index leg, Index sym) const
 Returns the irrep of the specified symmetry on the specified leg. More...
 
std::array< Sector, rank > && trans_m ()
 Returns the symmetry sector information of all legs as rvalue. More...
 
Sector && trans_m (Index d)
 Returns the symmetry sector information of the specified leg as rvalue. More...
 
void setTransform (std::array< Sector, rank > &&rep)
 Sets the transformation of all legs and updates the fast comparison list. More...
 
Index numSymmetries () const
 
Index numCGC () const
 
Comparison of sectors with other tensor blocks
bool eqTrans (TensorBlock const &other) const
 Returns true if *this and other transform equally on all legs. More...
 
template<Rank orank>
bool eqTrans (TensorBlock< orank > const &other, Index const ileg, Index ioleg) const
 Returns true if the leg-th leg of *this and the oleg-th leg of other transform equally. More...
 
Boost serialisation support
template<class Archive >
void save (Archive &ar, const unsigned int) const
 Serialising. More...
 
template<class Archive >
void load (Archive &ar, const unsigned int in_version)
 Deserialising. More...
 

Public Attributes

CGCSet c
 The set of all CGC spaces. More...
 
Cmps cmps
 A list of all labels on all legs, first all labels of the first leg, then all labels on the second leg etc. More...
 
Index cmps_size_per_leg = 0
 The number of entries in Cmps per leg. More...
 
bool isZero = true
 True if the tensor is identically zero. More...
 
Dense m
 The dense tensor/reduced multiplet. More...
 

Static Public Attributes

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

Private Member Functions

void updateTransform ()
 Call this to update the fast symmetry representation cmps after changing s. More...
 

Private Attributes

Sym s
 The actual irreps on each leg and symmetry, call updateTransform() after changing this. More...
 

Detailed Description

template<Rank rank>
class syten::TensorBlock< rank >

Represents one symmetry-protected block of a full tensor.

Consists of a reduced, dense tensor \( m \) and a set of CGC-tensors \( c_i \) , one for each symmetry. The full block \( b \) would be the tensor product \( b = m \otimes \left( \bigotimes_{i=1}^{\mathrm{\# Sym}} c_i \right) \).

The block transforms irreducibly on each leg in each symmetry sector. To avoid comparing large numbers of representations, we construct an optimised representation (namely just the set of labels) of the transformation properties. For this reason, the symmetry transform is not directly accessible and one has to use setter and getter functions. Sorry.

Member Typedef Documentation

◆ CGC

template<Rank rank>
typedef SparseTensor<rank, CDef> syten::TensorBlock< rank >::CGC

The sparse tensor type for the sparse/CGC tensors.

◆ CGCSet

template<Rank rank>
typedef std::vector<CGC> syten::TensorBlock< rank >::CGCSet

Type of the set of all CGC tensors.

◆ Cmps

template<Rank rank>
typedef std::array<RDef, rank * SYTEN_MAX_SYM * SYTEN_MAX_DEG> syten::TensorBlock< rank >::Cmps

Type of the set of labels used for comparison.

◆ Dense

template<Rank rank>
typedef DenseTensor<rank, SDef> syten::TensorBlock< rank >::Dense

The dense tensor type for the reduced tensor.

◆ Sym

template<Rank rank>
typedef std::array<Sector, rank> syten::TensorBlock< rank >::Sym

Type of the transformation definition of all legs in all symmetries.

Constructor & Destructor Documentation

◆ TensorBlock() [1/3]

template<Rank rank>
template<typename TypeDense , typename TypeSym , typename TypeCGC >
syten::TensorBlock< rank >::TensorBlock ( TypeDense &&  m_,
TypeSym &&  s_,
TypeCGC &&  c_ 
)
inline

Standard ctor.

Parameters
m_reduced tensor
s_vector of Sector informations for each leg
c_vector of CGC spaces for each symmetry

Enforcing type deduction on the arguments allows && to bind to const lvalue references as well as rvalue references. This happens independently for all three arguments, meaning I don't have to provide 8 different constructors :). std::forward is then used to forward the deduced type (either const& or &&) perfectly to the ctor of the member elements.

References syten::TensorBlock< rank >::updateTransform().

◆ TensorBlock() [2/3]

template<Rank rank>
template<typename TypeDense , typename TypeSym >
syten::TensorBlock< rank >::TensorBlock ( TypeDense &&  m_,
TypeSym &&  s_ 
)
inline

Standard ctor, default-initialises the CGC blocks (no non-abelian quantum numbers).

References syten::TensorBlock< rank >::updateTransform().

◆ TensorBlock() [3/3]

template<Rank rank>
syten::TensorBlock< rank >::TensorBlock ( )
default

Default ctor, mainly for boost serialisation.

Member Function Documentation

◆ allocSize()

template<Rank rank>
MemoryUsage::MemorySize syten::TensorBlock< rank >::allocSize ( ) const
inline

◆ eqTrans() [1/2]

template<Rank rank>
bool syten::TensorBlock< rank >::eqTrans ( TensorBlock< rank > const &  other) const
inline

Returns true if *this and other transform equally on all legs.

References syten::TensorBlock< rank >::cmps, and syten::rank().

Referenced by syten::checkedAddParallel(), and syten::trace().

+ Here is the caller graph for this function:

◆ eqTrans() [2/2]

template<Rank rank>
template<Rank orank>
bool syten::TensorBlock< rank >::eqTrans ( TensorBlock< orank > const &  other,
Index const  ileg,
Index  ioleg 
) const
inline

Returns true if the leg-th leg of *this and the oleg-th leg of other transform equally.

References syten::TensorBlock< rank >::cmps, syten::TensorBlock< rank >::cmps_size_per_leg, syten::rank(), and SYTEN_ASSERT_DEBUG.

◆ load()

◆ save()

template<Rank rank>
template<class Archive >
void syten::TensorBlock< rank >::save ( Archive &  ar,
const unsigned  int 
) const
inline

◆ setTransform()

template<Rank rank>
void syten::TensorBlock< rank >::setTransform ( std::array< Sector, rank > &&  rep)
inline

Sets the transformation of all legs and updates the fast comparison list.

References std::array< T >::size(), std::vector< T >::size(), and syten::TensorBlock< rank >::updateTransform().

◆ trans() [1/3]

template<Rank rank>
std::array<Sector, rank> const& syten::TensorBlock< rank >::trans ( ) const
inline

Returns the symmetry sector information of all legs.

References syten::TensorBlock< rank >::s.

Referenced by syten::is_perm_fermionic().

+ Here is the caller graph for this function:

◆ trans() [2/3]

template<Rank rank>
Sector const& syten::TensorBlock< rank >::trans ( Index  leg) const
inline

Returns the symmetry sector information on the specified leg.

References SYTEN_ASSERT_DEBUG.

◆ trans() [3/3]

template<Rank rank>
Rep const& syten::TensorBlock< rank >::trans ( Index  leg,
Index  sym 
) const
inline

Returns the irrep of the specified symmetry on the specified leg.

References SYTEN_ASSERT_DEBUG.

◆ trans_m() [1/2]

template<Rank rank>
std::array<Sector, rank>&& syten::TensorBlock< rank >::trans_m ( )
inline

Returns the symmetry sector information of all legs as rvalue.

References std::move().

◆ trans_m() [2/2]

template<Rank rank>
Sector&& syten::TensorBlock< rank >::trans_m ( Index  d)
inline

Returns the symmetry sector information of the specified leg as rvalue.

References std::move(), and SYTEN_ASSERT_DEBUG.

◆ updateTransform()

template<Rank rank>
void syten::TensorBlock< rank >::updateTransform ( )
inlineprivate

Call this to update the fast symmetry representation cmps after changing s.

References std::array< T >::fill(), syten::hasCGC(), std::move(), syten::rank(), std::vector< T >::size(), SYTEN_ASSERT_MSG, and SYTEN_WARN_MSG.

Referenced by syten::TensorBlock< rank >::load(), syten::TensorBlock< rank >::setTransform(), and syten::TensorBlock< rank >::TensorBlock().

+ Here is the caller graph for this function:

Member Data Documentation

◆ c

◆ cmps

template<Rank rank>
Cmps syten::TensorBlock< rank >::cmps

A list of all labels on all legs, first all labels of the first leg, then all labels on the second leg etc.

Referenced by syten::TensorBlock< rank >::eqTrans().

◆ cmps_size_per_leg

template<Rank rank>
Index syten::TensorBlock< rank >::cmps_size_per_leg = 0

The number of entries in Cmps per leg.

Total number of used entries is cmps_size_per_leg × rank.

Referenced by syten::TensorBlock< rank >::eqTrans().

◆ isZero

template<Rank rank>
bool syten::TensorBlock< rank >::isZero = true

◆ m

◆ s

template<Rank rank>
Sym syten::TensorBlock< rank >::s
private

The actual irreps on each leg and symmetry, call updateTransform() after changing this.

Referenced by syten::TensorBlock< rank >::load(), syten::TensorBlock< rank >::save(), and syten::TensorBlock< rank >::trans().

◆ version

template<Rank rank>
constexpr unsigned int syten::TensorBlock< rank >::version = 2
static

Boost serialisation version.


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