xerus
a general purpose tensor library
xerus::internal::IndexedTensor< tensor_type > Class Template Referencefinal

Internal representation of an readable and writeable indexed Tensor or TensorNetwork. More...

#include <indexedTensor.h>

Inheritance diagram for xerus::internal::IndexedTensor< tensor_type >:
Collaboration diagram for xerus::internal::IndexedTensor< tensor_type >:

Public Member Functions

 IndexedTensor (const IndexedTensor &_other)=delete
 There is no usefull copy constructor, because the handling of the tensorObject is unclear. More...
 
 IndexedTensor (IndexedTensor &&_other)
 Move constructor. More...
 
 IndexedTensor (tensor_type *const _tensorObject, const std::vector< Index > &_indices, const bool _takeOwnership)
 Constructs an IndexedTensor with the given tensor and indices and if ordered to do so takes owership of the tensorObject. More...
 
 IndexedTensor (tensor_type *const _tensorObject, std::vector< Index > &&_indices, const bool _takeOwnership)
 Constructs an IndexedTensor with the given tensor and indices and if ordered to do so takes owership of the tensorObject. More...
 
void operator+= (IndexedTensorReadOnly< tensor_type > &&_rhs)
 Tensor add_assignment with indices. More...
 
void operator-= (IndexedTensorReadOnly< tensor_type > &&_rhs)
 Tensor subtract_assignment with indices. More...
 
void operator= (IndexedTensorReadOnly< Tensor > &&_rhs)
 Assignment operators – Used for tensor assignment WITH indices. More...
 
void operator= (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 Assignment operators – Used for tensor assignment WITH indices. More...
 
void operator= (IndexedTensor< tensor_type > &&_rhs)
 The following would be deleted due to move constructor and is therefore implemented here, calls the IndexedTensorReadOnly version. More...
 
- Public Member Functions inherited from xerus::internal::IndexedTensorWritable< tensor_type >
virtual ~IndexedTensorWritable ()
 
template<>
void indexed_assignement (IndexedTensorReadOnly< Tensor > &&_rhs)
 
void indexed_assignement (IndexedTensorReadOnly< Tensor > &&_rhs)
 Tensor assignment with indices. More...
 
void indexed_assignement (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 Tensor assignment with indices. More...
 
template<>
void indexed_assignement (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 
template<>
void indexed_assignement (IndexedTensorReadOnly< Tensor > &&_rhs)
 
template<>
void indexed_assignement (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 
void indexed_minus_equal (IndexedTensorReadOnly< tensor_type > &&_rhs)
 Tensor subtract_assignment with indices. More...
 
template<>
void indexed_minus_equal (IndexedTensorReadOnly< Tensor > &&_rhs)
 
template<>
void indexed_minus_equal (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 
void indexed_plus_equal (IndexedTensorReadOnly< tensor_type > &&_rhs)
 Tensor add_assignment with indices. More...
 
template<>
void indexed_plus_equal (IndexedTensorReadOnly< Tensor > &&_rhs)
 
template<>
void indexed_plus_equal (IndexedTensorReadOnly< TensorNetwork > &&_rhs)
 
bool is_owner () const
 Check whether the IndexedTensorWritable has ownership of the tensor object. More...
 
void perform_traces ()
 : Performes all traces induces by the current indices and therby also evaluates all fixed indices. More...
 
template<>
void perform_traces ()
 
- Public Member Functions inherited from xerus::internal::IndexedTensorReadOnly< tensor_type >
 IndexedTensorReadOnly ()=delete
 There is no usefull default constructor. More...
 
 IndexedTensorReadOnly (const IndexedTensorReadOnly &_other)=delete
 There is no usefull copy constructor for IndexedTensors. More...
 
 IndexedTensorReadOnly (IndexedTensorReadOnly< tensor_type > &&_other) noexcept
 Move-constructor. More...
 
 IndexedTensorReadOnly (const tensor_type *const _tensorObjectReadOnly, std::vector< Index > _indices)
 Constructs an IndexedTensorReadOnly using the given pointer and indices. More...
 
virtual ~IndexedTensorReadOnly ()
 Destructor must be virtual. More...
 
void assign_index_dimensions ()
 Assignes the indices using the current tensorObejct. More...
 
void assign_indices ()
 Assignes the indices using the degree of the tensorObejct. More...
 
void assign_indices (const size_t _degree)
 Assignes the indices assuming the given degree. More...
 
size_t degree () const
 Returns the degree of the associated tensorObejct. More...
 
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. More...
 
 operator value_t () const
 Allows cast to value_t if the degree of the current object is equal to 0. More...
 
void operator= (const IndexedTensorReadOnly &_rhs)=delete
 : IndexedTensorReadOnly cannot be assigned as they are read only. More...
 
void operator= (IndexedTensorReadOnly &&_rhs)=delete
 : IndexedTensorReadOnly cannot be assigned as they are read only. More...
 
bool uses_tensor (const tensor_type *_otherTensor) const
 Checks whether _otherTensor is the tensorObejct of this IndexTensor. More...
 

Additional Inherited Members

- Public Attributes inherited from xerus::internal::IndexedTensorWritable< tensor_type >
bool deleteTensorObject
 Flag indicating, whether the IndexedTensorWritable is the owner of the tensorObject. More...
 
tensor_type * tensorObject
 Non-const pointer to the tensor object. More...
 
- Public Attributes inherited from xerus::internal::IndexedTensorReadOnly< tensor_type >
std::vector< Indexindices
 Vector of the associates indices. More...
 
bool indicesAssigned = false
 Flag indicating whether the indices are assinged. More...
 
const tensor_type * tensorObjectReadOnly
 Pointer to the associated Tensor/TensorNetwork object. More...
 
- Protected Member Functions inherited from xerus::internal::IndexedTensorWritable< tensor_type >
 IndexedTensorWritable ()=delete
 There is no usefull default constructor;. More...
 
 IndexedTensorWritable (const IndexedTensorWritable &_other)=delete
 There is no usefull copy constructor, because the handling of the tensorObject is unclear. More...
 
 IndexedTensorWritable (IndexedTensorWritable &&_other) noexcept
 Move constructor. More...
 
 IndexedTensorWritable (tensor_type *const _tensorObject, const std::vector< Index > &_indices, const bool _takeOwnership)
 Constructs an IndexedTensorWritable with the given tensor and takes owership of the tensorObject if requested. More...
 
 IndexedTensorWritable (tensor_type *const _tensorObject, std::vector< Index > &&_indices, const bool _takeOwnership)
 Constructs an IndexedTensorWritable with the given tensor and takes owership of the tensorObject if requested. More...
 

Detailed Description

template<class tensor_type>
class xerus::internal::IndexedTensor< tensor_type >

Internal representation of an readable and writeable indexed Tensor or TensorNetwork.

This class appears inplicitly by indexing any Tensor or TensorNetwork. It is not recommended to use it explicitly or to store variables of this type (unless you really know what you are doing).

Definition at line 37 of file indexedTensor.h.

Constructor & Destructor Documentation

◆ IndexedTensor() [1/4]

template<class tensor_type>
xerus::internal::IndexedTensor< tensor_type >::IndexedTensor ( const IndexedTensor< tensor_type > &  _other)
delete

There is no usefull copy constructor, because the handling of the tensorObject is unclear.

◆ IndexedTensor() [2/4]

template<class tensor_type >
xerus::internal::IndexedTensor< tensor_type >::IndexedTensor ( IndexedTensor< tensor_type > &&  _other)

Move constructor.

Definition at line 35 of file indexedTensor.cpp.

◆ IndexedTensor() [3/4]

template<class tensor_type>
xerus::internal::IndexedTensor< tensor_type >::IndexedTensor ( tensor_type *const  _tensorObject,
const std::vector< Index > &  _indices,
const bool  _takeOwnership 
)

Constructs an IndexedTensor with the given tensor and indices and if ordered to do so takes owership of the tensorObject.

Definition at line 38 of file indexedTensor.cpp.

◆ IndexedTensor() [4/4]

template<class tensor_type>
xerus::internal::IndexedTensor< tensor_type >::IndexedTensor ( tensor_type *const  _tensorObject,
std::vector< Index > &&  _indices,
const bool  _takeOwnership 
)

Constructs an IndexedTensor with the given tensor and indices and if ordered to do so takes owership of the tensorObject.

Definition at line 42 of file indexedTensor.cpp.

Member Function Documentation

◆ operator+=()

template<class tensor_type>
void xerus::internal::IndexedTensor< tensor_type >::operator+= ( IndexedTensorReadOnly< tensor_type > &&  _rhs)

Tensor add_assignment with indices.

Definition at line 63 of file indexedTensor.cpp.

◆ operator-=()

template<class tensor_type>
void xerus::internal::IndexedTensor< tensor_type >::operator-= ( IndexedTensorReadOnly< tensor_type > &&  _rhs)

Tensor subtract_assignment with indices.

Definition at line 68 of file indexedTensor.cpp.

◆ operator=() [1/3]

template<class tensor_type >
void xerus::internal::IndexedTensor< tensor_type >::operator= ( IndexedTensorReadOnly< Tensor > &&  _rhs)

Assignment operators – Used for tensor assignment WITH indices.

Note that this is NOT a classical assignment operator. In particular this and _rhs are NOT equivalent after the assignment.

Definition at line 53 of file indexedTensor.cpp.

◆ operator=() [2/3]

template<class tensor_type >
void xerus::internal::IndexedTensor< tensor_type >::operator= ( IndexedTensorReadOnly< TensorNetwork > &&  _rhs)

Assignment operators – Used for tensor assignment WITH indices.

Note that this is NOT a classical assignment operator. In particular this and _rhs are NOT equivalent after the assignment.

Definition at line 58 of file indexedTensor.cpp.

◆ operator=() [3/3]

template<class tensor_type>
void xerus::internal::IndexedTensor< tensor_type >::operator= ( IndexedTensor< tensor_type > &&  _rhs)

The following would be deleted due to move constructor and is therefore implemented here, calls the IndexedTensorReadOnly version.

Definition at line 48 of file indexedTensor.cpp.


The documentation for this class was generated from the following files: