39 namespace MultiDimensional {
43 return calc2(move(origin), other, dotter,
"dot");
48 return calc1(move(origin), tracer,
"trace");
53 return calc1(move(origin), squarer,
"square");
58 return calc2(move(origin), other, summer,
"sum");
63 return calc2(move(origin), other, multiplier,
"element-multiply");
68 return calc2(move(origin), other, divider,
"element-divide");
73 return calc2(move(origin), other, inserter,
"add-at");
78 switch(msgreader->data_type()) {
79 case Serial::FBTensorTypes::FBComplex: {
80 result.reset(static_cast<IContainer*>(
new ScalarContainer{msgreader->data_as_FBComplex()}));
83 case Serial::FBTensorTypes::FBSingleTensor: {
84 auto data = msgreader->data_as_FBSingleTensor();
93 case Serial::FBTensorTypes::FBTensorList: {
94 auto data = msgreader->data_as_FBTensorList();
106 return calc1(move(origin), optimizer,
"optimize");
111 return calc1(move(origin), converter,
"convert to sparse");
116 return calc1(move(origin), converter,
"convert to vector");
TensorData toVector(TensorData origin)
Tensor storage re-optimization algorithm.
TensorData read(const Serial::FBTensor *msgreader)
TensorPtr calc1(TensorPtr origin, Ops op, std::string opName)
std::vector< IndexPair > IndexPairList
TensorData calcTrace(TensorData origin, const IndexPairList &indices)
Non-sparse tensor data container.
TensorData calcDot(TensorData origin, const IContainer &other, const IndexPairList &indices)
TensorPtr calc2(TensorPtr origin, const IContainer &other, Ops op, std::string opName)
std::unique_ptr< IContainer > TensorData
Sub-tensor block insertion algorithm.
Tensor operations helper functions.
TensorData toSparse(TensorData origin)
(Sum of) Outer product tensor data container
Hammer exception definitions.
Interface class for tensor container data structure.
Sparse tensor data container.
Order-0 tensor data container.
TensorData calcSquare(TensorData origin)
Tensor outer square algorithm.
TensorData elementMultiply(TensorData origin, const IContainer &other)
TensorData addAt(TensorData origin, const IContainer &other, IndexType index, IndexType position)
Tensor element-wise division algorithm.
TensorData reOptimize(TensorData origin)
Tensor element-wise multiplication algorithm.
TensorData elementDivide(TensorData origin, const IContainer &other)
TensorData sum(TensorData origin, const IContainer &other)
Tensor dot product algorithm.
Serialization related typedefs and includes.
Tensor storage type conversion algorithm.
Double dispatcher code based on examples from A.Alexandrescu's book.