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

Documentation

template<typename T, typename A>
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 50 of file tensor.h.

Public Types

typedef Tensor< T, A > Tensor_
 This class type. More...
 
typedef Range range_type
 Tensor range type. More...
 
typedef range_type::index1_type index1_type
 1-index type More...
 
typedef range_type::ordinal_type ordinal_type
 Ordinal type. More...
 
typedef range_type::ordinal_type size_type
 Size type (to meet the container concept) 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_v< 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)
 
 Tensor (const Range &range, std::initializer_list< T > il)
 
template<typename T1 , typename std::enable_if< is_tensor< T1 >::value &&!std::is_same< T1, Tensor_ >::value &&!detail::has_conversion_operator_v< T1, Tensor_ >>::type * = nullptr>
 Tensor (const T1 &other)
 Construct a copy of a tensor interface object. More...
 
template<typename T1 , typename Perm , typename std::enable_if< is_tensor< T1 >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
 Tensor (const T1 &other, const Perm &perm)
 Construct a permuted tensor copy. More...
 
template<typename T1 , typename Op , typename std::enable_if_t< is_tensor< T1 >::value &&!detail::is_permutation_v< std::decay_t< Op >>> * = nullptr>
 Tensor (const T1 &other, Op &&op)
 Copy and modify the data from other. More...
 
template<typename T1 , typename Op , typename Perm , typename std::enable_if_t< is_tensor< T1 >::value &&detail::is_permutation_v< Perm >> * = nullptr>
 Tensor (const T1 &other, Op &&op, const Perm &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 Perm , typename std::enable_if< is_tensor< T1, T2 >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
 Tensor (const T1 &left, const T2 &right, Op &&op, const Perm &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...
 
range_typerange ()
 Tensor range object mutable accessor. More...
 
ordinal_type size () const
 Tensor dimension size accessor. More...
 
template<typename Ordinal , std::enable_if_t< std::is_integral< Ordinal >::value > * = nullptr>
const_reference operator[] (const Ordinal ord) const
 Const element accessor. More...
 
template<typename Ordinal , std::enable_if_t< std::is_integral< Ordinal >::value > * = nullptr>
reference operator[] (const Ordinal ord)
 Element accessor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const_reference operator[] (const Index &i) const
 Const element accessor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
reference operator[] (const Index &i)
 Element accessor. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
const_reference operator[] (const std::initializer_list< Integer > &i) const
 Const element accessor. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
reference operator[] (const std::initializer_list< Integer > &i)
 Element accessor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const_reference operator() (const Index &i) const
 Const element accessor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
reference operator() (const Index &i)
 Element accessor. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
const_reference operator() (const std::initializer_list< Integer > &i) const
 Const element accessor. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
reference operator() (const std::initializer_list< Integer > &i)
 Element accessor. More...
 
template<typename... Index, std::enable_if_t< detail::is_integral_list< Index... >::value > * = nullptr>
const_reference operator() (const Index &... i) const
 Const element accessor. More...
 
template<typename... Index, std::enable_if_t< detail::is_integral_list< Index... >::value > * = nullptr>
reference operator() (const Index &... i)
 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 Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ permute (const Perm &perm) const
 Create a permuted copy of this tensor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
Tensor_shift_to (const Index &bound_shift)
 Shift the lower and upper bound of this tensor. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
Tensor_shift_to (const std::initializer_list< Integer > &bound_shift)
 Shift the lower and upper bound of this tensor. More...
 
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
Tensor_ shift (const Index &bound_shift) const
 Shift the lower and upper bound of this range. More...
 
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
Tensor_ shift (const std::initializer_list< Integer > &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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ binary (const Right &right, Op &&op, const Perm &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 , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ unary (Op &&op, const Perm &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_v< Scalar >>::type * = nullptr>
Tensor_ scale (const Scalar factor) const
 Construct a scaled copy of this tensor. More...
 
template<typename Scalar , typename Perm , typename = std::enable_if_t<detail::is_numeric_v<Scalar> && detail::is_permutation_v<Perm>>>
Tensor_ scale (const Scalar factor, const Perm &perm) const
 Construct a scaled and permuted copy of this tensor. More...
 
template<typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ add (const Right &right, const Perm &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_v< Scalar >>::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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ add (const Right &right, const Scalar factor, const Perm &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...
 
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ add (const numeric_type value, const Perm &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_v< Scalar >>::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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ subt (const Right &right, const Perm &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_v< Scalar >>::type * = nullptr>
Tensor_ subt (const Right &right, const Scalar factor) const
 
template<typename Right , typename Scalar , typename Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ subt (const Right &right, const Scalar factor, const Perm &perm) const
 
Tensor_ subt (const numeric_type value) const
 Subtract a constant from a copy of this tensor. More...
 
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ subt (const numeric_type value, const Perm &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_v< Scalar >>::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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ mult (const Right &right, const Perm &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_v< Scalar >>::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 Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ mult (const Right &right, const Scalar factor, const Perm &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_v< Scalar >>::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...
 
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ neg (const Perm &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_v< Scalar >>::type * = nullptr>
Tensor_ conj (const Scalar factor) const
 Create a complex conjugated and scaled copy of this tensor. More...
 
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ conj (const Perm &perm) const
 Create a complex conjugated and permuted copy of this tensor. More...
 
template<typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ conj (const Scalar factor, const Perm &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_v< Scalar >>::type * = nullptr>
Tensor_conj_to (const Scalar factor)
 Complex conjugate and scale this tensor. More...
 
template<typename U , typename AU , typename V >
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 >
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...
 
template<typename U , typename AU , typename V , typename AV , typename ElementMultiplyAddOp , typename = std::enable_if_t<std::is_invocable_r_v< void, std::remove_reference_t<ElementMultiplyAddOp>, value_type&, const U&, const V&>>>
Tensor_gemm (const Tensor< U, AU > &left, const Tensor< V, AV > &right, const math::GemmHelper &gemm_helper, ElementMultiplyAddOp &&elem_muladd_op)
 
template<typename TileType = Tensor_, typename = detail::enable_if_trace_is_defined_t<TileType>>
decltype(auto) 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...
 
template<typename ResultType = scalar_type>
ResultType 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...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
detail::TensorInterface< T, BlockRangeblock (const Index1 &lower_bound, const Index2 &upper_bound)
 Constructs a view of the block defined by lower_bound and upper_bound. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
detail::TensorInterface< const T, BlockRangeblock (const Index1 &lower_bound, const Index2 &upper_bound) const
 Constructs a view of the block defined by lower_bound and upper_bound. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
detail::TensorInterface< T, BlockRangeblock (const std::initializer_list< Index1 > &lower_bound, const std::initializer_list< Index2 > &upper_bound)
 Constructs a view of the block defined by lower_bound and upper_bound. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
detail::TensorInterface< const T, BlockRangeblock (const std::initializer_list< Index1 > &lower_bound, const std::initializer_list< Index2 > &upper_bound) const
 Constructs a view of the block defined by lower_bound and upper_bound. More...
 
template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
detail::TensorInterface< const T, BlockRangeblock (const PairRange &bounds) const
 Constructs a view of the block defined by its bounds . More...
 
template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
detail::TensorInterface< T, BlockRangeblock (const PairRange &bounds)
 Constructs a view of the block defined by its bounds . More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
detail::TensorInterface< const T, BlockRangeblock (const std::initializer_list< std::initializer_list< Index >> &bounds) const
 Constructs a view of the block defined by its bounds . More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
detail::TensorInterface< T, BlockRangeblock (const std::initializer_list< std::initializer_list< Index >> &bounds)
 Constructs a view of the block defined by its bounds . More...
 

Member Typedef Documentation

◆ allocator_type

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

Allocator type.

Definition at line 64 of file tensor.h.

◆ const_iterator

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

Element const iterator type.

Definition at line 77 of file tensor.h.

◆ const_pointer

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

Element const pointer type.

Definition at line 73 of file tensor.h.

◆ const_reference

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

Element reference type.

Definition at line 70 of file tensor.h.

◆ difference_type

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

Difference type.

Definition at line 75 of file tensor.h.

◆ index1_type

template<typename T , typename A >
typedef range_type::index1_type TiledArray::Tensor< T, A >::index1_type

1-index type

Definition at line 60 of file tensor.h.

◆ iterator

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

Element iterator type.

Definition at line 76 of file tensor.h.

◆ numeric_type

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

the numeric type that supports T

Definition at line 79 of file tensor.h.

◆ ordinal_type

template<typename T , typename A >
typedef range_type::ordinal_type TiledArray::Tensor< T, A >::ordinal_type

Ordinal type.

Definition at line 61 of file tensor.h.

◆ pointer

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

Element pointer type.

Definition at line 71 of file tensor.h.

◆ range_type

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

Tensor range type.

Definition at line 59 of file tensor.h.

◆ reference

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

Element reference type.

Definition at line 68 of file tensor.h.

◆ scalar_type

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

the scalar type that supports T

Definition at line 81 of file tensor.h.

◆ size_type

template<typename T , typename A >
typedef range_type::ordinal_type TiledArray::Tensor< T, A >::size_type

Size type (to meet the container concept)

Definition at line 63 of file tensor.h.

◆ Tensor_

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

This class type.

Definition at line 58 of file tensor.h.

◆ value_type

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

Array element type.

Definition at line 66 of file tensor.h.

Constructor & Destructor Documentation

◆ Tensor() [1/15]

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

Definition at line 144 of file tensor.h.

◆ Tensor() [2/15]

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

Definition at line 145 of file tensor.h.

◆ Tensor() [3/15]

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

Definition at line 146 of file tensor.h.

◆ ~Tensor()

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

Definition at line 147 of file tensor.h.

◆ Tensor() [4/15]

template<typename T , typename A >
TiledArray::Tensor< T, A >::Tensor ( const range_type range)
inlineexplicit

Construct tensor.

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

Parameters
rangeThe range of the tensor

Definition at line 162 of file tensor.h.

◆ Tensor() [5/15]

template<typename T , typename A >
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 175 of file tensor.h.

◆ Tensor() [6/15]

template<typename T , typename A >
template<typename Value , typename std::enable_if< detail::is_numeric_v< 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 190 of file tensor.h.

◆ Tensor() [7/15]

template<typename T , typename A >
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 200 of file tensor.h.

◆ Tensor() [8/15]

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

Definition at line 208 of file tensor.h.

◆ Tensor() [9/15]

template<typename T , typename A >
TiledArray::Tensor< T, A >::Tensor ( const Range range,
std::initializer_list< T >  il 
)
inline

Definition at line 213 of file tensor.h.

◆ Tensor() [10/15]

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

Construct a copy of a tensor interface object.

Template Parameters
T1A tensor type
Parameters
otherThe tensor to be copied
Note
this constructor is disabled if T1 already has a conversion operator to this type

Definition at line 227 of file tensor.h.

◆ Tensor() [11/15]

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

Construct a permuted tensor copy.

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

Definition at line 244 of file tensor.h.

◆ Tensor() [12/15]

template<typename T , typename A >
template<typename T1 , typename Op , typename std::enable_if_t< is_tensor< T1 >::value &&!detail::is_permutation_v< std::decay_t< Op >>> * = 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 276 of file tensor.h.

◆ Tensor() [13/15]

template<typename T , typename A >
template<typename T1 , typename Op , typename Perm , typename std::enable_if_t< is_tensor< T1 >::value &&detail::is_permutation_v< Perm >> * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  other,
Op &&  op,
const Perm &  perm 
)
inline

Copy, modify, and permute the data from other.

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

Definition at line 292 of file tensor.h.

◆ Tensor() [14/15]

template<typename T , typename A >
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 321 of file tensor.h.

◆ Tensor() [15/15]

template<typename T , typename A >
template<typename T1 , typename T2 , typename Op , typename Perm , typename std::enable_if< is_tensor< T1, T2 >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
TiledArray::Tensor< T, A >::Tensor ( const T1 &  left,
const T2 &  right,
Op &&  op,
const Perm &  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
PermA permutation tile
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 340 of file tensor.h.

Member Function Documentation

◆ abs_max()

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

Absolute maximum element.

Returns
The maximum elements of this tensor

Definition at line 2110 of file tensor.h.

◆ abs_min()

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

Absolute minimum element.

Returns
The minimum elements of this tensor

Definition at line 2096 of file tensor.h.

◆ add() [1/6]

template<typename T , typename A >
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 1195 of file tensor.h.

◆ add() [2/6]

template<typename T , typename A >
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::add ( const numeric_type  value,
const Perm &  perm 
) const
inline

Add a constant to a permuted copy of this tensor.

Template Parameters
PermA permutation tile
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 1209 of file tensor.h.

◆ add() [3/6]

template<typename T , typename A >
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 1121 of file tensor.h.

Here is the caller graph for this function:

◆ add() [4/6]

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

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

Template Parameters
RightThe right-hand tensor type
PermA permutation tile
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 1141 of file tensor.h.

◆ add() [5/6]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1162 of file tensor.h.

◆ add() [6/6]

template<typename T , typename A >
template<typename Right , typename Scalar , typename Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::add ( const Right &  right,
const Scalar  factor,
const Perm &  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
PermA permutation tile
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 1182 of file tensor.h.

◆ add_to() [1/3]

template<typename T , typename A >
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 1248 of file tensor.h.

◆ add_to() [2/3]

template<typename T , typename A >
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 1222 of file tensor.h.

Here is the caller graph for this function:

◆ add_to() [3/3]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1238 of file tensor.h.

◆ begin() [1/2]

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

Iterator factory.

Returns
An iterator to the first data element

Definition at line 590 of file tensor.h.

◆ begin() [2/2]

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

Iterator factory.

Returns
An iterator to the first data element

Definition at line 585 of file tensor.h.

◆ binary() [1/2]

template<typename T , typename A >
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 950 of file tensor.h.

Here is the caller graph for this function:

◆ binary() [2/2]

template<typename T , typename A >
template<typename Right , typename Op , typename Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::binary ( const Right &  right,
Op &&  op,
const Perm &  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
PermA permutation tile
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 968 of file tensor.h.

◆ block() [1/8]

template<typename T , typename A >
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const Index1 &  lower_bound,
const Index2 &  upper_bound 
)
inline

Constructs a view of the block defined by lower_bound and upper_bound.

Examples of using this:

std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
auto tview = t.block(lobounds, upbounds);
assert(tview.range().includes(lobounds));
assert(tview(lobounds) == t(lobounds));
Template Parameters
Index1An integral range type
Index2An integral range type
Parameters
lower_boundThe lower bound
upper_boundThe upper bound
Returns
a {const,mutable} view of the block defined by lower_bound and upper_bound
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 704 of file tensor.h.

Here is the caller graph for this function:

◆ block() [2/8]

template<typename T , typename A >
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const Index1 &  lower_bound,
const Index2 &  upper_bound 
) const
inline

Constructs a view of the block defined by lower_bound and upper_bound.

Examples of using this:

std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
auto tview = t.block(lobounds, upbounds);
assert(tview.range().includes(lobounds));
assert(tview(lobounds) == t(lobounds));
Template Parameters
Index1An integral range type
Index2An integral range type
Parameters
lower_boundThe lower bound
upper_boundThe upper bound
Returns
a {const,mutable} view of the block defined by lower_bound and upper_bound
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 714 of file tensor.h.

◆ block() [3/8]

template<typename T , typename A >
template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const PairRange &  bounds)
inline

Constructs a view of the block defined by its bounds .

Examples of using this:

std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
// using vector of pairs
std::vector<std::pair<size_t,size_t>> vpbounds{{0,4}, {1,6}, {2,8}};
auto tview0 = t.block(vpbounds);
// using vector of tuples
std::vector<std::tuple<size_t,size_t>> vtbounds{{0,4}, {1,6}, {2,8}};
auto tview1 = t.block(vtbounds);
assert(tview0 == tview1);
// using zipped ranges of bounds (using Boost.Range)
// need to #include <boost/range/combine.hpp>
auto tview2 = t.block(boost::combine(lobounds, upbounds));
assert(tview0 == tview2);
// using zipped ranges of bounds (using Ranges-V3)
// need to #include <range/v3/view/zip.hpp>
auto tview3 = t.block(ranges::views::zip(lobounds, upbounds));
assert(tview0 == tview3);
Template Parameters
PairRangeType representing a range of generalized pairs (see TiledArray::detail::is_gpair_v )
Parameters
boundsThe block bounds
Returns
a {const,mutable} view of the block defined by its bounds
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen get<0>(bounds[i]) >= get<1>(bounds[i])

Definition at line 808 of file tensor.h.

◆ block() [4/8]

template<typename T , typename A >
template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const PairRange &  bounds) const
inline

Constructs a view of the block defined by its bounds .

Examples of using this:

std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
// using vector of pairs
std::vector<std::pair<size_t,size_t>> vpbounds{{0,4}, {1,6}, {2,8}};
auto tview0 = t.block(vpbounds);
// using vector of tuples
std::vector<std::tuple<size_t,size_t>> vtbounds{{0,4}, {1,6}, {2,8}};
auto tview1 = t.block(vtbounds);
assert(tview0 == tview1);
// using zipped ranges of bounds (using Boost.Range)
// need to #include <boost/range/combine.hpp>
auto tview2 = t.block(boost::combine(lobounds, upbounds));
assert(tview0 == tview2);
// using zipped ranges of bounds (using Ranges-V3)
// need to #include <range/v3/view/zip.hpp>
auto tview3 = t.block(ranges::views::zip(lobounds, upbounds));
assert(tview0 == tview3);
Template Parameters
PairRangeType representing a range of generalized pairs (see TiledArray::detail::is_gpair_v )
Parameters
boundsThe block bounds
Returns
a {const,mutable} view of the block defined by its bounds
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen get<0>(bounds[i]) >= get<1>(bounds[i])

Definition at line 800 of file tensor.h.

◆ block() [5/8]

template<typename T , typename A >
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< Index1 > &  lower_bound,
const std::initializer_list< Index2 > &  upper_bound 
)
inline

Constructs a view of the block defined by lower_bound and upper_bound.

Examples of using this:

auto tview = t.block({0, 1, 2}, {4, 6, 8});
assert(tview.range().includes(lobounds));
assert(tview(lobounds) == t(lobounds));
Template Parameters
Index1An integral type
Index2An integral type
Parameters
lower_boundThe lower bound
upper_boundThe upper bound
Returns
a {const,mutable} view of the block defined by lower_bound and upper_bound
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 744 of file tensor.h.

◆ block() [6/8]

template<typename T , typename A >
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< Index1 > &  lower_bound,
const std::initializer_list< Index2 > &  upper_bound 
) const
inline

Constructs a view of the block defined by lower_bound and upper_bound.

Examples of using this:

auto tview = t.block({0, 1, 2}, {4, 6, 8});
assert(tview.range().includes(lobounds));
assert(tview(lobounds) == t(lobounds));
Template Parameters
Index1An integral type
Index2An integral type
Parameters
lower_boundThe lower bound
upper_boundThe upper bound
Returns
a {const,mutable} view of the block defined by lower_bound and upper_bound
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 755 of file tensor.h.

◆ block() [7/8]

template<typename T , typename A >
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
detail::TensorInterface<T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< std::initializer_list< Index >> &  bounds)
inline

Constructs a view of the block defined by its bounds .

Examples of using this:

auto tview0 = t.block({{0,4}, {1,6}, {2,8}});
Template Parameters
IndexAn integral type
Parameters
boundsThe block bounds
Returns
a {const,mutable} view of the block defined by its bounds
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen get<0>(bounds[i]) >= get<1>(bounds[i])

Definition at line 839 of file tensor.h.

◆ block() [8/8]

template<typename T , typename A >
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
detail::TensorInterface<const T, BlockRange> TiledArray::Tensor< T, A >::block ( const std::initializer_list< std::initializer_list< Index >> &  bounds) const
inline

Constructs a view of the block defined by its bounds .

Examples of using this:

auto tview0 = t.block({{0,4}, {1,6}, {2,8}});
Template Parameters
IndexAn integral type
Parameters
boundsThe block bounds
Returns
a {const,mutable} view of the block defined by its bounds
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen get<0>(bounds[i]) >= get<1>(bounds[i])

Definition at line 831 of file tensor.h.

◆ clone()

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

Definition at line 359 of file tensor.h.

Here is the caller graph for this function:

◆ conj() [1/4]

template<typename T , typename A >
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 1528 of file tensor.h.

◆ conj() [2/4]

template<typename T , typename A >
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::conj ( const Perm &  perm) const
inline

Create a complex conjugated and permuted copy of this tensor.

Template Parameters
PermA permutation type
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 1554 of file tensor.h.

◆ conj() [3/4]

template<typename T , typename A >
template<typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::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 1541 of file tensor.h.

◆ conj() [4/4]

template<typename T , typename A >
template<typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::conj ( const Scalar  factor,
const Perm &  perm 
) const
inline

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

Template Parameters
ScalarA scalar type
PermA permutation 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 1571 of file tensor.h.

◆ conj_to() [1/2]

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

Complex conjugate this tensor.

Returns
A reference to this tensor

Definition at line 1579 of file tensor.h.

◆ conj_to() [2/2]

template<typename T , typename A >
template<typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::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 1591 of file tensor.h.

◆ data() [1/2]

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

Data direct access.

Returns
A const pointer to the tensor data

Definition at line 614 of file tensor.h.

◆ data() [2/2]

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

Data direct access.

Returns
A const pointer to the tensor data

Definition at line 609 of file tensor.h.

Here is the caller graph for this function:

◆ dot()

template<typename T , typename A >
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 2130 of file tensor.h.

◆ empty()

template<typename T , typename A >
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 620 of file tensor.h.

Here is the caller graph for this function:

◆ end() [1/2]

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

Iterator factory.

Returns
An iterator to the last data element

Definition at line 602 of file tensor.h.

◆ end() [2/2]

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

Iterator factory.

Returns
An iterator to the last data element

Definition at line 595 of file tensor.h.

◆ gemm() [1/3]

template<typename T , typename A >
template<typename U , typename AU , typename V , typename AV , typename ElementMultiplyAddOp , typename = std::enable_if_t<std::is_invocable_r_v< void, std::remove_reference_t<ElementMultiplyAddOp>, value_type&, const U&, const V&>>>
Tensor_& TiledArray::Tensor< T, A >::gemm ( const Tensor< U, AU > &  left,
const Tensor< V, AV > &  right,
const math::GemmHelper gemm_helper,
ElementMultiplyAddOp &&  elem_muladd_op 
)
inline

Definition at line 1887 of file tensor.h.

◆ gemm() [2/3]

template<typename T , typename A >
template<typename U , typename AU , typename V , typename AV , typename W >
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@param gemm_helper The *GEMM operation meta data
Returns
A reference to this
Note
if this is uninitialized, i.e., if this->empty()==true will this is equivalent to
return (*this = left.gemm(right, factor, gemm_helper));

Definition at line 1741 of file tensor.h.

◆ gemm() [3/3]

template<typename T , typename A >
template<typename U , typename AU , typename V >
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 1609 of file tensor.h.

Here is the caller graph for this function:

◆ inner_product()

template<typename T , typename A >
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 2147 of file tensor.h.

◆ inplace_binary()

template<typename T , typename A >
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 1005 of file tensor.h.

Here is the caller graph for this function:

◆ inplace_unary()

template<typename T , typename A >
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 1062 of file tensor.h.

Here is the caller graph for this function:

◆ max()

template<typename T , typename A >
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 2085 of file tensor.h.

◆ min()

template<typename T , typename A >
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 2073 of file tensor.h.

◆ mult() [1/4]

template<typename T , typename A >
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 1398 of file tensor.h.

Here is the caller graph for this function:

◆ mult() [2/4]

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

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

Template Parameters
RightThe right-hand tensor type
Perma permutation 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 1418 of file tensor.h.

◆ mult() [3/4]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1439 of file tensor.h.

◆ mult() [4/4]

template<typename T , typename A >
template<typename Right , typename Scalar , typename Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::mult ( const Right &  right,
const Scalar  factor,
const Perm &  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
PermA permutation 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 1459 of file tensor.h.

◆ mult_to() [1/2]

template<typename T , typename A >
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 1475 of file tensor.h.

◆ mult_to() [2/2]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1491 of file tensor.h.

◆ neg() [1/2]

template<typename T , typename A >
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 1502 of file tensor.h.

◆ neg() [2/2]

template<typename T , typename A >
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::neg ( const Perm &  perm) const
inline

Create a negated and permuted copy of this tensor.

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

Definition at line 1513 of file tensor.h.

◆ neg_to()

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

Negate elements of this tensor.

Returns
A reference to this tensor

Definition at line 1520 of file tensor.h.

◆ norm()

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

Vector 2-norm.

Template Parameters
ResultTypereturn type
Note
This evaluates std::sqrt(ResultType(this->squared_norm()))
Returns
The vector norm of this tensor

Definition at line 2065 of file tensor.h.

◆ operator()() [1/6]

template<typename T , typename A >
template<typename... Index, std::enable_if_t< detail::is_integral_list< Index... >::value > * = nullptr>
reference TiledArray::Tensor< T, A >::operator() ( const Index &...  i)
inline

Element accessor.

Template Parameters
Indexan integral list ( see TiledArray::detail::is_integral_list )
Parameters
[in]ian index
Returns
Reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 576 of file tensor.h.

◆ operator()() [2/6]

template<typename T , typename A >
template<typename... Index, std::enable_if_t< detail::is_integral_list< Index... >::value > * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator() ( const Index &...  i) const
inline

Const element accessor.

Template Parameters
Indexan integral list ( see TiledArray::detail::is_integral_list )
Parameters
[in]ian index
Returns
Const reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 561 of file tensor.h.

◆ operator()() [3/6]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
reference TiledArray::Tensor< T, A >::operator() ( const Index &  i)
inline

Element accessor.

Template Parameters
IndexAn integral range type
Parameters
[in]ian index
Returns
Reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 516 of file tensor.h.

◆ operator()() [4/6]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator() ( const Index &  i) const
inline

Const element accessor.

Template Parameters
IndexAn integral range type
Parameters
[in]ian index
Returns
Const reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 501 of file tensor.h.

◆ operator()() [5/6]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
reference TiledArray::Tensor< T, A >::operator() ( const std::initializer_list< Integer > &  i)
inline

Element accessor.

Template Parameters
IntegerAn integral type
Parameters
[in]ian index
Returns
Reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 546 of file tensor.h.

◆ operator()() [6/6]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator() ( const std::initializer_list< Integer > &  i) const
inline

Const element accessor.

Template Parameters
IntegerAn integral type
Parameters
[in]ian index
Returns
Const reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 531 of file tensor.h.

◆ operator=() [1/3]

template<typename T , typename A >
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 371 of file tensor.h.

◆ operator=() [2/3]

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

Definition at line 148 of file tensor.h.

◆ operator=() [3/3]

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

Definition at line 152 of file tensor.h.

◆ operator[]() [1/6]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
reference TiledArray::Tensor< T, A >::operator[] ( const Index &  i)
inline

Element accessor.

Template Parameters
IndexAn integral range type
Parameters
[in]ian index
Returns
Reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 456 of file tensor.h.

◆ operator[]() [2/6]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator[] ( const Index &  i) const
inline

Const element accessor.

Template Parameters
IndexAn integral range type
Parameters
[in]ian index
Returns
Const reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 441 of file tensor.h.

◆ operator[]() [3/6]

template<typename T , typename A >
template<typename Ordinal , std::enable_if_t< std::is_integral< Ordinal >::value > * = nullptr>
reference TiledArray::Tensor< T, A >::operator[] ( const Ordinal  ord)
inline

Element accessor.

Template Parameters
Ordinalan integer type that represents an ordinal
Parameters
[in]ordan ordinal index
Returns
Reference to the element at position ord .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 426 of file tensor.h.

◆ operator[]() [4/6]

template<typename T , typename A >
template<typename Ordinal , std::enable_if_t< std::is_integral< Ordinal >::value > * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator[] ( const Ordinal  ord) const
inline

Const element accessor.

Template Parameters
Ordinalan integer type that represents an ordinal
Parameters
[in]ordan ordinal index
Returns
Const reference to the element at position ord .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 411 of file tensor.h.

◆ operator[]() [5/6]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
reference TiledArray::Tensor< T, A >::operator[] ( const std::initializer_list< Integer > &  i)
inline

Element accessor.

Template Parameters
IntegerAn integral type
Parameters
[in]ian index
Returns
Reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 486 of file tensor.h.

◆ operator[]() [6/6]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
const_reference TiledArray::Tensor< T, A >::operator[] ( const std::initializer_list< Integer > &  i) const
inline

Const element accessor.

Template Parameters
IntegerAn integral type
Parameters
[in]ian index
Returns
Const reference to the element at position i .
Note
This asserts (using TA_ASSERT) that this is not empty and ord is included in the range

Definition at line 471 of file tensor.h.

◆ permute()

template<typename T , typename A >
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::permute ( const Perm &  perm) const
inline

Create a permuted copy of this tensor.

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

Definition at line 853 of file tensor.h.

◆ product()

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

Product of elements.

Returns
The product of all elements of this tensor

Definition at line 2039 of file tensor.h.

◆ range() [1/2]

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

Tensor range object mutable accessor.

Returns
The tensor range object
Note
asserts that this object has been already initialized

Definition at line 392 of file tensor.h.

◆ range() [2/2]

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

Tensor range object accessor.

Returns
The tensor range object

Definition at line 384 of file tensor.h.

Here is the caller graph for this function:

◆ reduce() [1/2]

template<typename T , typename A >
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 2022 of file tensor.h.

◆ reduce() [2/2]

template<typename T , typename A >
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 1996 of file tensor.h.

Here is the caller graph for this function:

◆ scale() [1/2]

template<typename T , typename A >
template<typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::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 1077 of file tensor.h.

Here is the caller graph for this function:

◆ scale() [2/2]

template<typename T , typename A >
template<typename Scalar , typename Perm , typename = std::enable_if_t<detail::is_numeric_v<Scalar> && detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::scale ( const Scalar  factor,
const Perm &  perm 
) const
inline

Construct a scaled and permuted copy of this tensor.

Template Parameters
ScalarA scalar type
PermA permutation tile
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 1093 of file tensor.h.

◆ scale_to()

template<typename T , typename A >
template<typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::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 1106 of file tensor.h.

Here is the caller graph for this function:

◆ serialize() [1/2]

template<typename T , typename A >
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 630 of file tensor.h.

◆ serialize() [2/2]

template<typename T , typename A >
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 648 of file tensor.h.

◆ shift() [1/2]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::shift ( const Index &  bound_shift) const
inline

Shift the lower and upper bound of this range.

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

Definition at line 917 of file tensor.h.

◆ shift() [2/2]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::shift ( const std::initializer_list< Integer > &  bound_shift) const
inline

Shift the lower and upper bound of this range.

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

Definition at line 931 of file tensor.h.

◆ shift_to() [1/2]

template<typename T , typename A >
template<typename Index , std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::shift_to ( const Index &  bound_shift)
inline

Shift the lower and upper bound of this tensor.

Template Parameters
IndexAn integral range type
Parameters
bound_shiftThe shift to be applied to the tensor range
Returns
A reference to this tensor

Definition at line 890 of file tensor.h.

Here is the caller graph for this function:

◆ shift_to() [2/2]

template<typename T , typename A >
template<typename Integer , std::enable_if_t< std::is_integral_v< Integer >> * = nullptr>
Tensor_& TiledArray::Tensor< T, A >::shift_to ( const std::initializer_list< Integer > &  bound_shift)
inline

Shift the lower and upper bound of this tensor.

Template Parameters
IntegerAn integral type
Parameters
bound_shiftThe shift to be applied to the tensor range
Returns
A reference to this tensor

Definition at line 903 of file tensor.h.

◆ size()

template<typename T , typename A >
ordinal_type TiledArray::Tensor< T, A >::size ( ) const
inline

Tensor dimension size accessor.

Returns
The number of elements in the tensor

Definition at line 400 of file tensor.h.

Here is the caller graph for this function:

◆ squared_norm()

template<typename T , typename A >
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 2048 of file tensor.h.

Here is the caller graph for this function:

◆ subt() [1/6]

template<typename T , typename A >
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 1339 of file tensor.h.

◆ subt() [2/6]

template<typename T , typename A >
template<typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::subt ( const numeric_type  value,
const Perm &  perm 
) const
inline

Subtract a constant from a permuted copy of this tensor.

Template Parameters
PermA permutation tile
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 1350 of file tensor.h.

◆ subt() [3/6]

template<typename T , typename A >
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 1263 of file tensor.h.

◆ subt() [4/6]

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

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

Template Parameters
RightThe right-hand tensor type
PermA permutation 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 1283 of file tensor.h.

◆ subt() [5/6]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1305 of file tensor.h.

◆ subt() [6/6]

template<typename T , typename A >
template<typename Right , typename Scalar , typename Perm , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
Tensor_ TiledArray::Tensor< T, A >::subt ( const Right &  right,
const Scalar  factor,
const Perm &  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
PermA permutation 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 1326 of file tensor.h.

◆ subt_to() [1/3]

template<typename T , typename A >
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 1386 of file tensor.h.

◆ subt_to() [2/3]

template<typename T , typename A >
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 1361 of file tensor.h.

◆ subt_to() [3/3]

template<typename T , typename A >
template<typename Right , typename Scalar , typename std::enable_if< is_tensor< Right >::value &&detail::is_numeric_v< Scalar >>::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 1377 of file tensor.h.

◆ sum()

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

Sum of elements.

Returns
The sum of all elements of this tensor

Definition at line 2030 of file tensor.h.

◆ swap()

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

Swap tensor data.

Parameters
otherThe tensor to swap with this

Definition at line 678 of file tensor.h.

◆ trace()

template<typename T , typename A >
template<typename TileType = Tensor_, typename = detail::enable_if_trace_is_defined_t<TileType>>
decltype(auto) 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 1975 of file tensor.h.

◆ unary() [1/2]

template<typename T , typename A >
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 1018 of file tensor.h.

Here is the caller graph for this function:

◆ unary() [2/2]

template<typename T , typename A >
template<typename Op , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
Tensor_ TiledArray::Tensor< T, A >::unary ( Op &&  op,
const Perm &  perm 
) const
inline

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

Template Parameters
OpThe unary operation type
PermA permutation tile
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 1034 of file tensor.h.


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