Tatooine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
tatooine::tensor< ValueType, Dims > Struct Template Reference

#include <tensor.h>

Inheritance diagram for tatooine::tensor< ValueType, Dims >:
[legend]
Collaboration diagram for tatooine::tensor< ValueType, Dims >:
[legend]

Public Types

using this_type = tensor< ValueType, Dims... >
 
using tensor_parent_type = base_tensor< this_type, ValueType, Dims... >
 
using value_type = typename tensor_parent_type::value_type
 
using array_parent_type = static_multidim_array< ValueType, x_fastest, stack, Dims... >
 
- Public Types inherited from tatooine::static_multidim_array< ValueType, x_fastest, stack, Dims... >
using size_type = static_multidim_size< IndexOrder, Resolution... >
 
using value_type = ValueType
 
using this_type = static_multidim_array< ValueType, IndexOrder, MemLoc, Resolution... >
 
using container_type = std::conditional_t< std::is_same< MemLoc, stack >::value, std::array< ValueType, num_components()>, std::vector< ValueType > >
 
- Public Types inherited from tatooine::base_tensor< tensor< ValueType, Dims... >, ValueType, Dims... >
using value_type = ValueType
 
using tensor_type = tensor< ValueType, Dims... >
 
using this_type = base_tensor< tensor< ValueType, Dims... >, ValueType, Dims... >
 
using parent_type = crtp< tensor< ValueType, Dims... > >
 
using multidim_size_t = static_multidim_size< x_fastest, Dims... >
 
using const_indexed_type = einstein_notation::indexed_static_tensor< tensor< ValueType, Dims... > const &, Is... >
 
using indexed_type = einstein_notation::indexed_static_tensor< tensor< ValueType, Dims... > &, Is... >
 
- Public Types inherited from tatooine::crtp< Derived >
using derived_type = Derived
 

Public Member Functions

constexpr tensor ()=default
 
constexpr tensor (tensor const &)=default
 
constexpr tensor (tensor &&other) noexcept=default
 
constexpr auto operator= (tensor const &) -> tensor &=default
 
constexpr auto operator= (tensor &&other) noexcept -> tensor &=default
 
 ~tensor ()=default
 
auto constexpr at (integral auto const ... is) -> decltype(auto)
 
auto constexpr at (integral auto const ... is) const -> decltype(auto)
 
auto constexpr at (einstein_notation::index auto const ... is) -> decltype(auto)
 
auto constexpr at (einstein_notation::index auto const ... is) const -> decltype(auto)
 
constexpr auto at (integral_range auto const &indices) const -> auto const &
 
constexpr auto at (integral_range auto const &indices) -> auto &
 
template<typename... Is>
requires ((einstein_notation::index<Is> && ...) || (integral<Is> && ...))
auto constexpr operator() (Is const ... is) -> decltype(auto)
 
template<typename... Is>
requires ((einstein_notation::index<Is> && ...) || (integral<Is> && ...))
auto constexpr operator() (Is const ... is) const -> decltype(auto)
 
constexpr auto operator() (integral_range auto const &indices) const -> const auto &
 
constexpr auto operator() (integral_range auto const &indices) -> auto &
 
template<convertible_to< ValueType >... Ts>
requires (tensor_parent_type::num_components() == sizeof...(Ts))
constexpr tensor (Ts const &... ts)
 
constexpr tensor (tag::zeros_t zeros)
 
constexpr tensor (tag::ones_t ones)
 
template<typename FillReal >
requires is_arithmetic<ValueType>
constexpr tensor (tag::fill< FillReal > f)
 
template<typename RandomReal , typename Engine >
requires is_arithmetic<ValueType>
constexpr tensor (random::uniform< RandomReal, Engine > &&rand)
 
template<arithmetic RandomReal, typename Engine >
constexpr tensor (random::uniform< RandomReal, Engine > &rand)
 
template<arithmetic RandomReal, typename Engine >
requires is_arithmetic<ValueType>
constexpr tensor (random::normal< RandomReal, Engine > &&rand)
 
template<arithmetic RandomReal, typename Engine >
requires is_arithmetic<ValueType>
constexpr tensor (random::normal< RandomReal, Engine > &rand)
 
template<static_tensor OtherTensor>
requires (same_dimensions<this_type, OtherTensor>())
constexpr tensor (OtherTensor &&other)
 
template<static_tensor OtherTensor>
requires (same_dimensions<this_type, OtherTensor>())
constexpr auto operator= (OtherTensor &&other) -> tensor &
 
template<typename OtherT >
auto operator< (tensor< OtherT, Dims... > const &other) const
 
template<typename F >
auto unary_operation (F &&f) -> auto &
 
template<typename F , typename OtherTensor , typename OtherT >
auto binary_operation (F &&f, base_tensor< OtherTensor, OtherT, Dims... > const &other) -> decltype(auto)
 
- Public Member Functions inherited from tatooine::static_multidim_array< ValueType, x_fastest, stack, Dims... >
constexpr static_multidim_array (static_multidim_array const &other)=default
 
constexpr static_multidim_array (static_multidim_array &&other) noexcept=default
 
constexpr static_multidim_array (static_multidim_array< OtherT, OtherIndexing, OtherMemLoc, Resolution... > const &other)
 
constexpr static_multidim_array (convertible_to< ValueType > auto &&... ts)
 
constexpr static_multidim_array ()
 
constexpr static_multidim_array (tag::fill< S > const &f)
 
constexpr static_multidim_array (tag::zeros_t)
 
constexpr static_multidim_array (tag::ones_t)
 
 static_multidim_array (std::vector< ValueType > const &data)
 
constexpr static_multidim_array (std::array< ValueType, num_components()> const &data)
 
constexpr static_multidim_array (std::array< ValueType, num_components()> &&data)
 
constexpr static_multidim_array (std::vector< ValueType > &&data)
 
constexpr static_multidim_array (random::uniform< RandomReal, Engine > &rand)
 
constexpr static_multidim_array (random::uniform< RandomReal, Engine > &&rand)
 
constexpr static_multidim_array (random::normal< RandomReal, Engine > &&rand)
 
constexpr static_multidim_array (random::normal< RandomReal, Engine > &rand)
 
constexpr auto operator= (static_multidim_array const &other) -> static_multidim_array &=default
 
constexpr auto operator= (static_multidim_array &&other) noexcept -> static_multidim_array &=default
 
constexpr auto operator= (static_multidim_array< OtherT, OtherIndexing, OtherMemLoc, Resolution... > const &other) -> static_multidim_array &
 
 ~static_multidim_array ()=default
 
constexpr auto at (integral auto const ... is) const -> const auto &requires(sizeof...(is)==num_dimensions())
 
constexpr auto at (integral auto const ... is) -> auto &requires(sizeof...(is)==num_dimensions())
 
constexpr auto at (integral_range auto const &indices) const -> auto const &
 
constexpr auto at (integral_range auto const &indices) -> auto &
 
constexpr auto operator() (integral auto const ... is) const -> auto const &requires(sizeof...(is)==num_dimensions())
 
constexpr auto operator() (integral auto const ... is) -> auto &
 
constexpr auto operator() (integral_range auto const &indices) const -> const auto &
 
constexpr auto operator() (integral_range auto const &indices) -> auto &
 
constexpr auto operator[] (std::size_t i) -> auto &
 
constexpr auto operator[] (std::size_t i) const -> auto const &
 
constexpr auto internal_container () -> auto &
 
constexpr auto internal_container () const -> auto const &
 
constexpr auto data () -> ValueType *
 
constexpr auto data () const -> ValueType const *
 
constexpr void unary_operation (F &&f)
 
constexpr void binary_operation (F &&f, static_multidim_array< OtherT, OtherIndexing, OtherMemLoc, Resolution... > const &other)
 
- Public Member Functions inherited from tatooine::base_tensor< tensor< ValueType, Dims... >, ValueType, Dims... >
constexpr base_tensor ()=default
 
constexpr base_tensor (Other &&other)
 
auto constexpr operator= (Other &&other) -> base_tensor &
 
auto constexpr assign (Other &&other) -> void
 
auto constexpr at (Is const ...)
 
auto constexpr at (Is const ...) const
 
auto constexpr at (integral auto const ... is) const -> decltype(auto) requires(sizeof...(is)==rank())
 
auto constexpr at (integral auto const ... is) -> decltype(auto) requires(sizeof...(is)==rank())
 
auto constexpr at (integral_range auto const &is) -> decltype(auto)
 
auto constexpr at (integral_range auto const &is) const -> decltype(auto)
 
auto constexpr operator() (Is const ... is) const
 
auto constexpr operator() (Is const ... is)
 
auto constexpr operator() (integral auto const ... is) const -> decltype(auto) requires(sizeof...(is)==rank())
 
auto constexpr operator() (integral auto const ... is) -> decltype(auto) requires(sizeof...(is)==rank())
 
auto constexpr slice (std::size_t fixed_index, std::index_sequence< Is... >) -> decltype(auto)
 
auto constexpr slice (std::size_t fixed_index) -> decltype(auto)
 
auto constexpr slice (std::size_t fixed_index, std::index_sequence< Is... >) const
 
auto constexpr slice (std::size_t fixed_index) const
 
auto operator+= (base_tensor< OtherTensor, OtherValueType, Dims... > const &other) -> auto &
 
auto operator+= (convertible_to< ValueType > auto const &other) -> auto &
 
auto operator-= (base_tensor< OtherTensor, OtherValueType, Dims... > const &other) -> auto &
 
auto operator-= (convertible_to< ValueType > auto const &other) -> auto &
 
auto operator*= (convertible_to< ValueType > auto const &other) -> auto &
 
auto operator/= (convertible_to< ValueType > auto const &other) -> auto &
 
auto isnan () const
 
auto isinf () const
 
- Public Member Functions inherited from tatooine::crtp< Derived >
constexpr auto as_derived () -> derived_type &
 returns casted as_derived data More...
 
constexpr auto as_derived () const -> derived_type const &
 returns casted as_derived data More...
 

Static Public Member Functions

static constexpr auto zeros ()
 
static constexpr auto ones ()
 
static constexpr auto fill (ValueType const &t)
 
template<typename RandEng = std::mt19937_64>
static constexpr auto randu (ValueType min=0, ValueType max=1, RandEng &&eng=RandEng{std::random_device{}()})
 
template<typename RandEng = std::mt19937_64>
static constexpr auto randn (ValueType mean=0, ValueType stddev=1, RandEng &&eng=RandEng{std::random_device{}()})
 
static auto constexpr dimension (std::size_t const i)
 
static auto constexpr num_components ()
 
static auto constexpr rank ()
 
- Static Public Member Functions inherited from tatooine::static_multidim_array< ValueType, x_fastest, stack, Dims... >
static std::size_t constexpr num_components ()
 
static std::size_t constexpr num_dimensions ()
 
static auto constexpr size ()
 
static auto constexpr plain_index (integral auto const ... indices)
 
static auto plain_index (integral_range auto const &indices)
 
static auto constexpr in_range (integral auto const ... indices)
 
static constexpr auto zeros ()
 
static constexpr auto ones ()
 
static constexpr auto fill (S &&s)
 
static auto randu (ValueType min=0, ValueType max=1, RandEng &&eng=RandEng{std::random_device{}()})
 
static auto randn (ValueType mean=0, ValueType stddev=1, RandEng &&eng=RandEng{std::random_device{}()})
 
- Static Public Member Functions inherited from tatooine::base_tensor< tensor< ValueType, Dims... >, ValueType, Dims... >
static auto constexpr rank ()
 
static auto constexpr num_components ()
 
static auto constexpr dimensions ()
 
static auto constexpr dimension (std::size_t const i)
 
static auto constexpr is_static () -> bool
 
static auto constexpr is_tensor () -> bool
 
static auto constexpr indices ()
 
static auto constexpr for_indices (invocable< decltype(Dims)... > auto &&f)
 
static auto constexpr array_index (integral auto const ... is)
 

Member Typedef Documentation

◆ array_parent_type

template<arithmetic_or_complex ValueType, std::size_t... Dims>
using tatooine::tensor< ValueType, Dims >::array_parent_type = static_multidim_array<ValueType, x_fastest, stack, Dims...>

◆ tensor_parent_type

template<arithmetic_or_complex ValueType, std::size_t... Dims>
using tatooine::tensor< ValueType, Dims >::tensor_parent_type = base_tensor<this_type, ValueType, Dims...>

◆ this_type

template<arithmetic_or_complex ValueType, std::size_t... Dims>
using tatooine::tensor< ValueType, Dims >::this_type = tensor<ValueType, Dims...>

◆ value_type

template<arithmetic_or_complex ValueType, std::size_t... Dims>
using tatooine::tensor< ValueType, Dims >::value_type = typename tensor_parent_type::value_type

Constructor & Destructor Documentation

◆ tensor() [1/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( )
constexprdefault

◆ tensor() [2/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( tensor< ValueType, Dims > const &  )
constexprdefault

◆ tensor() [3/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( tensor< ValueType, Dims > &&  other)
constexprdefaultnoexcept

◆ ~tensor()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
tatooine::tensor< ValueType, Dims >::~tensor ( )
default

◆ tensor() [4/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<convertible_to< ValueType >... Ts>
requires (tensor_parent_type::num_components() == sizeof...(Ts))
constexpr tatooine::tensor< ValueType, Dims >::tensor ( Ts const &...  ts)
inlineexplicitconstexpr

◆ tensor() [5/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( tag::zeros_t  zeros)
inlineexplicitconstexpr

◆ tensor() [6/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( tag::ones_t  ones)
inlineexplicitconstexpr

◆ tensor() [7/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename FillReal >
requires is_arithmetic<ValueType>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( tag::fill< FillReal >  f)
inlineexplicitconstexpr

◆ tensor() [8/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename RandomReal , typename Engine >
requires is_arithmetic<ValueType>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( random::uniform< RandomReal, Engine > &&  rand)
inlineexplicitconstexpr

◆ tensor() [9/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<arithmetic RandomReal, typename Engine >
constexpr tatooine::tensor< ValueType, Dims >::tensor ( random::uniform< RandomReal, Engine > &  rand)
inlineexplicitconstexpr

◆ tensor() [10/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<arithmetic RandomReal, typename Engine >
requires is_arithmetic<ValueType>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( random::normal< RandomReal, Engine > &&  rand)
inlineexplicitconstexpr

◆ tensor() [11/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<arithmetic RandomReal, typename Engine >
requires is_arithmetic<ValueType>
constexpr tatooine::tensor< ValueType, Dims >::tensor ( random::normal< RandomReal, Engine > &  rand)
inlineexplicitconstexpr

◆ tensor() [12/12]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<static_tensor OtherTensor>
requires (same_dimensions<this_type, OtherTensor>())
constexpr tatooine::tensor< ValueType, Dims >::tensor ( OtherTensor &&  other)
inlineexplicitconstexpr

Member Function Documentation

◆ at() [1/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
auto constexpr tatooine::tensor< ValueType, Dims >::at ( einstein_notation::index auto const ...  is) -> decltype(auto)
inlineconstexpr

◆ at() [2/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
auto constexpr tatooine::tensor< ValueType, Dims >::at ( einstein_notation::index auto const ...  is) const -> decltype(auto)
inlineconstexpr

◆ at() [3/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
auto constexpr tatooine::tensor< ValueType, Dims >::at ( integral auto const ...  is) -> decltype(auto)
inlineconstexpr

◆ at() [4/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
auto constexpr tatooine::tensor< ValueType, Dims >::at ( integral auto const ...  is) const -> decltype(auto)
inlineconstexpr

◆ at() [5/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::at ( integral_range auto const &  indices) -> auto&
inlineconstexpr

◆ at() [6/6]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::at ( integral_range auto const &  indices) const -> auto const&
inlineconstexpr

◆ binary_operation()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename F , typename OtherTensor , typename OtherT >
auto tatooine::tensor< ValueType, Dims >::binary_operation ( F &&  f,
base_tensor< OtherTensor, OtherT, Dims... > const &  other 
) -> decltype(auto)
inline

◆ dimension()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static auto constexpr tatooine::base_tensor< Tensor, ValueType, Dims >::dimension ( std::size_t const  i)
inlinestaticconstexpr

◆ fill()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static constexpr auto tatooine::tensor< ValueType, Dims >::fill ( ValueType const &  t)
inlinestaticconstexpr

◆ num_components()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static auto constexpr tatooine::base_tensor< Tensor, ValueType, Dims >::num_components ( )
inlinestaticconstexpr

◆ ones()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static constexpr auto tatooine::tensor< ValueType, Dims >::ones ( )
inlinestaticconstexpr

◆ operator()() [1/4]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::operator() ( integral_range auto const &  indices) -> auto&
inlineconstexpr

◆ operator()() [2/4]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::operator() ( integral_range auto const &  indices) const -> const auto&
inlineconstexpr

◆ operator()() [3/4]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename... Is>
requires ((einstein_notation::index<Is> && ...) || (integral<Is> && ...))
auto constexpr tatooine::tensor< ValueType, Dims >::operator() ( Is const ...  is) -> decltype(auto)
inlineconstexpr

◆ operator()() [4/4]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename... Is>
requires ((einstein_notation::index<Is> && ...) || (integral<Is> && ...))
auto constexpr tatooine::tensor< ValueType, Dims >::operator() ( Is const ...  is) const -> decltype(auto)
inlineconstexpr

◆ operator<()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename OtherT >
auto tatooine::tensor< ValueType, Dims >::operator< ( tensor< OtherT, Dims... > const &  other) const
inline

◆ operator=() [1/3]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<static_tensor OtherTensor>
requires (same_dimensions<this_type, OtherTensor>())
constexpr auto tatooine::tensor< ValueType, Dims >::operator= ( OtherTensor &&  other) -> tensor&
inlineconstexpr

◆ operator=() [2/3]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::operator= ( tensor< ValueType, Dims > &&  other) -> tensor &=default
constexprdefaultnoexcept

◆ operator=() [3/3]

template<arithmetic_or_complex ValueType, std::size_t... Dims>
constexpr auto tatooine::tensor< ValueType, Dims >::operator= ( tensor< ValueType, Dims > const &  ) -> tensor &=default
constexprdefault

◆ randn()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename RandEng = std::mt19937_64>
static constexpr auto tatooine::tensor< ValueType, Dims >::randn ( ValueType  mean = 0,
ValueType  stddev = 1,
RandEng &&  eng = RandEng{std::random_device{}()} 
)
inlinestaticconstexpr

◆ randu()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename RandEng = std::mt19937_64>
static constexpr auto tatooine::tensor< ValueType, Dims >::randu ( ValueType  min = 0,
ValueType  max = 1,
RandEng &&  eng = RandEng{std::random_device{}()} 
)
inlinestaticconstexpr

◆ rank()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static auto constexpr tatooine::base_tensor< Tensor, ValueType, Dims >::rank ( )
inlinestaticconstexpr

◆ unary_operation()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
template<typename F >
auto tatooine::tensor< ValueType, Dims >::unary_operation ( F &&  f) -> auto&
inline

◆ zeros()

template<arithmetic_or_complex ValueType, std::size_t... Dims>
static constexpr auto tatooine::tensor< ValueType, Dims >::zeros ( )
inlinestaticconstexpr

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