lin
|
Generic tensor reference with read and write access. More...
#include <lin/references/tensor_mapping_reference.hpp>
Public Types | |
typedef traits< D > | Traits |
Traits information for this type. More... | |
![]() | |
typedef traits< D > | Traits |
Traits information for this type. More... | |
![]() | |
typedef traits< D > | Traits |
Traits information for this type. More... | |
Public Member Functions | |
constexpr | TensorMappingReference (TensorMappingReference< D, E > const &)=default |
constexpr | TensorMappingReference (TensorMappingReference< D, E > &&)=default |
constexpr TensorMappingReference< D, E > & | operator= (TensorMappingReference< D, E > const &)=default |
constexpr TensorMappingReference< D, E > & | operator= (TensorMappingReference< D, E > &&)=default |
constexpr | TensorMappingReference (Mapping< E > &mapping, size_t i, size_t j) |
Constructs a new reference with the provided mapping and anchor point. More... | |
constexpr | TensorMappingReference (Mapping< E > &mapping, size_t i, size_t j, size_t r, size_t c) |
Constructs a new reference with the provided mapping, anchor point, and dimensions. More... | |
constexpr Traits::elem_t & | operator() (size_t i, size_t j) |
Provides read and write access to tensor elements. More... | |
constexpr Traits::elem_t & | operator() (size_t i) |
Provides read and write access to tensor elements. More... | |
![]() | |
constexpr | Mapping (Mapping< D > const &)=default |
constexpr | Mapping (Mapping< D > &&)=default |
constexpr Mapping< D > & | operator= (Mapping< D > const &)=default |
constexpr Mapping< D > & | operator= (Mapping< D > &&)=default |
constexpr Traits::elem_t & | operator() (size_t i, size_t j) |
Provides read and write access to tensor elements. More... | |
constexpr Traits::elem_t | operator() (size_t i, size_t j) const |
Provides read only access to tensor elements. More... | |
constexpr Traits::elem_t & | operator() (size_t i) |
Provides read and write access to tensor elements. More... | |
constexpr Traits::elem_t | operator() (size_t i) const |
Provides read only access to tensor elements. More... | |
constexpr Traits::elem_t & | operator[] (size_t i) |
Provides read and write access to tensor elements. More... | |
constexpr Traits::elem_t | operator[] (size_t i) const |
Provides read only access to tensor elements. More... | |
template<typename T , std::enable_if_t< is_detected< assign_expr, typename Traits::elem_t, T >::value, size_t > = 0> | |
constexpr D & | operator= (std::initializer_list< T > const &list) |
Copy an initializer list's elements into the tensor's elements. More... | |
template<class C , std::enable_if_t< conjunction< have_same_dimensions< D, C >, is_detected< assign_expr, typename Traits::elem_t, traits_elem_t< C >> >::value, size_t > = 0> | |
constexpr D & | operator= (Stream< C > const &s) |
Copy another tensor's elements into this tenosr's elements. More... | |
![]() | |
constexpr | Stream (Stream< D > const &)=default |
constexpr | Stream (Stream< D > &&)=default |
constexpr Stream< D > & | operator= (Stream< D > const &)=default |
constexpr Stream< D > & | operator= (Stream< D > &&)=default |
constexpr size_t | rows () const |
constexpr size_t | cols () const |
constexpr size_t | size () const |
constexpr Traits::elem_t | operator() (size_t i, size_t j) const |
Provides read only access to tensor elements. More... | |
constexpr Traits::elem_t | operator() (size_t i) const |
Provides read only access to tensor elements. More... | |
constexpr Traits::elem_t | operator[] (size_t i) const |
Provides read only access to tensor elements. More... | |
constexpr Traits::eval_t | eval () const |
Forces evaluation of this stream to a value backed type. More... | |
![]() | |
constexpr | Dimensions (Dimensions< D > const &)=default |
constexpr | Dimensions (Dimensions< D > &&)=default |
constexpr Dimensions< D > & | operator= (Dimensions< D > const &)=default |
constexpr Dimensions< D > & | operator= (Dimensions< D > &&)=default |
constexpr size_t | rows () const |
constexpr size_t | cols () const |
constexpr void | resize (size_t r, size_t c) |
Resizes a tensor's dimensions. More... | |
Private Attributes | |
Mapping< E > & | _mapping |
size_t const | _i |
size_t const | _j |
Additional Inherited Members | |
![]() | |
constexpr D & | derived () |
constexpr D const & | derived () const |
Generic tensor reference with read and write access.
D | Derived type. |
E | Underlying referenced type. |
This allows users to interpret a portion of a larger internal::Mapping as an independent tensor type with user specified traits. A common use may be to treat block diagonal elements of a larger matrix independently or perform vector operations on the columns of a matrix.
It's important to note, if the underlying mapping goes out of scope the reference is invalidated.
typedef traits<D> lin::internal::TensorMappingReference< D, E >::Traits |
Traits information for this type.
|
inline |
Constructs a new reference with the provided mapping and anchor point.
mapping | Underlying mapping. |
i | Anchor point row index. |
j | Anchor point column index. |
The reference's dimensions are defaulted to the largest allowable size and the anchor point maps the tops left corner of the reference to an element in the underlying mapping.
The reference traits must define a type that fits within the provided mapping given the anchor point. If this is not the case, lin assertion errors will be triggered.
The anchor points specifies where the top left corner of the reference maps to in the underlying mapping.
|
inline |
Constructs a new reference with the provided mapping, anchor point, and dimensions.
mapping | Underlying mapping. |
i | Anchor point row index. |
j | Anchor point column index. |
r | Reference row dimension. |
c | Reference column dimension. |
The anchor point maps the tops left corner of the reference to an element in the underlying mapping.
The reference traits must define a type that fits within the provided mapping given the anchor point. If this is not the case, lin assertion errors will be triggered.
The anchor points specifies where the top left corner of the reference maps to in the underlying mapping.
Lin assertions errors will be triggered if the requested dimensions aren't possible given the reference's traits.
|
inline |
Provides read and write access to tensor elements.
i | Row index. |
j | Column index. |
If the indices are out of bounds as defined by the reference's current dimensions, lin assertion errors will be triggered.
|
inline |
Provides read and write access to tensor elements.
i | Index. |
Element access proceeds as if all the elements of the tensor stream were flattened into an array in row major order.
If the index is out of bounds as defined by the tensor's current size, lin assertion errors will be triggered.