16 #ifndef OPENKALMAN_EIGEN_TRAITS_TENSORFIXEDSIZE_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_TENSORFIXEDSIZE_HPP 22 template<
typename S,
typename Dims,
int options,
typename IndexType>
32 template<
typename Arg,
typename N>
35 if constexpr (values::fixed<N>)
38 return static_cast<std::size_t
>(arg.dimension(n));
48 #ifdef __cpp_lib_concepts 49 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == Dims::count)
51 template<
typename Arg,
typename...I, std::enable_if_t<(stdex::convertible_to<I, IndexType> and ...) and
52 (
sizeof...(I) == Dims::count),
int> = 0>
54 static constexpr decltype(
auto)
57 if constexpr ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0)
58 return std::forward<Arg>(arg).coeffRef(static_cast<IndexType>(i)...);
60 return std::forward<Arg>(arg).coeff(static_cast<IndexType>(i)...);
64 #ifdef __cpp_lib_concepts 65 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == Dims::count) and
66 ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0x0)
68 template<
typename Arg,
typename...I, std::enable_if_t<(std::is_convertible_v<I, IndexType> and ...) and
69 (
sizeof...(I) == Dims::count) and ((Eigen::internal::traits<std::decay_t<Arg>>::Flags & Eigen::LvalueBit) != 0x0),
int> = 0>
72 set(Arg& arg,
const scalar_type_of_t<Arg>& s, I...i)
74 arg.coeffRef(static_cast<IndexType>(i)...) = s;
78 static constexpr
bool is_writable =
true;
80 template<
typename Arg>
81 static constexpr
auto *
const 82 raw_data(Arg& arg) {
return arg.data(); }
84 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
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
Definition: object_traits.hpp:38