16 #ifndef OPENKALMAN_EIGEN_TRAITS_TENSORMAP_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_TENSORMAP_HPP 22 template<
typename PlainObjectType,
int Options,
template<
typename>
typename MakePointer>
28 using Xpr = Eigen::TensorMap<PlainObjectType, Options, MakePointer>;
30 using StorageRefType =
typename Xpr::StorageRefType;
31 using IndexType =
typename Xpr::Index;
35 template<
typename Arg,
typename N>
45 #ifdef __cpp_lib_concepts 46 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == PlainObjectType::NumDimensions)
48 template<
typename Arg,
typename...I, std::enable_if_t<(stdex::convertible_to<I, IndexType> and ...) and
49 (
sizeof...(I) == PlainObjectType::NumDimensions),
int> = 0>
51 static constexpr decltype(
auto)
get(Arg&& arg, I...i)
53 return std::forward<Arg>(arg)(static_cast<IndexType>(i)...);
57 #ifdef __cpp_lib_concepts 58 template<
typename Arg, std::convertible_to<IndexType>...I> requires (
sizeof...(I) == PlainObjectType::NumDimensions) and
59 std::is_lvalue_reference_v<StorageRefType> and (not std::is_const_v<std::remove_reference_t<StorageRefType>>)
61 template<
typename Arg,
typename...I, std::enable_if_t<(stdex::convertible_to<I, IndexType> and ...) and
63 not std::is_const<typename std::remove_reference<StorageRefType>::type>
::value,
int> = 0>
65 static void set(Arg& arg,
const scalar_type_of_t<Arg>& s, I...i)
67 arg(static_cast<IndexType>(i)...) = s;
70 static constexpr
bool is_writable =
false;
72 template<
typename Arg>
73 static constexpr
auto *
const 74 raw_data(Arg& arg) {
return arg.data(); }
76 static constexpr data_layout layout = layout_of_v<PlainObjectType>;
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