The ChainCon Software (Release 0.03)
|
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... | |
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.
|
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().
|
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().
|
inline |
Returns the n-th coefficient in the tensor.
Definition at line 141 of file tensor.h.
References tTensor< Cell1T, Cell2T, CoefT >::add(), and tTensor< Cell1T, Cell2T, CoefT >::tensor.
Referenced by tTensor< Cell1T, Cell2T, CoefT >::add(), tTensor< Cell1T, Cell2T, CoefT >::operator*=(), and operator<<().
|
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.
|
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<<().
|
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.
|
inline |
Adds a given tensor to the tensor.
Definition at line 177 of file tensor.h.
References tTensor< Cell1T, Cell2T, CoefT >::tensor.
|
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.
|
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<<().
|
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<<().
|
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==().
|
private |
The set of elements in the tensor.
Definition at line 104 of file tensor.h.
Referenced by tTensor< Cell1T, Cell2T, CoefT >::add(), tTensor< Cell1T, Cell2T, CoefT >::coef(), tTensor< Cell1T, Cell2T, CoefT >::empty(), tTensor< Cell1T, Cell2T, CoefT >::left(), tTensor< Cell1T, Cell2T, CoefT >::operator*=(), tTensor< Cell1T, Cell2T, CoefT >::operator+=(), tTensor< Cell1T, Cell2T, CoefT >::operator==(), tTensor< Cell1T, Cell2T, CoefT >::right(), tTensor< Cell1T, Cell2T, CoefT >::size(), and tTensor< Cell1T, Cell2T, CoefT >::swap().