The ChainCon Software (Release 0.03)
Public Types | Public Member Functions | Private Attributes | List of all members
tTensor< Cell1T, Cell2T, CoefT > Class Template Reference

Tensor of chains. More...

#include <tensor.h>

Public Types

typedef Cell1T Cell1Type
 The type of left cells in the tensor. More...
 
typedef Cell2T Cell2Type
 The type of right cells in the tensor. More...
 
typedef CoefT CoefType
 The type of coefficients in the chain. More...
 

Public Member Functions

 tTensor ()
 The default constructor of an empty tensor. More...
 
int_t size () const
 Returns the number of elements in the tensor. More...
 
bool empty () const
 Returns true if and only if the tensor is zero (empty set). More...
 
const Cell1T & left (int_t n) const
 Returns the n-th left element of the tensor. More...
 
const Cell2T & right (int_t n) const
 Returns the n-th right element of the tensor. More...
 
const CoefT & coef (int_t n) const
 Returns the n-th coefficient in the tensor. More...
 
void add (const Cell1T &c1, const Cell2T &c2, const CoefT &coef)
 Adds a pair of cells to the tensor. More...
 
void add (const tChain< Cell1T, CoefT > &c1, const tChain< Cell2T, CoefT > &c2)
 Adds a pair of chains to the tensor. More...
 
tTensor< Cell1T, Cell2T, CoefT > & operator+= (const tTensor< Cell1T, Cell2T, CoefT > &ch)
 Adds a given tensor to the tensor. More...
 
tTensor< Cell1T, Cell2T, CoefT > & operator*= (const CoefT &coef)
 Multiples the tensor by a given coefficient. More...
 
bool operator== (const tTensor< Cell1T, Cell2T, CoefT > &ch) const
 Compares if the two tensors are equal. More...
 
void swap (tTensor< Cell1T, Cell2T, CoefT > &ch)
 Swaps the data with another tensor. More...
 

Private Attributes

tChain< tPair< Cell1T, Cell2T >, CoefT > tensor
 The set of elements in the tensor. More...
 

Detailed Description

template<class Cell1T, class Cell2T, class CoefT>
class tTensor< Cell1T, Cell2T, CoefT >

Tensor of chains.

This is in fact a chain made up of pairs of cells of the given type. One can add products of chains to the tensor, which is then decomposed into tensors of individual cells and reduced.

Definition at line 52 of file tensor.h.

Member Typedef Documentation

◆ Cell1Type

template<class Cell1T, class Cell2T, class CoefT>
typedef Cell1T tTensor< Cell1T, Cell2T, CoefT >::Cell1Type

The type of left cells in the tensor.

Definition at line 56 of file tensor.h.

◆ Cell2Type

template<class Cell1T, class Cell2T, class CoefT>
typedef Cell2T tTensor< Cell1T, Cell2T, CoefT >::Cell2Type

The type of right cells in the tensor.

Definition at line 59 of file tensor.h.

◆ CoefType

template<class Cell1T, class Cell2T, class CoefT>
typedef CoefT tTensor< Cell1T, Cell2T, CoefT >::CoefType

The type of coefficients in the chain.

Definition at line 62 of file tensor.h.

Constructor & Destructor Documentation

◆ tTensor()

template<class Cell1T , class Cell2T , class CoefT >
tTensor< Cell1T, Cell2T, CoefT >::tTensor ( )
inline

The default constructor of an empty tensor.

Definition at line 111 of file tensor.h.

Member Function Documentation

◆ add() [1/2]

template<class Cell1T , class Cell2T , class CoefT >
void tTensor< Cell1T, Cell2T, CoefT >::add ( const Cell1T &  c1,
const Cell2T &  c2,
const CoefT &  coef 
)
inline

Adds a pair of cells to the tensor.

Definition at line 148 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

Referenced by tTensor< Cell1T, Cell2T, CoefT >::add(), and tTensor< Cell1T, Cell2T, CoefT >::coef().

◆ add() [2/2]

template<class Cell1T , class Cell2T , class CoefT >
void tTensor< Cell1T, Cell2T, CoefT >::add ( const tChain< Cell1T, CoefT > &  c1,
const tChain< Cell2T, CoefT > &  c2 
)
inline

Adds a pair of chains to the tensor.

Definition at line 155 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::add(), tTensor< Cell1T, Cell2T, CoefT >::coef(), and tTensor< Cell1T, Cell2T, CoefT >::size().

◆ coef()

template<class Cell1T , class Cell2T , class CoefT >
const CoefT & tTensor< Cell1T, Cell2T, CoefT >::coef ( int_t  n) const
inline

◆ empty()

template<class Cell1T , class Cell2T , class CoefT >
bool tTensor< Cell1T, Cell2T, CoefT >::empty ( ) const
inline

Returns true if and only if the tensor is zero (empty set).

Definition at line 123 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

◆ left()

template<class Cell1T , class Cell2T , class CoefT >
const Cell1T & tTensor< Cell1T, Cell2T, CoefT >::left ( int_t  n) const
inline

Returns the n-th left element of the tensor.

Definition at line 129 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

Referenced by operator<<().

◆ operator*=()

template<class Cell1T , class Cell2T , class CoefT >
tTensor< Cell1T, Cell2T, CoefT > & tTensor< Cell1T, Cell2T, CoefT >::operator*= ( const CoefT &  coef)
inline

Multiples the tensor by a given coefficient.

Definition at line 186 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::coef(), and tTensor< Cell1T, Cell2T, CoefT >::tensor.

◆ operator+=()

template<class Cell1T , class Cell2T , class CoefT >
tTensor< Cell1T, Cell2T, CoefT > & tTensor< Cell1T, Cell2T, CoefT >::operator+= ( const tTensor< Cell1T, Cell2T, CoefT > &  ch)
inline

Adds a given tensor to the tensor.

Definition at line 177 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

◆ operator==()

template<class Cell1T , class Cell2T , class CoefT >
bool tTensor< Cell1T, Cell2T, CoefT >::operator== ( const tTensor< Cell1T, Cell2T, CoefT > &  ch) const
inline

Compares if the two tensors are equal.

Definition at line 194 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::swap(), and tTensor< Cell1T, Cell2T, CoefT >::tensor.

◆ right()

template<class Cell1T , class Cell2T , class CoefT >
const Cell2T & tTensor< Cell1T, Cell2T, CoefT >::right ( int_t  n) const
inline

Returns the n-th right element of the tensor.

Definition at line 135 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

Referenced by operator<<().

◆ size()

template<class Cell1T , class Cell2T , class CoefT >
int_t tTensor< Cell1T, Cell2T, CoefT >::size ( ) const
inline

Returns the number of elements in the tensor.

Definition at line 117 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

Referenced by tTensor< Cell1T, Cell2T, CoefT >::add(), and operator<<().

◆ swap()

template<class Cell1T , class Cell2T , class CoefT >
void tTensor< Cell1T, Cell2T, CoefT >::swap ( tTensor< Cell1T, Cell2T, CoefT > &  ch)
inline

Swaps the data with another tensor.

Definition at line 201 of file tensor.h.

References tTensor< Cell1T, Cell2T, CoefT >::tensor.

Referenced by tTensor< Cell1T, Cell2T, CoefT >::operator==().

Member Data Documentation

◆ tensor

template<class Cell1T, class Cell2T, class CoefT>
tChain<tPair<Cell1T,Cell2T>,CoefT> tTensor< Cell1T, Cell2T, CoefT >::tensor
private

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