Hammer
1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
|
Multidimensional tensor class with complex numbers as elements. More...
#include <Tensor.hh>
Public Member Functions | |
Tensor () | |
Tensor (const std::string &name) | |
Tensor (const std::string &name, MultiDimensional::TensorData container) | |
Tensor (const std::string &name, std::vector< std::pair< MultiDimensional::SharedTensorData, bool >> &&data) | |
Tensor (const Tensor &other) | |
Tensor & | operator= (const Tensor &other) |
Tensor (Tensor &&other) | |
Tensor & | operator= (Tensor &&other) |
~Tensor () | |
template<typename... Args> | |
void | setValue (std::complex< double > value, Args...rest) |
set the value of a specific tensor element More... | |
template<typename... Args> | |
std::complex< double > | value (Args...rest) const |
returns the value of a specific tensor element More... | |
std::complex< double > & | element (const IndexList &indices={}) |
access an element given its indices More... | |
std::complex< double > | element (const IndexList &indices={}) const |
access an element given its indices (const version) More... | |
size_t | rank () const |
rank of the tensor More... | |
IndexList | dims () const |
get the dimensions of all the indices at once More... | |
LabelsList | labels () const |
get the labels of all the indices at once More... | |
bool | hasWCLabels () const |
checks if Tensor has indices in the WC range More... | |
bool | hasFFLabels () const |
checks if Tensor has indices in the FF range More... | |
bool | hasFFVarLabels () const |
checks if Tensor has indices in the FF Var range More... | |
const std::string & | name () const |
get the tensor name More... | |
bool | isEqualTo (const Tensor &other) const |
Tensor & | dot (const Tensor &other, const UniqueLabelsList &indices={}) |
contract this tensor with another and stores the result in this tensor More... | |
Tensor & | spinSum () |
trace some of the indices of this tensor More... | |
Tensor & | spinAverage () |
trace over the traceable spin indices and divide by the product of the dimensions of the traced indices (equal to \( 2s_i + 1 \)) More... | |
Tensor & | outerSquare () |
creates a tensor with twice the rank by multiplying the tensor with its hermitean conjugate More... | |
Tensor & | toVector () |
forces conversion of a tensor to vector type More... | |
Tensor & | operator*= (double val) |
multiply all the elements of the tensor by a real number More... | |
Tensor & | operator*= (std::complex< double > val) |
multiply all the elements of the tensor by a complex number More... | |
Tensor & | operator+= (const Tensor &other) |
sums another tensor to itself More... | |
Tensor & | elementMultiplyBy (const Tensor &other) |
multiply two tensors element by element and stores the result in this tensor More... | |
Tensor & | elementDivideBy (const Tensor &other) |
divide two tensors element by element and stores the result in this tensor More... | |
Tensor & | addAt (const Tensor &t, IndexLabel coord, IndexType position) |
add a tensor of rank N-1 to a specific position in a specific coordinate the dimension of the tensor should match those of this tensor in all the other dimensions More... | |
void | clearData () |
sets all the elements to 0 More... | |
void | write (flatbuffers::FlatBufferBuilder *msgwriter, flatbuffers::Offset< Serial::FBTensor > *msg) const |
write the contents of the tensor for serialization More... | |
void | read (const Serial::FBTensor *msgreader) |
read the contents of the tensor for serialization More... | |
Protected Member Functions | |
Log & | getLog () const |
logging facility More... | |
Private Attributes | |
std::string | _name |
the tensor name More... | |
MultiDimensional::TensorData | _data |
Multidimensional tensor class with complex numbers as elements.
Contains a complex tensor flattened to a vector as raw-major
Hammer::Tensor::Tensor | ( | const std::string & | name, |
MultiDimensional::TensorData | container | ||
) |
Hammer::Tensor::Tensor | ( | const std::string & | name, |
std::vector< std::pair< MultiDimensional::SharedTensorData, bool >> && | data | ||
) |
Tensor & Hammer::Tensor::addAt | ( | const Tensor & | t, |
IndexLabel | coord, | ||
IndexType | position | ||
) |
add a tensor of rank N-1 to a specific position in a specific coordinate the dimension of the tensor should match those of this tensor in all the other dimensions
[in] | t | the other tensor |
[in] | coord | the cooridnate, identified by its label. If multiple dimensions have the same label, the first one is considered. |
[in] | position | the position along the dimension |
void Hammer::Tensor::clearData | ( | ) |
IndexList Hammer::Tensor::dims | ( | ) | const |
Tensor & Hammer::Tensor::dot | ( | const Tensor & | other, |
const UniqueLabelsList & | indices = {} |
||
) |
contract this tensor with another and stores the result in this tensor
[in] | other | the othe tensor |
[in] | indices | restrict the indices to be contracted, identified by labels. If no labels are passed all the contractable indices are contracted. If a set of labels is passed, the indices to be contracted will be the intersection between the provided set and the set of contractable labels |
complex< double > & Hammer::Tensor::element | ( | const IndexList & | indices = {} | ) |
complex< double > Hammer::Tensor::element | ( | const IndexList & | indices = {} | ) | const |
|
protected |
bool Hammer::Tensor::hasFFLabels | ( | ) | const |
bool Hammer::Tensor::hasFFVarLabels | ( | ) | const |
bool Hammer::Tensor::hasWCLabels | ( | ) | const |
bool Hammer::Tensor::isEqualTo | ( | const Tensor & | other | ) | const |
LabelsList Hammer::Tensor::labels | ( | ) | const |
const string & Hammer::Tensor::name | ( | ) | const |
Tensor & Hammer::Tensor::operator*= | ( | double | val | ) |
Tensor & Hammer::Tensor::operator*= | ( | std::complex< double > | val | ) |
Tensor & Hammer::Tensor::outerSquare | ( | ) |
size_t Hammer::Tensor::rank | ( | ) | const |
void Hammer::Tensor::read | ( | const Serial::FBTensor * | msgreader | ) |
void Hammer::Tensor::setValue | ( | std::complex< double > | value, |
Args... | rest | ||
) |
set the value of a specific tensor element
[in] | value | the value |
[in] | rest | the rest of the indices (0-based) |
Definition at line 22 of file TensorDefs.hh.
Tensor & Hammer::Tensor::spinAverage | ( | ) |
Tensor & Hammer::Tensor::spinSum | ( | ) |
Tensor & Hammer::Tensor::toVector | ( | ) |
std::complex< double > Hammer::Tensor::value | ( | Args... | rest | ) | const |
returns the value of a specific tensor element
[in] | rest | the rest of the indices (0-based) |
Definition at line 31 of file TensorDefs.hh.
void Hammer::Tensor::write | ( | flatbuffers::FlatBufferBuilder * | msgwriter, |
flatbuffers::Offset< Serial::FBTensor > * | msg | ||
) | const |
|
mutableprivate |