xerus
a general purpose tensor library
indexedTensorWritable.h
Go to the documentation of this file.
1 // Xerus - A General Purpose Tensor Library
2 // Copyright (C) 2014-2017 Benjamin Huber and Sebastian Wolf.
3 //
4 // Xerus is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published
6 // by the Free Software Foundation, either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // Xerus is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with Xerus. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // For further information on Xerus visit https://libXerus.org
18 // or contact us at contact@libXerus.org.
19 
25 #pragma once
26 
27 #include "indexedTensorReadOnly.h"
28 
29 namespace xerus {
30  namespace internal {
35  template<class tensor_type>
36  class IndexedTensorWritable : public IndexedTensorReadOnly<tensor_type> {
37  public:
42  tensor_type* tensorObject;
43 
46 
47  protected:
49  IndexedTensorWritable() = delete;
50 
52  IndexedTensorWritable(const IndexedTensorWritable &_other ) = delete;
53 
55  IndexedTensorWritable(IndexedTensorWritable &&_other ) noexcept;
56 
58  IndexedTensorWritable(tensor_type* const _tensorObject, const std::vector<Index>& _indices, const bool _takeOwnership);
59 
61  IndexedTensorWritable(tensor_type* const _tensorObject, std::vector<Index>&& _indices, const bool _takeOwnership);
62 
63  public:
64  /*- - - - - - - - - - - - - - - - - - - - - - - - - - Destructor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
65  virtual ~IndexedTensorWritable();
66 
67  /*- - - - - - - - - - - - - - - - - - - - - - - - - - Other - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
68 
70  bool is_owner() const;
71 
76 
81 
86 
91 
95  void perform_traces();
96  };
97 
98 
100  }
101 }
void indexed_plus_equal(IndexedTensorReadOnly< tensor_type > &&_rhs)
Tensor add_assignment with indices.
void indexed_assignement(IndexedTensorReadOnly< Tensor > &&_rhs)
Tensor assignment with indices.
Header file for the IndexedTensorReadOnly class.
Internal representation of an readable indexed Tensor or TensorNetwork.
The main namespace of xerus.
Definition: basic.h:37
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...
void evaluate(IndexedTensorWritable< Tensor > &&_out, IndexedTensorReadOnly< Tensor > &&_base)
bool is_owner() const
Check whether the IndexedTensorWritable has ownership of the tensor object.
tensor_type * tensorObject
Non-const pointer to the tensor object.
bool deleteTensorObject
Flag indicating, whether the IndexedTensorWritable is the owner of the tensorObject.
Abstract internal representation of an read and writeable indexed Tensor or TensorNetwork.
IndexedTensorWritable()=delete
There is no usefull default constructor;.