95 #ifndef LIN_REFERENCES_HPP_ 96 #define LIN_REFERENCES_HPP_ 106 #include <type_traits> 123 template <
class C,
class D,
typename =
void>
126 template <
class C,
class D>
129 template <
class C,
class D>
131 is_matrix<C>, have_same_elements<C, D>>::value>> {
135 template <
class C,
class D>
137 is_col_vector<C>, have_same_elements<C, D>>::value>> {
141 template <
class C,
class D>
143 is_row_vector<C>, have_same_elements<C, D>>::value>> {
159 template <
class C,
class D,
typename =
void>
162 template <
class C,
class D>
165 template <
class C,
class D>
167 is_matrix<C>, have_same_elements<C, D>>::value>> {
171 template <
class C,
class D>
173 is_col_vector<C>, have_same_elements<C, D>>::value>> {
177 template <
class C,
class D>
179 is_row_vector<C>, have_same_elements<C, D>>::value>> {
205 template <
class C,
class D,
typename =
206 std::enable_if_t<internal::has_traits<C>::value>>
208 return internal::mapping_reference_t<C, D>(mapping, i, j);
240 return internal::mapping_reference_t<C, D>(mapping, i, j, n);
271 template <
class C,
class D,
typename =
272 std::enable_if_t<internal::has_traits<C>::value>>
274 return internal::mapping_reference_t<C, D>(mapping, i, j, r, c);
300 typedef typename D::Traits::elem_t Elem;
301 constexpr
size_t Rows = D::Traits::rows;
302 constexpr
size_t MaxRows = D::Traits::max_rows;
305 return ref<T>(mapping, 0, j, mapping.
rows(), 1);
331 typedef typename D::Traits::elem_t Elem;
332 constexpr
size_t Cols = D::Traits::cols;
333 constexpr
size_t MaxCols = D::Traits::max_cols;
336 return ref<T>(mapping, i, 0, 1, mapping.
cols());
384 template <
class C,
class D,
typename =
385 std::enable_if_t<internal::has_traits<C>::value>>
387 return internal::stream_reference_t<C, D>(stream, i, j);
419 return internal::stream_reference_t<C, D>(stream, i, j, n);
450 template <
class C,
class D,
typename =
451 std::enable_if_t<internal::has_traits<C>::value>>
453 return internal::stream_reference_t<C, D>(stream, i, j, r, c);
479 typedef typename D::Traits::elem_t Elem;
480 constexpr
size_t Rows = D::Traits::rows;
481 constexpr
size_t MaxRows = D::Traits::max_rows;
484 return ref<T>(stream, 0, j, stream.
rows(), 1);
510 typedef typename D::Traits::elem_t Elem;
511 constexpr
size_t Cols = D::Traits::cols;
512 constexpr
size_t MaxCols = D::Traits::max_cols;
515 return ref<T>(stream, i, 0, 1, stream.
cols());
constexpr auto col(internal::Stream< D > const &stream, size_t j)
Creates a stream reference of a particular column of a given tensor.
Definition: references.hpp:478
Tensor interface providing read only access to elements.
Definition: stream.hpp:43
Generic vector reference with read only access.
Definition: vector_stream_reference.hpp:35
Tensor interface providing read and write access to elements.
Definition: mapping.hpp:39
Generic vector.
Definition: vector.hpp:33
constexpr auto diag(internal::Stream< D > const &stream)
Creates a diagonal stream reference from the given stream.
Definition: references.hpp:538
Generic matrix.
Definition: matrix.hpp:35
Generic matrix reference with read and write access.
Definition: matrix_mapping_reference.hpp:37
Generic row vector reference with read only access.
Definition: vector_stream_reference.hpp:130
Generic row vector reference with read and write access.
Definition: vector_mapping_reference.hpp:130
Generic row vector.
Definition: vector.hpp:131
Tests if a tensor type is a matrix.
Definition: matrix.hpp:27
Tests if a tensor type is "square".
Definition: tensor.hpp:389
constexpr size_t rows() const
Definition: stream.hpp:76
Logical AND operation for template metaprogramming.
Definition: utilities.hpp:54
Tests if a tensor type is a vector.
Definition: vector.hpp:73
constexpr size_t cols() const
Definition: stream.hpp:82
constexpr auto ref(internal::Stream< D > const &stream, size_t i, size_t j, size_t r, size_t c)
Creates a stream reference with the provided dimensions.
Definition: references.hpp:452
Generic matrix reference with read-only access.
Definition: matrix_stream_reference.hpp:37
Definition: references.hpp:160
constexpr auto row(internal::Stream< D > const &stream, size_t i)
Creates a stream reference of a particular row of a given tensor.
Definition: references.hpp:509
Definition: config.hpp:27
Generic diagonal reference with read and write access.
Definition: diagonal_mapping_reference.hpp:30
Definition: references.hpp:124
Generic diagonal reference with read only access.
Definition: diagonal_stream_reference.hpp:30
Generic vector reference with read and write access.
Definition: vector_mapping_reference.hpp:35
Tests if a type has traits.
Definition: tensor.hpp:158