xerus
a general purpose tensor library
indexedTensorMoveable.cpp
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 
26 
27 #include <xerus/index.h>
28 #include <xerus/tensor.h>
29 #include <xerus/tensorNetwork.h>
30 
31 namespace xerus {
32  namespace internal {
33  template<class tensor_type>
35 
36  template<class tensor_type>
38 
39  template<class tensor_type>
40  IndexedTensorMoveable<tensor_type>::IndexedTensorMoveable(tensor_type* const _tensorObject, const std::vector<Index>& _indices) : IndexedTensorWritable<tensor_type>(_tensorObject, _indices, true) {}
41 
42  template<class tensor_type>
43  IndexedTensorMoveable<tensor_type>::IndexedTensorMoveable(tensor_type* const _tensorObject, std::vector<Index>&& _indices) : IndexedTensorWritable<tensor_type>(_tensorObject, std::move(_indices), true) {}
44 
45  template<>
47  IndexedTensorWritable<TensorNetwork>(_other.tensorObjectReadOnly->get_copy(), std::move(_other.indices), true) { }
48 
49  template<>
51  IndexedTensorWritable<Tensor>(new Tensor(*_other.tensorObjectReadOnly), std::move(_other.indices), true) { }
52 
53  template<>template<>
56 
57  template<>template<>
59  IndexedTensorWritable<Tensor>(new Tensor(*_other.tensorObjectReadOnly), std::move(_other.indices), true) { }
60 
61 
62  // IndexedTensorReadOnly may be instanciated as
63  template class IndexedTensorMoveable<Tensor>;
65  } // namespace internal
66 } // namespace xerus
Internal representation of an read and write and moveable indexed Tensor or TensorNetwork.
Header file for the Index class.
Header file for the IndexedTensorMoveable class.
Very general class used to represent arbitary tensor networks.
Definition: tensorNetwork.h:42
Internal representation of an readable indexed Tensor or TensorNetwork.
IndexedTensorMoveable()
Creates an empty indexed Tensor, should only be used internally.
The main namespace of xerus.
Definition: basic.h:37
Class that handles simple (non-decomposed) tensors in a dense or sparse representation.
Definition: tensor.h:70
STL namespace.
Header file for the Tensor class.
std::vector< Index > indices
Vector of the associates indices.
Abstract internal representation of an read and writeable indexed Tensor or TensorNetwork.
Class used to represent indices that can be used to write tensor calculations in index notation...
Definition: index.h:43
Header file for the TensorNetwork class.
const tensor_type * tensorObjectReadOnly
Pointer to the associated Tensor/TensorNetwork object.