xerus
a general purpose tensor library
indexedTensorList.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 
27 
28 namespace xerus {
29  namespace internal {
30  IndexedTensorList::IndexedTensorList(IndexedTensorList&& _old) noexcept : tensors(std::move(_old.tensors)) { }
31 
33  tensors.emplace_back(&_first);
34  tensors.emplace_back(&_second);
35  }
36 
37  void IndexedTensorList::operator=(TensorFactorisation&& _factorisation) const {
38  _factorisation(tensors);
39  }
40 
41  /*- - - - - - - - - - - - - - - - - - - - - - - - - - External functions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
42 
44  return IndexedTensorList(std::move(_first), std::move(_second));
45  }
46 
48  _first.tensors.emplace_back(&_second); // Hope this is standardconform. maybe we have to move-construct a new object
49  return std::move(_first);
50  }
51  } // namespace internal
52 } // namespace xerus
IndexedTensorList operator,(IndexedTensor< Tensor > &&_first, IndexedTensor< Tensor > &&_second)
Using the "," operator tuples of writeable indexed tensor can be created.
Header file defining lists of indexed tensors.
Header file for the classes defining factorisations of Tensors.
The main namespace of xerus.
Definition: basic.h:37
std::vector< IndexedTensor< Tensor > * > tensors
Collection of pointers to the Tensor objects referenced by the tuple.
IndexedTensorList()=delete
No default construction is intended.
Internal representation of an readable and writeable indexed Tensor or TensorNetwork.
Definition: indexedTensor.h:37
Internal representation of a tuple of indexed Tensor s.
Abstract super class for all tensor factorisations.
void operator=(TensorFactorisation &&_factorisation) const
Generic assignment operator that takes any TensorFactorisation object which is in then invoked to per...