16 #ifndef OPENKALMAN_EIGEN_TRAITS_TENSOR_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_TENSOR_HPP 22 template<
typename Scalar,
int NumIndices,
int options,
typename IndexType>
32 template<
typename Arg,
typename N>
42 #ifdef __cpp_lib_concepts 43 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == NumIndices)
45 template<
typename Arg,
typename...I, std::enable_if_t<(std::is_convertible_v<I, IndexType> and ...) and
46 (
sizeof...(I) == NumIndices),
int> = 0>
48 static constexpr decltype(
auto)
get(Arg&& arg, I...i)
50 if constexpr ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0)
51 return std::forward<Arg>(arg).coeffRef(static_cast<IndexType>(i)...);
53 return std::forward<Arg>(arg).coeff(static_cast<IndexType>(i)...);
57 #ifdef __cpp_lib_concepts 58 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == NumIndices) and
59 ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0x0)
61 template<
typename Arg,
typename...I, std::enable_if_t<(std::is_convertible_v<I, IndexType> and ...) and
62 (
sizeof...(I) == NumIndices) and ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0x0),
int> = 0>
66 arg.coeffRef(static_cast<IndexType>(i)...) = s;
69 static constexpr
bool is_writable =
true;
71 template<
typename Arg>
72 static constexpr
auto *
const 73 raw_data(Arg& arg) {
return arg.data(); }
81 #endif //OPENKALMAN_EIGEN_TRAITS_TENSOR_HPP Definition: indexible_object_traits.hpp:36
Definition: basics.hpp:41
Row-major storage (C or C++ style): contiguous storage in which the right-most index has a stride of ...
typename scalar_type_of< T >::type scalar_type_of_t
helper template for scalar_type_of.
Definition: scalar_type_of.hpp:54
Definition: eigen-comma-initializers.hpp:20
Trait object providing get and set routines for Eigen tensors.
Definition: eigen-tensor-forward-declarations.hpp:114
Column-major storage (Fortran, Matlab, or Eigen style): contiguous storage in which the left-most ext...
Layout
The layout format of a multidimensional array.
Definition: global-definitions.hpp:47
constexpr auto get_vector_space_descriptor(const T &t, const N &n)
Get the coordinates::pattern object for index N of indexible object T.
Definition: get_vector_space_descriptor.hpp:56