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<(stdex::convertible_to<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<(stdex::convertible_to<I, IndexType> and ...) and
62 (
sizeof...(I) == NumIndices) and ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0x0),
int> = 0>
64 static void set(Arg& arg,
const scalar_type_of_t<Arg>& s, I...i)
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(); }
75 static constexpr data_layout layout = options & Eigen::RowMajor ? data_layout::right : data_layout::left;
Definition: basics.hpp:41
Definition: eigen-comma-initializers.hpp:20
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the coordinates::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:59
Trait object providing get and set routines for Eigen tensors.
Definition: eigen-tensor-forward-declarations.hpp:114
Definition: object_traits.hpp:38