38 template<
class tensor_type>
41 _other.deleteTensorObject =
false;
44 template<
class tensor_type>
46 IndexedTensorReadOnly<tensor_type>(_tensorObject, _indices), tensorObject(_tensorObject), deleteTensorObject(_takeOwnership) {}
49 template<
class tensor_type>
54 template<
class tensor_type>
62 template<
class tensor_type>
72 evaluate(std::move(*
this), std::move(_rhs));
77 evaluate(std::move(*
this), std::move(tmpTensor));
83 _rhs.tensorObjectReadOnly->require_valid_network();
88 for (
size_t i=0; i < cpy.
tensorObject->nodes.size(); ++i) {
94 std::vector<Index> externalOrder;
95 for(
size_t i = 0; i < cpy.
tensorObject->nodes[res].neighbors.size(); ++i) { externalOrder.emplace_back(); }
97 std::vector<Index> internalOrder;
99 INTERNAL_CHECK(link.external,
"Internal Error " << link.other <<
" " << link.indexPosition);
100 internalOrder.emplace_back(externalOrder[link.indexPosition]);
104 std::vector<Index> outOrder;
106 REQUIRE(misc::contains(cpy.
indices, idx),
"Every index on the LHS must appear somewhere on the RHS, here: " << cpy.
indices <<
' ' << indices);
108 for (
size_t j = 0; cpy.
indices[j] != idx; ++j) {
110 spanSum += cpy.
indices[j].span;
113 for (
size_t i=0; i < idx.span; ++i) {
114 outOrder.push_back(externalOrder[spanSum+i]);
118 (*tensorObject)(outOrder) = (*cpy.
tensorObject->nodes[res].tensorObject)(internalOrder);
128 tensorObject->specialized_evaluation(std::move(*
this), std::move(_rhs));
133 std::unique_ptr<Tensor> reorderedRhs(
new Tensor(_rhs.tensorObjectReadOnly->representation));
134 (*reorderedRhs)(this->
indices) = std::move(_rhs);
140 std::unique_ptr<Tensor> reorderedRhs(
new Tensor(_rhs.tensorObjectReadOnly->representation));
141 (*reorderedRhs)(this->
indices) = std::move(_rhs);
160 std::vector<Index> openIndices;
164 openIndices.push_back(idx);
171 this->indices = openIndices;
static void link_traces_and_fix(internal::IndexedTensorWritable< TensorNetwork > &&_base)
Finds traces defined by the indices and internally links the corresponding indices. Also applys all fixed indices.
void indexed_plus_equal(IndexedTensorReadOnly< tensor_type > &&_rhs)
Tensor add_assignment with indices.
Internal representation of an read and write and moveable indexed Tensor or TensorNetwork.
void indexed_assignement(IndexedTensorReadOnly< Tensor > &&_rhs)
Tensor assignment with indices.
Header file for the Index class.
Header file for the IndexedTensorMoveable class.
Header file for the standard contaienr support functions.
Very general class used to represent arbitary tensor networks.
Internal representation of an readable indexed Tensor or TensorNetwork.
The main namespace of xerus.
Class that handles simple (non-decomposed) tensors in a dense or sparse representation.
void indexed_minus_equal(IndexedTensorReadOnly< tensor_type > &&_rhs)
Tensor subtract_assignment with indices.
void perform_traces()
: Performes all traces induces by the current indices and therby also evaluates all fixed indices...
virtual ~IndexedTensorWritable()
void evaluate(IndexedTensorWritable< Tensor > &&_out, IndexedTensorReadOnly< Tensor > &&_base)
Class representing a link from a TensorNode to another node or an external index. ...
bool is_owner() const
Check whether the IndexedTensorWritable has ownership of the tensor object.
Header file for the Tensor class.
std::vector< Index > indices
Vector of the associates indices.
tensor_type * tensorObject
Non-const pointer to the tensor object.
size_t get_eval_degree(const std::vector< Index > &_indices)
bool deleteTensorObject
Flag indicating, whether the IndexedTensorWritable is the owner of the tensorObject.
Header file for comfort functions and macros that should not be exported in the library.
Abstract internal representation of an read and writeable indexed Tensor or TensorNetwork.
IndexedTensorWritable()=delete
There is no usefull default constructor;.
Class used to represent indices that can be used to write tensor calculations in index notation...
Header file for the IndexedTensorWritable class.
void assign_indices()
Assignes the indices using the degree of the tensorObejct.
std::vector< size_t > get_evaluated_dimensions(const std::vector< Index > &_indexOrder)
Returns the dimensionTuple the evaluation of this IndexedTensor to the given indices would have...
Header file for the TensorNetwork class.
bool indicesAssigned
Flag indicating whether the indices are assinged.
Header file for the IndexedTensor class.