Tatooine
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices > Struct Template Reference

#include <indexed_dynamic_tensor.h>

Collaboration diagram for tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >:
[legend]

Public Types

using tensor_type = std::decay_t< Tensor >
 
using value_type = tatooine::value_type< tensor_type >
 
using indices = type_list< Indices... >
 
template<std::size_t I>
using index_at = typename indices::template at< I >
 

Public Member Functions

 indexed_dynamic_tensor (Tensor t)
 
auto tensor () const -> auto const &
 
auto tensor () -> auto &
 
auto dimension (std::size_t const i)
 
template<index E>
auto dimension () const
 
template<typename... ContractedTensors, std::size_t... Seq>
requires (!is_const<std::remove_reference_t<Tensor>>)
auto assign (added_contracted_dynamic_tensor< ContractedTensors... > other, std::index_sequence< Seq... >)
 
template<typename... IndexedTensors, std::size_t... FreeIndexSequence, std::size_t... ContractedIndexSequence, std::size_t... ContractedTensorsSequence>
requires (!is_const<std::remove_reference_t<Tensor>>)
auto add (contracted_dynamic_tensor< IndexedTensors... > other, std::index_sequence< FreeIndexSequence... >, std::index_sequence< ContractedIndexSequence... >, std::index_sequence< ContractedTensorsSequence... >)
 
template<typename... IndexedTensors>
auto add (contracted_dynamic_tensor< IndexedTensors... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename... IndexedTensors>
auto operator+= (contracted_dynamic_tensor< IndexedTensors... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename... IndexedTensors, index T, index... Ts>
auto resize_internal_tensor (contracted_dynamic_tensor< IndexedTensors... > other, type_set_impl< T, Ts... > const, std::vector< std::size_t > &size)
 
template<typename... IndexedTensors>
auto resize_internal_tensor (contracted_dynamic_tensor< IndexedTensors... >, type_set_impl<> const, std::vector< std::size_t > &size)
 
template<typename... IndexedTensors>
auto resize_internal_tensor (contracted_dynamic_tensor< IndexedTensors... > other)
 
template<typename... IndexedTensors>
auto assign (contracted_dynamic_tensor< IndexedTensors... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename... IndexedTensors>
auto operator= (contracted_dynamic_tensor< IndexedTensors... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename... ContractedTensors>
auto operator= (added_contracted_dynamic_tensor< ContractedTensors... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename Tensors , typename... Is>
auto operator= (indexed_dynamic_tensor< Tensors, Is... > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > >)
 
template<typename LHS , typename RHS , same_as< index_at< 0 > > I, index J, same_as< index_at< 1 > > K>
auto operator+= (contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J, K > > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > > &&is_same< value_type, tatooine::value_type< LHS > > &&is_same< value_type, tatooine::value_type< RHS > >)
 \(\mA(i,k) <- \mB(i,j) \mC(j, k) + \mA(i,k)\) More...
 
template<typename LHS , typename RHS , same_as< index_at< 0 > > I, index J, same_as< index_at< 1 > > K>
auto operator= (contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J, K > > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > > &&is_same< value_type, tatooine::value_type< LHS > > &&is_same< value_type, tatooine::value_type< RHS > >)
 
template<typename LHS , typename RHS , typename I , typename J >
auto operator+= (contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J > > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > > &&is_same< value_type, tatooine::value_type< LHS > > &&is_same< value_type, tatooine::value_type< RHS > > &&is_same< I, index_at< 0 > >)
 \(\va(i) = \mB(i,j) \vc(j) + \va(i)\) More...
 
template<typename LHS , typename RHS , typename I , typename J >
auto operator= (contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J > > other) -> indexed_dynamic_tensor &requires(!is_const< std::remove_reference_t< Tensor > > &&is_same< value_type, tatooine::value_type< LHS > > &&is_same< value_type, tatooine::value_type< RHS > > &&is_same< I, index_at< 0 > >)
 \(\va(i) = \mB(i,j) \vc(j)\) More...
 

Static Public Member Functions

static auto index_map ()
 
template<std::size_t... Seq>
static auto constexpr index_map (std::index_sequence< Seq... >)
 
static auto constexpr rank ()
 
template<index E>
static auto constexpr contains () -> bool
 

Private Member Functions

template<std::size_t I, index E, index HeadIndex, index... TailIndices>
auto dimension_ () const
 

Private Attributes

Tensor m_tensor
 

Member Typedef Documentation

◆ index_at

template<dynamic_tensor Tensor, index... Indices>
template<std::size_t I>
using tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::index_at = typename indices::template at<I>

◆ indices

template<dynamic_tensor Tensor, index... Indices>
using tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::indices = type_list<Indices...>

◆ tensor_type

template<dynamic_tensor Tensor, index... Indices>
using tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::tensor_type = std::decay_t<Tensor>

◆ value_type

template<dynamic_tensor Tensor, index... Indices>
using tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::value_type = tatooine::value_type<tensor_type>

Constructor & Destructor Documentation

◆ indexed_dynamic_tensor()

template<dynamic_tensor Tensor, index... Indices>
tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::indexed_dynamic_tensor ( Tensor  t)
inlineexplicit

Member Function Documentation

◆ add() [1/2]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::add ( contracted_dynamic_tensor< IndexedTensors... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ add() [2/2]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors, std::size_t... FreeIndexSequence, std::size_t... ContractedIndexSequence, std::size_t... ContractedTensorsSequence>
requires (!is_const<std::remove_reference_t<Tensor>>)
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::add ( contracted_dynamic_tensor< IndexedTensors... >  other,
std::index_sequence< FreeIndexSequence... >  ,
std::index_sequence< ContractedIndexSequence... >  ,
std::index_sequence< ContractedTensorsSequence... >   
)
inline

◆ assign() [1/2]

template<dynamic_tensor Tensor, index... Indices>
template<typename... ContractedTensors, std::size_t... Seq>
requires (!is_const<std::remove_reference_t<Tensor>>)
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::assign ( added_contracted_dynamic_tensor< ContractedTensors... >  other,
std::index_sequence< Seq... >   
)
inline

◆ assign() [2/2]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::assign ( contracted_dynamic_tensor< IndexedTensors... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ contains()

template<dynamic_tensor Tensor, index... Indices>
template<index E>
static auto constexpr tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::contains ( ) -> bool
inlinestaticconstexpr

◆ dimension() [1/2]

template<dynamic_tensor Tensor, index... Indices>
template<index E>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::dimension ( ) const
inline

◆ dimension() [2/2]

template<dynamic_tensor Tensor, index... Indices>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::dimension ( std::size_t const  i)
inline

◆ dimension_()

template<dynamic_tensor Tensor, index... Indices>
template<std::size_t I, index E, index HeadIndex, index... TailIndices>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::dimension_ ( ) const
inlineprivate

◆ index_map() [1/2]

template<dynamic_tensor Tensor, index... Indices>
static auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::index_map ( )
inlinestatic

◆ index_map() [2/2]

template<dynamic_tensor Tensor, index... Indices>
template<std::size_t... Seq>
static auto constexpr tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::index_map ( std::index_sequence< Seq... >  )
inlinestaticconstexpr

◆ operator+=() [1/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename LHS , typename RHS , typename I , typename J >
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator+= ( contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J > >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>> && is_same<value_type, tatooine::value_type<LHS>> && is_same<value_type, tatooine::value_type<RHS>> && is_same<I, index_at<0>>)
inline

\(\va(i) = \mB(i,j) \vc(j) + \va(i)\)

◆ operator+=() [2/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename LHS , typename RHS , same_as< index_at< 0 > > I, index J, same_as< index_at< 1 > > K>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator+= ( contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J, K > >  other) -> indexed_dynamic_tensor& requires( !is_const<std::remove_reference_t<Tensor>> && is_same<value_type, tatooine::value_type<LHS>> && is_same<value_type, tatooine::value_type<RHS>>)
inline

\(\mA(i,k) <- \mB(i,j) \mC(j, k) + \mA(i,k)\)

NOTE: index_at<1> cannot be performed as a requirement because clang evaluates this requirement even if rank() > 2 is required before index_at<1>. So this ugly way of writing it needs to be done.

◆ operator+=() [3/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator+= ( contracted_dynamic_tensor< IndexedTensors... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ operator=() [1/5]

template<dynamic_tensor Tensor, index... Indices>
template<typename... ContractedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator= ( added_contracted_dynamic_tensor< ContractedTensors... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ operator=() [2/5]

template<dynamic_tensor Tensor, index... Indices>
template<typename LHS , typename RHS , typename I , typename J >
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator= ( contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J > >  other) -> indexed_dynamic_tensor& requires( !is_const<std::remove_reference_t<Tensor>> && is_same<value_type, tatooine::value_type<LHS>> && is_same<value_type, tatooine::value_type<RHS>> && is_same<I, index_at<0>>)
inline

\(\va(i) = \mB(i,j) \vc(j)\)

◆ operator=() [3/5]

template<dynamic_tensor Tensor, index... Indices>
template<typename LHS , typename RHS , same_as< index_at< 0 > > I, index J, same_as< index_at< 1 > > K>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator= ( contracted_dynamic_tensor< indexed_dynamic_tensor< LHS, I, J >, indexed_dynamic_tensor< RHS, J, K > >  other) -> indexed_dynamic_tensor& requires( !is_const<std::remove_reference_t<Tensor>> && is_same<value_type, tatooine::value_type<LHS>> && is_same<value_type, tatooine::value_type<RHS>>)
inline

\(\mA(i,k) = \mB(i,j) \mC(j, k)\)

NOTE: index_at<1> cannot be performed as a requirement because clang evaluates this requirement even if rank() > 2 is required before index_at<1>. So this ugly way of writing it needs to be done.

◆ operator=() [4/5]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator= ( contracted_dynamic_tensor< IndexedTensors... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ operator=() [5/5]

template<dynamic_tensor Tensor, index... Indices>
template<typename Tensors , typename... Is>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::operator= ( indexed_dynamic_tensor< Tensors, Is... >  other) -> indexed_dynamic_tensor& requires(!is_const<std::remove_reference_t<Tensor>>)
inline

◆ rank()

template<dynamic_tensor Tensor, index... Indices>
static auto constexpr tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::rank ( )
inlinestaticconstexpr

◆ resize_internal_tensor() [1/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::resize_internal_tensor ( contracted_dynamic_tensor< IndexedTensors... >  other)
inline

◆ resize_internal_tensor() [2/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors, index T, index... Ts>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::resize_internal_tensor ( contracted_dynamic_tensor< IndexedTensors... >  other,
type_set_impl< T, Ts... > const  ,
std::vector< std::size_t > &  size 
)
inline

◆ resize_internal_tensor() [3/3]

template<dynamic_tensor Tensor, index... Indices>
template<typename... IndexedTensors>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::resize_internal_tensor ( contracted_dynamic_tensor< IndexedTensors... >  ,
type_set_impl<> const  ,
std::vector< std::size_t > &  size 
)
inline

◆ tensor() [1/2]

template<dynamic_tensor Tensor, index... Indices>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::tensor ( ) -> auto&
inline

◆ tensor() [2/2]

template<dynamic_tensor Tensor, index... Indices>
auto tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::tensor ( ) const -> auto const&
inline

Member Data Documentation

◆ m_tensor

template<dynamic_tensor Tensor, index... Indices>
Tensor tatooine::einstein_notation::indexed_dynamic_tensor< Tensor, Indices >::m_tensor
private

The documentation for this struct was generated from the following file: