TiledArray  0.7.0
TiledArray::Tensor< T, A > Class Template Reference

An N-dimensional tensor object. More...

#include <foreach.h>

Public Types

typedef Tensor< T, A > Tensor_
 This class type. More...
 
typedef Range range_type
 Tensor range type. More...
 
typedef range_type::size_type size_type
 size type More...
 
typedef A allocator_type
 Allocator type. More...
 
typedef allocator_type::value_type value_type
 Array element type. More...
 
typedef allocator_type::reference reference
 Element reference type. More...
 
typedef allocator_type::const_reference const_reference
 Element reference type. More...
 
typedef allocator_type::pointer pointer
 Element pointer type. More...
 
typedef allocator_type::const_pointer const_pointer
 Element const pointer type. More...
 
typedef allocator_type::difference_type difference_type
 Difference type. More...
 
typedef pointer iterator
 Element iterator type. More...
 
typedef const_pointer const_iterator
 Element const iterator type. More...
 
typedef TiledArray::detail::numeric_type< T >::type numeric_type
 the numeric type that supports T More...
 
typedef TiledArray::detail::scalar_type< T >::type scalar_type
 the scalar type that supports T More...
 

Public Member Functions

 Tensor ()
 
 Tensor (const Tensor_ &other)
 
 Tensor (Tensor_ &&other)
 
 ~Tensor ()
 
Tensor_operator= (const Tensor_ &other)
 
Tensor_operator= (Tensor_ &&other)
 
 Tensor (const range_type &range)
 Construct tensor. More...
 
template<typename Value , typename std::enable_if< std::is_same< Value, value_type >::value &&detail::is_tensor< Value >::value >::type * = nullptr>
 Tensor (const range_type &range, const Value &value)
 Construct a tensor with a fill value. More...
 
template<typename Value , typename std::enable_if< detail::is_numeric< Value >::value >::type * = nullptr>
 Tensor (const range_type &range, const Value &value)
 Construct a tensor with a fill value. More...
 
template<typename InIter , typename std::enable_if< TiledArray::detail::is_input_iterator< InIter >::value &&! std::is_pointer< InIter >::value >::type * = nullptr>
 Tensor (const range_type &range, InIter it)
 Construct an evaluated tensor. More...
 
template<typename U >
 Tensor (const Range &range, const U *u)
 
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value &&! std::is_same< T1, Tensor_ >::value >::type * = nullptr>
 Tensor (const T1 &other)
 Construct a copy of a tensor interface object. More...
 
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
 Tensor (const T1 &other, const Permutation &perm)
 Construct a permuted tensor copy. More...
 
template<typename T1 , typename Op , typename std::enable_if< is_tensor< T1 >::value &&! std::is_same< typename std::decay< Op >::type, Permutation >::value >::type * = nullptr>
 Tensor (const T1 &other, Op &&op)
 Copy and modify the data from other. More...
 
template<typename T1 , typename Op , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
 Tensor (const T1 &other, Op &&op, const Permutation &perm)
 Copy, modify, and permute the data from other. More...
 
template<typename T1 , typename T2 , typename Op , typename std::enable_if< is_tensor< T1, T2 >::value >::type * = nullptr>
 Tensor (const T1 &left, const T2 &right, Op &&op)
 Copy and modify the data from left, and right. More...
 
template<typename T1 , typename T2 , typename Op , typename std::enable_if< is_tensor< T1, T2 >::value >::type * = nullptr>
 Tensor (const T1 &left, const T2 &right, Op &&op, const Permutation &perm)
 Copy, modify, and permute the data from left, and right. More...
 
Tensor_ clone () const
 
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
Tensor_operator= (const T1 &other)
 
const range_typerange () const
 Tensor range object accessor. More...
 
size_type size () const
 Tensor dimension size accessor. More...
 
const_reference operator[] (const size_type i) const
 Element accessor. More...
 
reference operator[] (const size_type i)
 Element accessor. More...
 
template<typename Index , typename std::enable_if< ! std::is_integral< Index >::value >::type * = nullptr>
const_reference operator[] (const Index &i) const
 Element accessor. More...
 
template<typename Index , typename std::enable_if< ! std::is_integral< Index >::value >::type * = nullptr>
reference operator[] (const Index &i)
 Element accessor. More...
 
template<typename... Index>
reference operator() (const Index &... idx)
 Element accessor. More...
 
template<typename... Index>
const_reference operator() (const Index &... idx) const
 Element accessor. More...
 
const_iterator begin () const
 Iterator factory. More...
 
iterator begin ()
 Iterator factory. More...
 
const_iterator end () const
 Iterator factory. More...
 
iterator end ()
 Iterator factory. More...
 
const_pointer data () const
 Data direct access. More...
 
pointer data ()
 Data direct access. More...
 
bool empty () const
 Test if the tensor is empty. More...
 
template<typename Archive , typename std::enable_if< madness::archive::is_output_archive< Archive >::value >::type * = nullptr>
void serialize (Archive &ar)
 Output serialization function. More...
 
template<typename Archive , typename std::enable_if< madness::archive::is_input_archive< Archive >::value >::type * = nullptr>
void serialize (Archive &ar)
 Input serialization function. More...
 
void swap (Tensor_ &other)
 Swap tensor data. More...
 
template<typename Index >
detail::TensorInterface< T, BlockRangeblock (const Index &lower_bound, const Index &upper_bound)
 
detail::TensorInterface< T, BlockRangeblock (const std::initializer_list< size_type > &lower_bound, const std::initializer_list< size_type > &upper_bound)
 
template<typename Index >
detail::TensorInterface< const T, BlockRangeblock (const Index &lower_bound, const Index &upper_bound) const
 
detail::TensorInterface< const T, BlockRangeblock (const std::initializer_list< size_type > &lower_bound, const std::initializer_list< size_type > &upper_bound) const
 
Tensor_ permute (const Permutation &perm) const
 Create a permuted copy of this tensor. More...
 
template<typename Index >
Tensor_shift_to (const Index &bound_shift)
 Shift the lower and upper bound of this tensor. More...
 
template<typename Index >
Tensor_ shift (const Index &bound_shift) const
 Shift the lower and upper bound of this range. More...
 
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ binary (const Right &right, Op &&op) const
 Use a binary, element wise operation to construct a new tensor. More...
 
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ binary (const Right &right, Op &&op, const Permutation &perm) const
 Use a binary, element wise operation to construct a new, permuted tensor. More...
 
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_inplace_binary (const Right &right, Op &&op)
 Use a binary, element wise operation to modify this tensor. More...
 
template<typename Op >
Tensor_ unary (Op &&op) const
 Use a unary, element wise operation to construct a new tensor. More...
 
template<typename Op >
Tensor_ unary (Op &&op, const Permutation &perm) const
 Use a unary, element wise operation to construct a new, permuted tensor. More...
 
template<typename Op >
Tensor_inplace_unary (Op &&op)
 Use a unary, element wise operation to modify this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ scale (const Scalar factor) const
 Construct a scaled copy of this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ scale (const Scalar factor, const Permutation &perm) const
 Construct a scaled and permuted copy of this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_scale_to (const Scalar factor)
 Scale this tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ add (const Right &right) const
 Add this and other to construct a new tensors. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ add (const Right &right, const Permutation &perm) const
 Add this and other to construct a new, permuted tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ add (const Right &right, const Scalar factor) const
 Scale and add this and other to construct a new tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ add (const Right &right, const Scalar factor, const Permutation &perm) const
 Scale and add this and other to construct a new, permuted tensor. More...
 
Tensor_ add (const numeric_type value) const
 Add a constant to a copy of this tensor. More...
 
Tensor_ add (const numeric_type value, const Permutation &perm) const
 Add a constant to a permuted copy of this tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_add_to (const Right &right)
 Add other to this tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_add_to (const Right &right, const Scalar factor)
 Add other to this tensor, and scale the result. More...
 
Tensor_add_to (const numeric_type value)
 Add a constant to this tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ subt (const Right &right) const
 Subtract right from this and return the result. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ subt (const Right &right, const Permutation &perm) const
 Subtract right from this and return the result permuted by perm. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ subt (const Right &right, const Scalar factor) const
 Subtract right from this and return the result scaled by a scaling factor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ subt (const Right &right, const Scalar factor, const Permutation &perm) const
 Subtract right from this and return the result scaled by a scaling factor and permuted by perm. More...
 
Tensor_ subt (const numeric_type value) const
 Subtract a constant from a copy of this tensor. More...
 
Tensor_ subt (const numeric_type value, const Permutation &perm) const
 Subtract a constant from a permuted copy of this tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_subt_to (const Right &right)
 Subtract right from this tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_subt_to (const Right &right, const Scalar factor)
 Subtract right from and scale this tensor. More...
 
Tensor_subt_to (const numeric_type value)
 Subtract a constant from this tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ mult (const Right &right) const
 Multiply this by right to create a new tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ mult (const Right &right, const Permutation &perm) const
 Multiply this by right to create a new, permuted tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ mult (const Right &right, const Scalar factor) const
 Scale and multiply this by right to create a new tensor. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ mult (const Right &right, const Scalar factor, const Permutation &perm) const
 Scale and multiply this by right to create a new, permuted tensor. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_mult_to (const Right &right)
 Multiply this tensor by right. More...
 
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_mult_to (const Right &right, const Scalar factor)
 Scale and multiply this tensor by right. More...
 
Tensor_ neg () const
 Create a negated copy of this tensor. More...
 
Tensor_ neg (const Permutation &perm) const
 Create a negated and permuted copy of this tensor. More...
 
Tensor_neg_to ()
 Negate elements of this tensor. More...
 
Tensor_ conj () const
 Create a complex conjugated copy of this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ conj (const Scalar factor) const
 Create a complex conjugated and scaled copy of this tensor. More...
 
Tensor_ conj (const Permutation &perm) const
 Create a complex conjugated and permuted copy of this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ conj (const Scalar factor, const Permutation &perm) const
 Create a complex conjugated, scaled, and permuted copy of this tensor. More...
 
Tensor_conj_to ()
 Complex conjugate this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_conj_to (const Scalar factor)
 Complex conjugate and scale this tensor. More...
 
template<typename U , typename AU , typename V , typename std::enable_if<!detail::is_tensor_of_tensor< Tensor_, Tensor< U, AU >>::value >::type * = nullptr>
Tensor_ gemm (const Tensor< U, AU > &other, const V factor, const math::GemmHelper &gemm_helper) const
 Contract this tensor with other. More...
 
template<typename U , typename AU , typename V , typename AV , typename W , typename std::enable_if<!detail::is_tensor_of_tensor< Tensor_, Tensor< U, AU >, Tensor< V, AV >>::value >::type * = nullptr>
Tensor_gemm (const Tensor< U, AU > &left, const Tensor< V, AV > &right, const W factor, const math::GemmHelper &gemm_helper)
 Contract two tensors and accumulate the scaled result to this tensor. More...
 
value_type trace () const
 Generalized tensor trace. More...
 
template<typename ReduceOp , typename JoinOp , typename Scalar >
decltype(auto) reduce (ReduceOp &&reduce_op, JoinOp &&join_op, Scalar identity) const
 Unary reduction operation. More...
 
template<typename Right , typename ReduceOp , typename JoinOp , typename Scalar , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
decltype(auto) reduce (const Right &other, ReduceOp &&reduce_op, JoinOp &&join_op, Scalar identity) const
 Binary reduction operation. More...
 
numeric_type sum () const
 Sum of elements. More...
 
numeric_type product () const
 Product of elements. More...
 
scalar_type squared_norm () const
 Square of vector 2-norm. More...
 
scalar_type norm () const
 Vector 2-norm. More...
 
template<typename Numeric = numeric_type>
numeric_type min (typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *=nullptr) const
 Minimum element. More...
 
template<typename Numeric = numeric_type>
numeric_type max (typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *=nullptr) const
 Maximum element. More...
 
scalar_type abs_min () const
 Absolute minimum element. More...
 
scalar_type abs_max () const
 Absolute maximum element. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
numeric_type dot (const Right &other) const
 Vector dot (not inner!) product. More...
 
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
numeric_type inner_product (const Right &other) const
 Vector inner product. More...
 

Detailed Description

template<typename T, typename A = Eigen::aligned_allocator<T>>
class TiledArray::Tensor< T, A >

An N-dimensional tensor object.

Template Parameters
Tthe value type of this tensor
AThe allocator type for the data

Definition at line 40 of file foreach.h.

Member Typedef Documentation

◆ allocator_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef A TiledArray::Tensor< T, A >::allocator_type

Allocator type.

Definition at line 40 of file tensor.h.

◆ const_iterator

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef const_pointer TiledArray::Tensor< T, A >::const_iterator

Element const iterator type.

Definition at line 48 of file tensor.h.

◆ const_pointer

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::const_pointer TiledArray::Tensor< T, A >::const_pointer

Element const pointer type.

Definition at line 45 of file tensor.h.

◆ const_reference

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::const_reference TiledArray::Tensor< T, A >::const_reference

Element reference type.

Definition at line 43 of file tensor.h.

◆ difference_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::difference_type TiledArray::Tensor< T, A >::difference_type

Difference type.

Definition at line 46 of file tensor.h.

◆ iterator

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef pointer TiledArray::Tensor< T, A >::iterator

Element iterator type.

Definition at line 47 of file tensor.h.

◆ numeric_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef TiledArray::detail::numeric_type<T>::type TiledArray::Tensor< T, A >::numeric_type

the numeric type that supports T

Definition at line 50 of file tensor.h.

◆ pointer

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::pointer TiledArray::Tensor< T, A >::pointer

Element pointer type.

Definition at line 44 of file tensor.h.

◆ range_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef Range TiledArray::Tensor< T, A >::range_type

Tensor range type.

Definition at line 38 of file tensor.h.

◆ reference

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::reference TiledArray::Tensor< T, A >::reference

Element reference type.

Definition at line 42 of file tensor.h.

◆ scalar_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef TiledArray::detail::scalar_type<T>::type TiledArray::Tensor< T, A >::scalar_type

the scalar type that supports T

Definition at line 52 of file tensor.h.

◆ size_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef range_type::size_type TiledArray::Tensor< T, A >::size_type

size type

Definition at line 39 of file tensor.h.

◆ Tensor_

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef Tensor<T, A> TiledArray::Tensor< T, A >::Tensor_

This class type.

Definition at line 37 of file tensor.h.

◆ value_type

template<typename T, typename A = Eigen::aligned_allocator<T>>
typedef allocator_type::value_type TiledArray::Tensor< T, A >::value_type

Array element type.

Definition at line 41 of file tensor.h.

Constructor & Destructor Documentation

◆ Tensor() [1/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
TiledArray::Tensor< T, A >::Tensor ( )
inline

Definition at line 118 of file tensor.h.

◆ Tensor() [2/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
TiledArray::Tensor< T, A >::Tensor ( const Tensor_ other)
inline

Definition at line 119 of file tensor.h.

◆ Tensor() [3/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
TiledArray::Tensor< T, A >::Tensor ( Tensor_ &&  other)
inline

Definition at line 120 of file tensor.h.

◆ ~Tensor()

template<typename T, typename A = Eigen::aligned_allocator<T>>
TiledArray::Tensor< T, A >::~Tensor ( )
inline

Definition at line 121 of file tensor.h.

◆ Tensor() [4/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
TiledArray::Tensor< T, A >::Tensor ( const range_type range)
inline

Construct tensor.

Construct a tensor with a range equal to range. The data is uninitialized.

Parameters
rangeThe range of the tensor

Definition at line 136 of file tensor.h.

◆ Tensor() [5/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Value , typename std::enable_if< std::is_same< Value, value_type >::value &&detail::is_tensor< Value >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const range_type range,
const Value &  value 
)
inline

Construct a tensor with a fill value.

Parameters
rangeAn array with the size of of each dimension
valueThe value of the tensor elements

Definition at line 150 of file tensor.h.

◆ Tensor() [6/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Value , typename std::enable_if< detail::is_numeric< Value >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const range_type range,
const Value &  value 
)
inline

Construct a tensor with a fill value.

Parameters
rangeAn array with the size of of each dimension
valueThe value of the tensor elements

Definition at line 165 of file tensor.h.

◆ Tensor() [7/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename InIter , typename std::enable_if< TiledArray::detail::is_input_iterator< InIter >::value &&! std::is_pointer< InIter >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const range_type range,
InIter  it 
)
inline

Construct an evaluated tensor.

Definition at line 175 of file tensor.h.

◆ Tensor() [8/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename U >
TiledArray::Tensor< T, A >::Tensor ( const Range range,
const U *  u 
)
inline

Definition at line 185 of file tensor.h.

◆ Tensor() [9/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value &&! std::is_same< T1, Tensor_ >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  other)
inline

Construct a copy of a tensor interface object.

Template Parameters
T1A tensor type
Parameters
otherThe tensor to be copied

Definition at line 198 of file tensor.h.

◆ Tensor() [10/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  other,
const Permutation perm 
)
inline

Construct a permuted tensor copy.

Template Parameters
T1A tensor type
Parameters
otherThe tensor to be copied
permThe permutation that will be applied to the copy

Definition at line 215 of file tensor.h.

◆ Tensor() [11/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename Op , typename std::enable_if< is_tensor< T1 >::value &&! std::is_same< typename std::decay< Op >::type, Permutation >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  other,
Op &&  op 
)
inline

Copy and modify the data from other.

Template Parameters
T1A tensor type
OpAn element-wise operation type
Parameters
otherThe tensor argument
opThe element-wise operation

Definition at line 235 of file tensor.h.

◆ Tensor() [12/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename Op , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  other,
Op &&  op,
const Permutation perm 
)
inline

Copy, modify, and permute the data from other.

Template Parameters
T1A tensor type
OpAn element-wise operation type
Parameters
otherThe tensor argument
opThe element-wise operation

Definition at line 249 of file tensor.h.

◆ Tensor() [13/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename T2 , typename Op , typename std::enable_if< is_tensor< T1, T2 >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  left,
const T2 &  right,
Op &&  op 
)
inline

Copy and modify the data from left, and right.

Template Parameters
T1A tensor type
T2A tensor type
OpAn element-wise operation type
Parameters
leftThe left-hand tensor argument
rightThe right-hand tensor argument
opThe element-wise operation

Definition at line 265 of file tensor.h.

◆ Tensor() [14/14]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename T2 , typename Op , typename std::enable_if< is_tensor< T1, T2 >::value >::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  left,
const T2 &  right,
Op &&  op,
const Permutation perm 
)
inline

Copy, modify, and permute the data from left, and right.

Template Parameters
T1A tensor type
T2A tensor type
OpAn element-wise operation type
Parameters
leftThe left-hand tensor argument
rightThe right-hand tensor argument
opThe element-wise operation
permThe permutation that will be applied to the arguments

Definition at line 282 of file tensor.h.

Member Function Documentation

◆ abs_max()

template<typename T, typename A = Eigen::aligned_allocator<T>>
scalar_type TiledArray::Tensor< T, A >::abs_max ( ) const
inline

Absolute maximum element.

Returns
The maximum elements of this tensor

Definition at line 1435 of file tensor.h.

◆ abs_min()

template<typename T, typename A = Eigen::aligned_allocator<T>>
scalar_type TiledArray::Tensor< T, A >::abs_min ( ) const
inline

Absolute minimum element.

Returns
The minimum elements of this tensor

Definition at line 1424 of file tensor.h.

◆ add() [1/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::add ( const Right &  right) const
inline

Add this and other to construct a new tensors.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be added to this tensor
Returns
A new tensor where the elements are the sum of the elements of this and other

Definition at line 694 of file tensor.h.

Here is the caller graph for this function:

◆ add() [2/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::add ( const Right &  right,
const Permutation perm 
) const
inline

Add this and other to construct a new, permuted tensor.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be added to this tensor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the sum of the elements of this and other

Definition at line 709 of file tensor.h.

◆ add() [3/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::add ( const Right &  right,
const Scalar  factor 
) const
inline

Scale and add this and other to construct a new tensor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be added to this tensor
factorThe scaling factor
Returns
A new tensor where the elements are the sum of the elements of this and other, scaled by factor

Definition at line 726 of file tensor.h.

◆ add() [4/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::add ( const Right &  right,
const Scalar  factor,
const Permutation perm 
) const
inline

Scale and add this and other to construct a new, permuted tensor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be added to this tensor
factorThe scaling factor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the sum of the elements of this and other, scaled by factor

Definition at line 744 of file tensor.h.

◆ add() [5/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::add ( const numeric_type  value) const
inline

Add a constant to a copy of this tensor.

Parameters
valueThe constant to be added to this tensor
Returns
A new tensor where the elements are the sum of the elements of this and value

Definition at line 757 of file tensor.h.

◆ add() [6/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::add ( const numeric_type  value,
const Permutation perm 
) const
inline

Add a constant to a permuted copy of this tensor.

Parameters
valueThe constant to be added to this tensor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the sum of the elements of this and value

Definition at line 768 of file tensor.h.

◆ add_to() [1/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::add_to ( const Right &  right)
inline

Add other to this tensor.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be added to this tensor
Returns
A reference to this tensor

Definition at line 780 of file tensor.h.

Here is the caller graph for this function:

◆ add_to() [2/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::add_to ( const Right &  right,
const Scalar  factor 
)
inline

Add other to this tensor, and scale the result.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be added to this tensor
factorThe scaling factor
Returns
A reference to this tensor

Definition at line 795 of file tensor.h.

◆ add_to() [3/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::add_to ( const numeric_type  value)
inline

Add a constant to this tensor.

Parameters
valueThe constant to be added
Returns
A reference to this tensor

Definition at line 805 of file tensor.h.

◆ begin() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
const_iterator TiledArray::Tensor< T, A >::begin ( ) const
inline

Iterator factory.

Returns
An iterator to the first data element

Definition at line 392 of file tensor.h.

◆ begin() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
iterator TiledArray::Tensor< T, A >::begin ( )
inline

Iterator factory.

Returns
An iterator to the first data element

Definition at line 397 of file tensor.h.

◆ binary() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::binary ( const Right &  right,
Op &&  op 
) const
inline

Use a binary, element wise operation to construct a new tensor.

Template Parameters
RightThe right-hand tensor type
OpThe binary operation type
Parameters
rightThe right-hand argument in the binary operation
opThe binary, element-wise operation
Returns
A tensor where element i of the new tensor is equal to op(*this[i],other[i])

Definition at line 568 of file tensor.h.

Here is the caller graph for this function:

◆ binary() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::binary ( const Right &  right,
Op &&  op,
const Permutation perm 
) const
inline

Use a binary, element wise operation to construct a new, permuted tensor.

Template Parameters
RightThe right-hand tensor type
OpThe binary operation type
Parameters
rightThe right-hand argument in the binary operation
opThe binary, element-wise operation
permThe permutation to be applied to this tensor
Returns
A tensor where element i of the new tensor is equal to op(*this[i],other[i])

Definition at line 583 of file tensor.h.

◆ block() [1/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index >
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const Index &  lower_bound,
const Index &  upper_bound 
)
inline

Definition at line 490 of file tensor.h.

Here is the caller graph for this function:

◆ block() [2/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< size_type > &  lower_bound,
const std::initializer_list< size_type > &  upper_bound 
)
inline

Definition at line 497 of file tensor.h.

◆ block() [3/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index >
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const Index &  lower_bound,
const Index &  upper_bound 
) const
inline

Definition at line 507 of file tensor.h.

◆ block() [4/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< size_type > &  lower_bound,
const std::initializer_list< size_type > &  upper_bound 
) const
inline

Definition at line 514 of file tensor.h.

◆ clone()

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::clone ( ) const
inline

Definition at line 288 of file tensor.h.

Here is the caller graph for this function:

◆ conj() [1/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::conj ( ) const
inline

Create a complex conjugated copy of this tensor.

Returns
A copy of this tensor that contains the complex conjugate the values

Definition at line 1058 of file tensor.h.

◆ conj() [2/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::conj ( const Scalar  factor) const
inline

Create a complex conjugated and scaled copy of this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
Returns
A copy of this tensor that contains the scaled complex conjugate the values

Definition at line 1071 of file tensor.h.

◆ conj() [3/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::conj ( const Permutation perm) const
inline

Create a complex conjugated and permuted copy of this tensor.

Parameters
permThe permutation to be applied to this tensor
Returns
A permuted copy of this tensor that contains the complex conjugate values

Definition at line 1081 of file tensor.h.

◆ conj() [4/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::conj ( const Scalar  factor,
const Permutation perm 
) const
inline

Create a complex conjugated, scaled, and permuted copy of this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
permThe permutation to be applied to this tensor
Returns
A permuted copy of this tensor that contains the complex conjugate values

Definition at line 1095 of file tensor.h.

◆ conj_to() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::conj_to ( )
inline

Complex conjugate this tensor.

Returns
A reference to this tensor

Definition at line 1103 of file tensor.h.

◆ conj_to() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::conj_to ( const Scalar  factor)
inline

Complex conjugate and scale this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
Returns
A reference to this tensor

Definition at line 1115 of file tensor.h.

◆ data() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
const_pointer TiledArray::Tensor< T, A >::data ( ) const
inline

Data direct access.

Returns
A const pointer to the tensor data

Definition at line 416 of file tensor.h.

Here is the caller graph for this function:

◆ data() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
pointer TiledArray::Tensor< T, A >::data ( )
inline

Data direct access.

Returns
A const pointer to the tensor data

Definition at line 421 of file tensor.h.

◆ dot()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
numeric_type TiledArray::Tensor< T, A >::dot ( const Right &  other) const
inline

Vector dot (not inner!) product.

Template Parameters
RightThe right-hand tensor type
Parameters
otherThe right-hand tensor to be reduced
Returns
The dot product of the this and other If numeric_type is real, this is equivalent to inner product
See also
Tensor::inner_product

Definition at line 1452 of file tensor.h.

◆ empty()

template<typename T, typename A = Eigen::aligned_allocator<T>>
bool TiledArray::Tensor< T, A >::empty ( ) const
inline

Test if the tensor is empty.

Returns
true if this tensor was default constructed (contains no data), otherwise false.

Definition at line 427 of file tensor.h.

Here is the caller graph for this function:

◆ end() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
const_iterator TiledArray::Tensor< T, A >::end ( ) const
inline

Iterator factory.

Returns
An iterator to the last data element

Definition at line 402 of file tensor.h.

◆ end() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
iterator TiledArray::Tensor< T, A >::end ( )
inline

Iterator factory.

Returns
An iterator to the last data element

Definition at line 409 of file tensor.h.

◆ gemm() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename U , typename AU , typename V , typename std::enable_if<!detail::is_tensor_of_tensor< Tensor_, Tensor< U, AU >>::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::gemm ( const Tensor< U, AU > &  other,
const V  factor,
const math::GemmHelper gemm_helper 
) const
inline

Contract this tensor with other.

Template Parameters
UThe other tensor element type
AUThe other tensor allocator type
VThe type of factor scalar
Parameters
otherThe tensor that will be contracted with this tensor
factorMultiply the result by this constant
gemm_helperThe *GEMM operation meta data
Returns
A new tensor which is the result of contracting this tensor with other and scaled by factor

Definition at line 1135 of file tensor.h.

Here is the caller graph for this function:

◆ gemm() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename U , typename AU , typename V , typename AV , typename W , typename std::enable_if<!detail::is_tensor_of_tensor< Tensor_, Tensor< U, AU >, Tensor< V, AV >>::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::gemm ( const Tensor< U, AU > &  left,
const Tensor< V, AV > &  right,
const W  factor,
const math::GemmHelper gemm_helper 
)
inline

Contract two tensors and accumulate the scaled result to this tensor.

GEMM is limited to matrix like contractions. For example, the following contractions are supported:

C[a,b] = A[a,i,j] * B[i,j,b]
C[a,b] = A[a,i,j] * B[b,i,j]
C[a,b] = A[i,j,a] * B[i,j,b]
C[a,b] = A[i,j,a] * B[b,i,j]
C[a,b,c,d] = A[a,b,i,j] * B[i,j,c,d]
C[a,b,c,d] = A[a,b,i,j] * B[c,d,i,j]
C[a,b,c,d] = A[i,j,a,b] * B[i,j,c,d]
C[a,b,c,d] = A[i,j,a,b] * B[c,d,i,j]

Notice that in the above contractions, the inner and outer indices of the arguments for exactly two contiguous groups in each tensor and that each group is in the same order in all tensors. That is, the indices of the tensors must fit the one of the following patterns:

C[M...,N...] = A[M...,K...] * B[K...,N...]
C[M...,N...] = A[M...,K...] * B[N...,K...]
C[M...,N...] = A[K...,M...] * B[K...,N...]
C[M...,N...] = A[K...,M...] * B[N...,K...]

This allows use of optimized BLAS functions to evaluate tensor contractions. Tensor contractions that do not fit this pattern require one or more tensor permutation so that the tensors fit the required pattern.

Template Parameters
UThe left-hand tensor element type
AUThe left-hand tensor allocator type
VThe right-hand tensor element type
AVThe right-hand tensor allocator type
WThe type of the scaling factor
Parameters
leftThe left-hand tensor that will be contracted
rightThe right-hand tensor that will be contracted
factorThe contraction result will be scaling by this value, then accumulated into this
gemm_helperThe *GEMM operation meta data
Returns
A reference to this

Definition at line 1211 of file tensor.h.

◆ inner_product()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
numeric_type TiledArray::Tensor< T, A >::inner_product ( const Right &  other) const
inline

Vector inner product.

Template Parameters
RightThe right-hand tensor type
Parameters
otherThe right-hand tensor to be reduced
Returns
The dot product of the this and other If numeric_type is real, this is equivalent to dot product
See also
Tensor::dot

Definition at line 1470 of file tensor.h.

◆ inplace_binary()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Op , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::inplace_binary ( const Right &  right,
Op &&  op 
)
inline

Use a binary, element wise operation to modify this tensor.

Template Parameters
RightThe right-hand tensor type
OpThe binary operation type
Parameters
rightThe right-hand argument in the binary operation
opThe binary, element-wise operation
Returns
A reference to this object
Exceptions
TiledArray::ExceptionWhen this tensor is empty.
TiledArray::ExceptionWhen other is empty.
TiledArray::ExceptionWhen the range of this tensor is not equal to the range of other.
TiledArray::ExceptionWhen this and other are the same.

Definition at line 601 of file tensor.h.

Here is the caller graph for this function:

◆ inplace_unary()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Op >
Tensor_& TiledArray::Tensor< T, A >::inplace_unary ( Op &&  op)
inline

Use a unary, element wise operation to modify this tensor.

Template Parameters
OpThe unary operation type
Parameters
opThe unary, element-wise operation
Returns
A reference to this object
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 639 of file tensor.h.

Here is the caller graph for this function:

◆ max()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Numeric = numeric_type>
numeric_type TiledArray::Tensor< T, A >::max ( typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *  = nullptr) const
inline

Maximum element.

Returns
The maximum elements of this tensor

Definition at line 1412 of file tensor.h.

◆ min()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Numeric = numeric_type>
numeric_type TiledArray::Tensor< T, A >::min ( typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *  = nullptr) const
inline

Minimum element.

Returns
The minimum elements of this tensor

Definition at line 1399 of file tensor.h.

◆ mult() [1/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::mult ( const Right &  right) const
inline

Multiply this by right to create a new tensor.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be multiplied by this tensor
Returns
A new tensor where the elements are the product of the elements of this and right

Definition at line 941 of file tensor.h.

Here is the caller graph for this function:

◆ mult() [2/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::mult ( const Right &  right,
const Permutation perm 
) const
inline

Multiply this by right to create a new, permuted tensor.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be multiplied by this tensor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the product of the elements of this and right

Definition at line 956 of file tensor.h.

◆ mult() [3/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::mult ( const Right &  right,
const Scalar  factor 
) const
inline

Scale and multiply this by right to create a new tensor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be multiplied by this tensor
factorThe scaling factor
Returns
A new tensor where the elements are the product of the elements of this and right, scaled by factor

Definition at line 973 of file tensor.h.

◆ mult() [4/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::mult ( const Right &  right,
const Scalar  factor,
const Permutation perm 
) const
inline

Scale and multiply this by right to create a new, permuted tensor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be multiplied by this tensor
factorThe scaling factor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the product of the elements of this and right, scaled by factor

Definition at line 991 of file tensor.h.

◆ mult_to() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::mult_to ( const Right &  right)
inline

Multiply this tensor by right.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be multiplied by this tensor
Returns
A reference to this tensor

Definition at line 1006 of file tensor.h.

◆ mult_to() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::mult_to ( const Right &  right,
const Scalar  factor 
)
inline

Scale and multiply this tensor by right.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be multiplied by this tensor
factorThe scaling factor
Returns
A reference to this tensor

Definition at line 1022 of file tensor.h.

◆ neg() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::neg ( ) const
inline

Create a negated copy of this tensor.

Returns
A new tensor that contains the negative values of this tensor

Definition at line 1033 of file tensor.h.

◆ neg() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::neg ( const Permutation perm) const
inline

Create a negated and permuted copy of this tensor.

Parameters
permThe permutation to be applied to this tensor
Returns
A new tensor that contains the negative values of this tensor

Definition at line 1041 of file tensor.h.

◆ neg_to()

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::neg_to ( )
inline

Negate elements of this tensor.

Returns
A reference to this tensor

Definition at line 1049 of file tensor.h.

◆ norm()

template<typename T, typename A = Eigen::aligned_allocator<T>>
scalar_type TiledArray::Tensor< T, A >::norm ( ) const
inline

Vector 2-norm.

Returns
The vector norm of this tensor

Definition at line 1391 of file tensor.h.

Here is the caller graph for this function:

◆ operator()() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename... Index>
reference TiledArray::Tensor< T, A >::operator() ( const Index &...  idx)
inline

Element accessor.

Template Parameters
Indexindex type pack
Parameters
idxThe index pack

Definition at line 372 of file tensor.h.

◆ operator()() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename... Index>
const_reference TiledArray::Tensor< T, A >::operator() ( const Index &...  idx) const
inline

Element accessor.

Template Parameters
Indexindex type pack
Parameters
idxThe index pack

Definition at line 383 of file tensor.h.

◆ operator=() [1/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::operator= ( const Tensor_ other)
inline

Definition at line 122 of file tensor.h.

◆ operator=() [2/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::operator= ( Tensor_ &&  other)
inline

Definition at line 126 of file tensor.h.

◆ operator=() [3/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::operator= ( const T1 &  other)
inline

Definition at line 300 of file tensor.h.

◆ operator[]() [1/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
const_reference TiledArray::Tensor< T, A >::operator[] ( const size_type  i) const
inline

Element accessor.

Returns
The element at the i position.

Definition at line 324 of file tensor.h.

◆ operator[]() [2/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
reference TiledArray::Tensor< T, A >::operator[] ( const size_type  i)
inline

Element accessor.

Returns
The element at the i position.
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 334 of file tensor.h.

◆ operator[]() [3/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index , typename std::enable_if< ! std::is_integral< Index >::value >::type * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator[] ( const Index &  i) const
inline

Element accessor.

Returns
The element at the i position.
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 348 of file tensor.h.

◆ operator[]() [4/4]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index , typename std::enable_if< ! std::is_integral< Index >::value >::type * = nullptr>
reference TiledArray::Tensor< T, A >::operator[] ( const Index &  i)
inline

Element accessor.

Returns
The element at the i position.
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 361 of file tensor.h.

◆ permute()

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::permute ( const Permutation perm) const
inline

Create a permuted copy of this tensor.

Parameters
permThe permutation to be applied to this tensor
Returns
A permuted copy of this tensor

Definition at line 526 of file tensor.h.

Here is the caller graph for this function:

◆ product()

template<typename T, typename A = Eigen::aligned_allocator<T>>
numeric_type TiledArray::Tensor< T, A >::product ( ) const
inline

Product of elements.

Returns
The product of all elements of this tensor

Definition at line 1371 of file tensor.h.

◆ range()

template<typename T, typename A = Eigen::aligned_allocator<T>>
const range_type& TiledArray::Tensor< T, A >::range ( ) const
inline

Tensor range object accessor.

Returns
The tensor range object

Definition at line 310 of file tensor.h.

Here is the caller graph for this function:

◆ reduce() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename ReduceOp , typename JoinOp , typename Scalar >
decltype(auto) TiledArray::Tensor< T, A >::reduce ( ReduceOp &&  reduce_op,
JoinOp &&  join_op,
Scalar  identity 
) const
inline

Unary reduction operation.

Perform an element-wise reduction of the data by executing join_op(result, reduce_op(*this[i])) for each i in the index range of this . result is initialized to identity . If HAVE_INTEL_TBB is defined, and this is a contiguous tensor, the reduction will be executed in an undefined order, otherwise will execute in the order of increasing i .

Template Parameters
ReduceOpThe reduction operation type
JoinOpThe join operation type
Parameters
reduce_opThe element-wise reduction operation
join_opThe join result operation
identityThe identity value of the reduction
Returns
The reduced value

Definition at line 1330 of file tensor.h.

Here is the caller graph for this function:

◆ reduce() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename ReduceOp , typename JoinOp , typename Scalar , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
decltype(auto) TiledArray::Tensor< T, A >::reduce ( const Right &  other,
ReduceOp &&  reduce_op,
JoinOp &&  join_op,
Scalar  identity 
) const
inline

Binary reduction operation.

Perform an element-wise binary reduction of the data of this and other by executing join_op(result, reduce_op(*this[i], other[i])) for each i in the index range of this . result is initialized to identity . If HAVE_INTEL_TBB is defined, and this is a contiguous tensor, the reduction will be executed in an undefined order, otherwise will execute in the order of increasing i .

Template Parameters
RightThe right-hand argument tensor type
ReduceOpThe reduction operation type
JoinOpThe join operation type
Parameters
otherThe right-hand argument of the binary reduction
reduce_opThe element-wise reduction operation
join_opThe join result operation
identityThe identity value of the reduction
Returns
The reduced value

Definition at line 1353 of file tensor.h.

◆ scale() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::scale ( const Scalar  factor) const
inline

Construct a scaled copy of this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
Returns
A new tensor where the elements of this tensor are scaled by factor

Definition at line 654 of file tensor.h.

Here is the caller graph for this function:

◆ scale() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::scale ( const Scalar  factor,
const Permutation perm 
) const
inline

Construct a scaled and permuted copy of this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements of this tensor are scaled by factor and permuted

Definition at line 668 of file tensor.h.

◆ scale_to()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::scale_to ( const Scalar  factor)
inline

Scale this tensor.

Template Parameters
ScalarA scalar type
Parameters
factorThe scaling factor
Returns
A reference to this tensor

Definition at line 680 of file tensor.h.

Here is the caller graph for this function:

◆ serialize() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Archive , typename std::enable_if< madness::archive::is_output_archive< Archive >::value >::type * = nullptr>
void TiledArray::Tensor< T, A >::serialize ( Archive &  ar)
inline

Output serialization function.

This function enables serialization within MADNESS

Template Parameters
ArchiveThe output archive type
Parameters
[out]arThe output archive

Definition at line 437 of file tensor.h.

◆ serialize() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Archive , typename std::enable_if< madness::archive::is_input_archive< Archive >::value >::type * = nullptr>
void TiledArray::Tensor< T, A >::serialize ( Archive &  ar)
inline

Input serialization function.

This function implements serialization to/from MADNESS archive objects

Template Parameters
ArchiveThe input archive type
Parameters
[out]arThe input archive

Definition at line 455 of file tensor.h.

◆ shift()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index >
Tensor_ TiledArray::Tensor< T, A >::shift ( const Index &  bound_shift) const
inline

Shift the lower and upper bound of this range.

Template Parameters
IndexThe shift array type
Parameters
bound_shiftThe shift to be applied to the tensor range
Returns
A shifted copy of this tensor

Definition at line 549 of file tensor.h.

◆ shift_to()

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Index >
Tensor_& TiledArray::Tensor< T, A >::shift_to ( const Index &  bound_shift)
inline

Shift the lower and upper bound of this tensor.

Template Parameters
IndexThe shift array type
Parameters
bound_shiftThe shift to be applied to the tensor range
Returns
A reference to this tensor

Definition at line 537 of file tensor.h.

Here is the caller graph for this function:

◆ size()

template<typename T, typename A = Eigen::aligned_allocator<T>>
size_type TiledArray::Tensor< T, A >::size ( ) const
inline

Tensor dimension size accessor.

Returns
The number of elements in the tensor

Definition at line 317 of file tensor.h.

Here is the caller graph for this function:

◆ squared_norm()

template<typename T, typename A = Eigen::aligned_allocator<T>>
scalar_type TiledArray::Tensor< T, A >::squared_norm ( ) const
inline

Square of vector 2-norm.

Returns
The vector norm of this tensor

Definition at line 1380 of file tensor.h.

Here is the caller graph for this function:

◆ subt() [1/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::subt ( const Right &  right) const
inline

Subtract right from this and return the result.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be subtracted from this tensor
Returns
A new tensor where the elements are the different between the elements of this and right

Definition at line 819 of file tensor.h.

◆ subt() [2/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::subt ( const Right &  right,
const Permutation perm 
) const
inline

Subtract right from this and return the result permuted by perm.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be subtracted from this tensor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the different between the elements of this and right

Definition at line 834 of file tensor.h.

◆ subt() [3/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::subt ( const Right &  right,
const Scalar  factor 
) const
inline

Subtract right from this and return the result scaled by a scaling factor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be subtracted from this tensor
factorThe scaling factor
Returns
A new tensor where the elements are the different between the elements of this and right, scaled by factor

Definition at line 851 of file tensor.h.

◆ subt() [4/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::subt ( const Right &  right,
const Scalar  factor,
const Permutation perm 
) const
inline

Subtract right from this and return the result scaled by a scaling factor and permuted by perm.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be subtracted from this tensor
factorThe scaling factor
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the different between the elements of this and right, scaled by factor

Definition at line 869 of file tensor.h.

◆ subt() [5/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::subt ( const numeric_type  value) const
inline

Subtract a constant from a copy of this tensor.

Returns
A new tensor where the elements are the different between the elements of this and value

Definition at line 881 of file tensor.h.

◆ subt() [6/6]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_ TiledArray::Tensor< T, A >::subt ( const numeric_type  value,
const Permutation perm 
) const
inline

Subtract a constant from a permuted copy of this tensor.

Parameters
valueThe constant to be subtracted
permThe permutation to be applied to this tensor
Returns
A new tensor where the elements are the different between the elements of this and value

Definition at line 891 of file tensor.h.

◆ subt_to() [1/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename std::enable_if< is_tensor< Right >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::subt_to ( const Right &  right)
inline

Subtract right from this tensor.

Template Parameters
RightThe right-hand tensor type
Parameters
rightThe tensor that will be subtracted from this tensor
Returns
A reference to this tensor

Definition at line 902 of file tensor.h.

◆ subt_to() [2/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric< Scalar >::value >::type * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::subt_to ( const Right &  right,
const Scalar  factor 
)
inline

Subtract right from and scale this tensor.

Template Parameters
RightThe right-hand tensor type
ScalarA scalar type
Parameters
rightThe tensor that will be subtracted from this tensor
factorThe scaling factor
Returns
A reference to this tensor

Definition at line 918 of file tensor.h.

◆ subt_to() [3/3]

template<typename T, typename A = Eigen::aligned_allocator<T>>
Tensor_& TiledArray::Tensor< T, A >::subt_to ( const numeric_type  value)
inline

Subtract a constant from this tensor.

Returns
A reference to this tensor

Definition at line 927 of file tensor.h.

◆ sum()

template<typename T, typename A = Eigen::aligned_allocator<T>>
numeric_type TiledArray::Tensor< T, A >::sum ( ) const
inline

Sum of elements.

Returns
The sum of all elements of this tensor

Definition at line 1362 of file tensor.h.

◆ swap()

template<typename T, typename A = Eigen::aligned_allocator<T>>
void TiledArray::Tensor< T, A >::swap ( Tensor_ other)
inline

Swap tensor data.

Parameters
otherThe tensor to swap with this

Definition at line 484 of file tensor.h.

◆ trace()

template<typename T, typename A = Eigen::aligned_allocator<T>>
value_type TiledArray::Tensor< T, A >::trace ( ) const
inline

Generalized tensor trace.

This function will compute the sum of the hyper diagonal elements of tensor.

Returns
The trace of this tensor
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 1273 of file tensor.h.

◆ unary() [1/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Op >
Tensor_ TiledArray::Tensor< T, A >::unary ( Op &&  op) const
inline

Use a unary, element wise operation to construct a new tensor.

Template Parameters
OpThe unary operation type
Parameters
opThe unary, element-wise operation
Returns
A tensor where element i of the new tensor is equal to op(*this[i])
Exceptions
TiledArray::ExceptionWhen this tensor is empty.

Definition at line 614 of file tensor.h.

Here is the caller graph for this function:

◆ unary() [2/2]

template<typename T, typename A = Eigen::aligned_allocator<T>>
template<typename Op >
Tensor_ TiledArray::Tensor< T, A >::unary ( Op &&  op,
const Permutation perm 
) const
inline

Use a unary, element wise operation to construct a new, permuted tensor.

Template Parameters
OpThe unary operation type
Parameters
opThe unary operation
permThe permutation to be applied to this tensor
Returns
A permuted tensor with elements that have been modified by op
Exceptions
TiledArray::ExceptionWhen this tensor is empty.
TiledArray::ExceptionThe dimension of perm does not match that of this tensor.

Definition at line 628 of file tensor.h.


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