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<(std::is_convertible_v<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<(std::is_convertible_v<I, IndexType> and ...) and
63 not std::is_const<typename std::remove_reference<StorageRefType>::type>
::value,
int> = 0>
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
Layout layout = layout_of_v<PlainObjectType>;
82 #endif //OPENKALMAN_EIGEN_TRAITS_TENSORMAP_HPP Definition: indexible_object_traits.hpp:36
Definition: basics.hpp:41
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
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
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