SyTen
syten::BTT::Operator Class Reference

A tree tensor network operator. More...

#include <btt_operator.h>

+ Inheritance diagram for syten::BTT::Operator:
+ Collaboration diagram for syten::BTT::Operator:

Public Types

enum  DropUnmatched { Yes, No }
 Whether to drop blocks not contained in the neighbouring nodes. More...
 
- Public Types inherited from syten::BinaryTree::Tree< Tensor< 5 > >
typedef BinaryTree::Node< ValueNode
 Type of nodes. More...
 
typedef NodePtr
 Type of pointers to nodes. More...
 
typedef Tensor< 5 > Value
 Type of values contained in the tree. More...
 

Public Member Functions

void project (Sector const &sec)
 Projects the operator onto the given quantum number sector. More...
 
Tensor access
Tensor< 5 > & operator() (std::string const &coordinate)
 Return the local operator component at that coordinate. More...
 
Tensor< 5 > const & operator() (std::string const &coordinate) const
 Return the local operator component at that coordinate. More...
 
Tensor< 5 > & operator() (std::array< Index, 2 > const &coordinate)
 Return the local operator component at that coordinate. More...
 
Tensor< 5 > const & operator() (std::array< Index, 2 > const &coordinate) const
 Return the local operator component at that coordinate. More...
 
template<typename T >
void operator() (T) const =delete
 Explicitly deletes all other operator() to avoid implicit int-to-string conversion when erroneously called as operator(0) (which would be valid for MPOs). More...
 
Dropping of tensor blocks
void drop_all ()
 Drops all blocks on all tensors, i.e. sets the state to zero. More...
 
SRDef drop_unmatched (Ptr ptr)
 Compares the node ptr against all neighbours and drops unmatched blocks. More...
 
SRDef drop_unmatched_a (Ptr ptr)
 Compares the node ptr against its A-child if it exists and drops unmatched blocks in ptr More...
 
SRDef drop_unmatched_b (Ptr ptr)
 Compares the node ptr against its B-child if it exists and drops unmatched blocks in ptr More...
 
SRDef drop_unmatched_r (Ptr ptr)
 Compares the node ptr against its parent if it exists and drops unmatched blocks in ptr More...
 
SRDef drop_unmatched (Ptr ptr, BinaryTree::NodeType const type)
 Compares the node ptr against the specified neighbour and drops unmatched blocks in ptr More...
 
SRDef drop_unmatched_rec (Ptr ptr)
 Recursive helper for drop_unmatched() More...
 
SRDef drop_unmatched ()
 Drops unmatched blocks on all tensors. More...
 
Truncation, currently only supports TruncationType::Deparallelise
SRDef truncate ()
 
SRDef truncate_rec (Ptr ptr)
 Truncates the subtree starting at the specified node in largely the same fashion as for states, see BTT::State::truncate_rec() for details. More...
 
SRDef rnorm_node (Ptr ptr)
 Root-normalise the node pointed to by ptr. More...
 
SRDef anorm_node (Ptr ptr)
 A-normalises the node pointed to by ptr, i.e. it gives an identity when contracted with the "A"-legs left open. More...
 
SRDef bnorm_node (Ptr ptr)
 B-normalises the node pointed to by ptr, i.e. it gives an identity when contracted with the "B"-legs left open. More...
 
Product of two operators
void oper_mul_rec (Operator::Ptr tptr, const Operator::Ptr optr)
 Recursive helper for operator multiplication. More...
 
Operatoroperator*= (Operator const &other)
 Product of two operators \( \hat O \; \hat T \), *this will be applied first to the state. More...
 
Addition of two operators
void oper_add_rec (Operator::Ptr tptr, const Operator::Ptr optr)
 Recursive helper for operator addition. More...
 
Operatoroperator+= (Operator const &other)
 Adds the argument to *this More...
 
Operatoroperator-= (Operator const &other)
 Subtracts the argument from *this More...
 
Operatoroperator-= (Operator &&other)
 Subtracts the argument from *this More...
 
- Public Member Functions inherited from syten::BinaryTree::Tree< Tensor< 5 > >
MemoryUsage::MemorySize allocSize () const
 Returns the total size in bytes allocated for this tree. More...
 
Treeoperator= (Tree const &other)
 Copy assignment operator. More...
 
Treeoperator= (Tree &&other)
 Move assignment operator. More...
 
void serialize (Archive &ar, unsigned int const in_version)
 Boost serialisation, recursive as usual. More...
 
 Tree ()
 Default ctor with empty root node. More...
 
 Tree (Args... args)
 Standard ctor. More...
 
 Tree (Tree &&other)
 Move ctor. More...
 
 Tree (Tree const &other)
 Copy ctor (deep-copies) More...
 
 ~Tree ()
 Dtor. More...
 
Nodego_down (Node *ptr, Index steps) const
 Returns the steps-th child of *ptr, provided that there are no branches. More...
 
Nodeoperator[] (std::string const &coordinate) const
 Returns a pointer to the node specified by coordinate. More...
 
Ptr operator[] (std::array< Index, 2 > const &coordinate) const
 Returns a pointer to the node specified by the two-index coordinate. More...
 
Ptr operator[] (std::initializer_list< Index > list) const
 Returns a pointer to the node specified by the two-index coordinate. More...
 
Ptr last_fork (Ptr leaf) const
 Returns a pointer to the last fork on the way to the specified node. More...
 
Ptr first_nonfork (Ptr leaf) const
 Returns a pointer to the first non-forking node in the non-forking branch that leads to leaf (i.e. one step further towards leaf than last_fork(leaf) More...
 
Ptr leaf (Index const which) const
 Returns a pointer to the which-th leaf of the tree. More...
 
std::result_of< Func(Ptr)>::type visit_bottom (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the left or right bottommost node. More...
 
std::result_of< Func(const Ptr)>::type visit_bottom (Func &&f, typename std::result_of< Func(const Ptr)>::type initial, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the left or right bottommost node for const trees. More...
 
void visit_bottom (Func &&f, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the left or right bottommost node. More...
 
void visit_bottom (Func &&f, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the left or right bottommost node for const trees. More...
 
std::result_of< Func(Value &)>::type visit_bottom (Func &&f, typename std::result_of< Func(Value &)>::type initial, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the left or right bottommost node. More...
 
std::result_of< Func(Value const &)>::type visit_bottom (Func &&f, typename std::result_of< Func(Value const &)>::type initial, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the left or right bottommost node for const trees. More...
 
std::result_of< Func(Ptr)>::type visit_top (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the root node. More...
 
std::result_of< Func(const Ptr)>::type visit_top (Func &&f, typename std::result_of< Func(Ptr)>::type initial, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the root node for const trees. More...
 
void visit_top (Func &&f, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the root node. More...
 
void visit_top (Func &&f, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the root node, for const trees. More...
 
std::result_of< Func(Value const &)>::type visit_top (Func &&f, typename std::result_of< Func(Value &)>::type initial, IterFirst const dir=IterFirst::Left)
 Visits each node, starting at the root node. More...
 
std::result_of< Func(Value const &)>::type visit_top (Func &&f, typename std::result_of< Func(Value const &)>::type initial, IterFirst const dir=IterFirst::Left) const
 Visits each node, starting at the root node, for const trees. More...
 

Static Public Attributes

static const std::array< Direction, 5 > dirs
 Incoming/outgoing bases convention. More...
 
Index numbering
static constexpr Index rIdx = 1
 Root-directed MPO index. More...
 
static constexpr Index aIdx = 2
 Left subtree ("A") MPO index. More...
 
static constexpr Index bIdx = 3
 Right subtree ("B") MPO index. More...
 
static constexpr Index uIdx = 4
 Upper physical index. More...
 
static constexpr Index dIdx = 5
 Lower physical index. More...
 
static constexpr int rInt = 1
 Root-directed MPO index. More...
 
static constexpr int aInt = 2
 Left subtree ("A") MPO index. More...
 
static constexpr int bInt = 3
 Right subtree ("B") MPO index. More...
 
static constexpr int uInt = 4
 Upper physical index. More...
 
static constexpr int dInt = 5
 Lower physical index. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from syten::BinaryTree::Tree< Tensor< 5 > >
static std::result_of< Func(Ptr)>::type visit_bottom_rec (Func &&f, typename std::result_of< Func(PtrType)>::type initial, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, bottom-first. More...
 
static std::result_of< Func(ValueType &)>::type visit_bottom_rec (Func &&f, typename std::result_of< Func(ValueType &)>::type initial, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, bottom-first. More...
 
static void visit_bottom_rec (Func &&f, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, bottom-first. More...
 
static std::result_of< Func(PtrType)>::type visit_top_rec (Func &&f, typename std::result_of< Func(PtrType)>::type initial, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, top-first for const trees. More...
 
static std::result_of< Func(ValueType &)>::type visit_top_rec (Func &&f, typename std::result_of< Func(ValueType &)>::type initial, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, top-first. More...
 
static void visit_top_rec (Func &&f, IterFirst const dir, PtrType ptr)
 Recursively visits a subtree, top-first. More...
 
- Public Attributes inherited from syten::BinaryTree::Tree< Tensor< 5 > >
Noder
 Root node of the tree. More...
 

Detailed Description

A tree tensor network operator.

Member Enumeration Documentation

◆ DropUnmatched

Whether to drop blocks not contained in the neighbouring nodes.

Member Function Documentation

◆ anorm_node()

SRDef syten::BTT::Operator::anorm_node ( Ptr  ptr)

A-normalises the node pointed to by ptr, i.e. it gives an identity when contracted with the "A"-legs left open.

References aIdx, aInt, bIdx, bInt, dIdx, dInt, drop_all(), drop_unmatched_a(), drop_unmatched_r(), syten::Tensor< rank >::empty(), std::isnan(), rIdx, rInt, syten::Deparallelise::rows(), SYTEN_ASSERT_DEBUG, uIdx, and uInt.

Referenced by truncate_rec().

+ Here is the caller graph for this function:

◆ bnorm_node()

SRDef syten::BTT::Operator::bnorm_node ( Ptr  ptr)

B-normalises the node pointed to by ptr, i.e. it gives an identity when contracted with the "B"-legs left open.

References aIdx, aInt, syten::Tensor< rank >::b(), bIdx, bInt, dIdx, dInt, drop_all(), drop_unmatched_b(), drop_unmatched_r(), syten::Tensor< rank >::empty(), std::isnan(), rIdx, rInt, syten::Deparallelise::rows(), SYTEN_ASSERT_DEBUG, uIdx, and uInt.

Referenced by truncate_rec().

+ Here is the caller graph for this function:

◆ drop_all()

void syten::BTT::Operator::drop_all ( )

Drops all blocks on all tensors, i.e. sets the state to zero.

References dirs, and syten::BinaryTree::Tree< Tensor< 5 > >::visit_bottom().

Referenced by anorm_node(), bnorm_node(), drop_unmatched_rec(), and truncate_rec().

+ Here is the caller graph for this function:

◆ drop_unmatched() [1/3]

SRDef syten::BTT::Operator::drop_unmatched ( Ptr  ptr)

Compares the node ptr against all neighbours and drops unmatched blocks.

Referenced by syten::BTT::dot(), and syten::BTT::operator*=().

+ Here is the caller graph for this function:

◆ drop_unmatched() [2/3]

SRDef syten::BTT::Operator::drop_unmatched ( Ptr  ptr,
BinaryTree::NodeType const  type 
)

Compares the node ptr against the specified neighbour and drops unmatched blocks in ptr

References SYTEN_ASSERT_DEBUG.

◆ drop_unmatched() [3/3]

SRDef syten::BTT::Operator::drop_unmatched ( )

Drops unmatched blocks on all tensors.

References drop_unmatched_rec(), syten::BinaryTree::Tree< Tensor< 5 > >::r, and truncate_rec().

Referenced by drop_unmatched_a(), drop_unmatched_b(), drop_unmatched_r(), drop_unmatched_rec(), operator*=(), operator+=(), and project().

+ Here is the caller graph for this function:

◆ drop_unmatched_a()

SRDef syten::BTT::Operator::drop_unmatched_a ( Ptr  ptr)

Compares the node ptr against its A-child if it exists and drops unmatched blocks in ptr

References drop_unmatched().

Referenced by anorm_node(), and drop_unmatched_rec().

+ Here is the caller graph for this function:

◆ drop_unmatched_b()

SRDef syten::BTT::Operator::drop_unmatched_b ( Ptr  ptr)

Compares the node ptr against its B-child if it exists and drops unmatched blocks in ptr

References drop_unmatched().

Referenced by bnorm_node(), and drop_unmatched_rec().

+ Here is the caller graph for this function:

◆ drop_unmatched_r()

SRDef syten::BTT::Operator::drop_unmatched_r ( Ptr  ptr)

Compares the node ptr against its parent if it exists and drops unmatched blocks in ptr

References drop_unmatched().

Referenced by anorm_node(), bnorm_node(), and rnorm_node().

+ Here is the caller graph for this function:

◆ drop_unmatched_rec()

SRDef syten::BTT::Operator::drop_unmatched_rec ( Ptr  ptr)

Recursive helper for drop_unmatched()

References drop_all(), drop_unmatched(), drop_unmatched_a(), drop_unmatched_b(), and std::isnan().

Referenced by drop_unmatched().

+ Here is the caller graph for this function:

◆ oper_add_rec()

void syten::BTT::Operator::oper_add_rec ( Operator::Ptr  tptr,
const Operator::Ptr  optr 
)

Recursive helper for operator addition.

References syten::expansion(), and SYTEN_ASSERT_DEBUG.

Referenced by operator+=().

+ Here is the caller graph for this function:

◆ oper_mul_rec()

void syten::BTT::Operator::oper_mul_rec ( Operator::Ptr  tptr,
const Operator::Ptr  optr 
)

Recursive helper for operator multiplication.

References aIdx, aInt, bIdx, bInt, dIdx, dInt, syten::genCombinator(), syten::genFuse(), syten::genSplit(), rIdx, rInt, SYTEN_ASSERT_DEBUG, uIdx, and uInt.

Referenced by operator*=().

+ Here is the caller graph for this function:

◆ operator()() [1/5]

Tensor< 5 > & syten::BTT::Operator::operator() ( std::string const &  coordinate)

Return the local operator component at that coordinate.

References syten::BinaryTree::Tree< Tensor< 5 > >::operator[](), and syten::BinaryTree::Node< T >::v.

◆ operator()() [2/5]

Tensor< 5 > const & syten::BTT::Operator::operator() ( std::string const &  coordinate) const

Return the local operator component at that coordinate.

References syten::BinaryTree::Tree< Tensor< 5 > >::operator[](), and syten::BinaryTree::Node< T >::v.

◆ operator()() [3/5]

Tensor< 5 > & syten::BTT::Operator::operator() ( std::array< Index, 2 > const &  coordinate)

Return the local operator component at that coordinate.

References syten::BinaryTree::Tree< Tensor< 5 > >::operator[](), and syten::BinaryTree::Node< T >::v.

◆ operator()() [4/5]

Tensor< 5 > const & syten::BTT::Operator::operator() ( std::array< Index, 2 > const &  coordinate) const

Return the local operator component at that coordinate.

References syten::BinaryTree::Tree< Tensor< 5 > >::operator[](), and syten::BinaryTree::Node< T >::v.

◆ operator()() [5/5]

template<typename T >
void syten::BTT::Operator::operator() ( ) const
delete

Explicitly deletes all other operator() to avoid implicit int-to-string conversion when erroneously called as operator(0) (which would be valid for MPOs).

◆ operator*=()

Operator & syten::BTT::Operator::operator*= ( Operator const &  other)

◆ operator+=()

◆ operator-=() [1/2]

Operator & syten::BTT::Operator::operator-= ( Operator const &  other)

Subtracts the argument from *this

◆ operator-=() [2/2]

Operator & syten::BTT::Operator::operator-= ( Operator &&  other)

Subtracts the argument from *this

◆ project()

void syten::BTT::Operator::project ( Sector const &  sec)

Projects the operator onto the given quantum number sector.

References syten::Tensor< rank >::add(), dirs, drop_unmatched(), std::move(), syten::BinaryTree::Tree< Tensor< 5 > >::r, rIdx, and syten::BinaryTree::Node< T >::v.

◆ rnorm_node()

SRDef syten::BTT::Operator::rnorm_node ( Ptr  ptr)

Root-normalise the node pointed to by ptr.

References syten::Deparallelise::cols(), drop_unmatched_r(), syten::Tensor< rank >::empty(), std::isnan(), rIdx, and SYTEN_ASSERT_DEBUG.

Referenced by truncate_rec().

+ Here is the caller graph for this function:

◆ truncate_rec()

SRDef syten::BTT::Operator::truncate_rec ( Ptr  ptr)

Truncates the subtree starting at the specified node in largely the same fashion as for states, see BTT::State::truncate_rec() for details.

References anorm_node(), bnorm_node(), drop_all(), std::isnan(), rnorm_node(), and syten::BinaryTree::Tree< Tensor< 5 > >::visit_bottom().

Referenced by drop_unmatched().

+ Here is the caller graph for this function:

Member Data Documentation

◆ aIdx

◆ aInt

const int syten::BTT::Operator::aInt = 2
static

◆ bIdx

◆ bInt

const int syten::BTT::Operator::bInt = 3
static

◆ dIdx

◆ dInt

const int syten::BTT::Operator::dInt = 5
static

◆ dirs

const std::array< Direction, 5 > syten::BTT::Operator::dirs
static
Initial value:

Incoming/outgoing bases convention.

Referenced by drop_all(), and project().

◆ rIdx

◆ rInt

const int syten::BTT::Operator::rInt = 1
static

◆ uIdx

◆ uInt

const int syten::BTT::Operator::uInt = 4
static

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