28 #ifndef _CHAINCON_COMBTENSOR_H_ 29 #define _CHAINCON_COMBTENSOR_H_ 37 #include "chomp/system/config.h" 52 template <
class Cell1T,
class Cell2T>
75 const Cell1T &
left (int_t n)
const;
78 const Cell2T &
right (int_t n)
const;
81 void add (
const Cell1T &c1,
const Cell2T &c2);
105 template <
class Cell1T,
class Cell2T>
111 template <
class Cell1T,
class Cell2T>
117 template <
class Cell1T,
class Cell2T>
123 template <
class Cell1T,
class Cell2T>
129 template <
class Cell1T,
class Cell2T>
135 template <
class Cell1T,
class Cell2T>
137 (
const Cell1T &c1,
const Cell2T &c2)
142 template <
class Cell1T,
class Cell2T>
146 int_t ch1size = ch1.
size ();
147 int_t ch2size = ch2.
size ();
148 for (int_t i = 0; i < ch1size; ++ i)
150 const Cell1T &c1 = ch1. getCell (i);
151 for (int_t j = 0; j < ch2size; ++ j)
153 const Cell2T &c2 = ch2. getCell (j);
160 template <
class Cell1T,
class Cell2T>
168 template <
class Cell1T,
class Cell2T>
169 inline bool tCombTensor<Cell1T,Cell2T>::operator ==
175 template <
class Cell1T,
class Cell2T>
185 template <
class Cell1T,
class Cell2T>
194 for (int_t i = 0; i <
size; ++ i)
198 out << c.
left (i) <<
" x " << c.
right (i);
205 template <
class Cell1T,
class Cell2T>
208 throw "Operator >> not implemented for tCombTensor.";
213 #endif // _CHAINCON_COMBTENSOR_H_ A pair of elements of two (possibly different) types.
std::ostream & operator<<(std::ostream &out, const tCombTensor< Cell1T, Cell2T > &c)
Writes a combinatorial tensor to an output stream.
tZ2 CoefType
The type of coefficients in the chain.
An element of the ring Z_2.
Cell1T Cell1Type
The type of cells on the left in the combinatorial tensor.
tCombTensor()
The default constructor of an empty combinatorial tensor.
void swap(tCombTensor< Cell1T, Cell2T > &ch)
Swaps the data with another tensor.
A combinatorial chain, that is, a chain with Z_2 coefficients.
tCombChain< tPair< Cell1T, Cell2T > > tensor
The set of elements in the combinatorial tensor.
Cell2T Cell2Type
The type of cells on the right in the combinatorial tensor.
void add(const Cell1T &c1, const Cell2T &c2)
Adds a pair of cells to the combinatorial tensor.
Combinatorial tensor of cells.
bool empty() const
Returns true if and only if the tensor is zero (empty set).
Elements of the ring Z_2.
int_t size() const
Returns the number of elements in the combinatorial tensor.
bool operator==(const tCombTensor< Cell1T, Cell2T > &ch) const
Compares if the two tensors are equal.
const Cell2T & right(int_t n) const
Returns the n-th right element of the combinatorial tensor.
std::istream & operator>>(std::istream &in, tCombTensor< Cell1T, Cell2T > &c)
Reads a combinatorial tensor from an input stream.
const Cell1T & left(int_t n) const
Returns the n-th left element of the combinatorial tensor.