77 #ifndef LIN_VIEWS_HPP_ 78 #define LIN_VIEWS_HPP_ 86 #include <type_traits> 101 template <
class C,
typename =
void>
108 struct view<C, std::enable_if_t<is_matrix<C>::value>> {
113 struct view<C, std::enable_if_t<is_col_vector<C>::value>> {
118 struct view<C, std::enable_if_t<is_row_vector<C>::value>> {
132 template <
class C,
typename =
void>
139 struct const_view<C, std::enable_if_t<is_matrix<C>::value>> {
144 struct const_view<C, std::enable_if_t<is_col_vector<C>::value>> {
149 struct const_view<C, std::enable_if_t<is_row_vector<C>::value>> {
171 template <class C, typename = std::enable_if_t<internal::has_traits<C>::value>>
172 constexpr
auto view(
typename C::Traits::elem_t *elems) {
173 return internal::view_t<C>(elems);
195 constexpr
auto view(
typename C::Traits::elem_t *elems,
size_t n) {
196 return internal::view_t<C>(elems, n);
218 template <class C, typename = std::enable_if_t<internal::has_traits<C>::value>>
219 constexpr
auto view(
typename C::Traits::elem_t *elems,
size_t r,
size_t c) {
220 return internal::view_t<C>(elems, r, c);
240 template <class C, typename = std::enable_if_t<internal::has_traits<C>::value>>
241 constexpr
auto view(
typename C::Traits::elem_t
const *elems) {
242 return internal::const_view_t<C>(elems);
264 constexpr
auto view(
typename C::Traits::elem_t
const *elems,
size_t n) {
265 return internal::const_view_t<C>(elems, n);
287 template <class C, typename = std::enable_if_t<internal::has_traits<C>::value>>
288 constexpr
auto view(
typename C::Traits::elem_t
const *elems,
size_t r,
size_t c) {
289 return internal::const_view_t<C>(elems, r, c);
Generic vector view.
Definition: vector_view.hpp:31
constexpr auto view(typename C::Traits::elem_t const *elems, size_t r, size_t c)
Creates a constant tensor view with the provided dimensions.
Definition: views.hpp:288
Generic matrix view.
Definition: matrix_view.hpp:34
Definition: views.hpp:102
Generic constant row vector view.
Definition: const_vector_view.hpp:115
Generic row vector view.
Definition: vector_view.hpp:116
Logical AND operation for template metaprogramming.
Definition: utilities.hpp:54
Tests if a tensor type is a vector.
Definition: vector.hpp:73
Definition: config.hpp:27
Generic constant vector view.
Definition: const_vector_view.hpp:31
Definition: views.hpp:133
Tests if a type has traits.
Definition: tensor.hpp:158
Generic constant matrix view.
Definition: const_matrix_view.hpp:33