lin
|
Generic diagonal reference with read and write access. More...
#include <lin/references/diagonal_mapping_reference.hpp>
Public Types | |
typedef traits< DiagonalMappingReference< E > > | Traits |
Traits information for this type. More... | |
typedef vector_traits< DiagonalMappingReference< E > > | VectorTraits |
Vector traits information for this type. More... | |
![]() | |
typedef traits< DiagonalMappingReference< E > > | Traits |
Traits information for this type. More... | |
![]() | |
typedef traits< DiagonalMappingReference< E > > | Traits |
Traits information for this type. More... | |
Public Member Functions | |
constexpr | DiagonalMappingReference (DiagonalMappingReference< E > const &)=default |
constexpr | DiagonalMappingReference (DiagonalMappingReference< E > &&)=default |
constexpr DiagonalMappingReference< E > & | operator= (DiagonalMappingReference< E > const &)=default |
constexpr DiagonalMappingReference< E > & | operator= (DiagonalMappingReference< E > &&)=default |
constexpr | DiagonalMappingReference (Mapping< E > &mapping) |
Constructs a new diagonal reference with the provided mapping. More... | |
constexpr size_t | rows () const |
constexpr size_t | cols () const |
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< DiagonalMappingReference< E > > const &)=default |
constexpr | Mapping (Mapping< DiagonalMappingReference< E > > &&)=default |
constexpr Mapping< DiagonalMappingReference< E > > & | operator= (Mapping< DiagonalMappingReference< E > > const &)=default |
constexpr Mapping< DiagonalMappingReference< E > > & | operator= (Mapping< DiagonalMappingReference< E > > &&)=default |
constexpr DiagonalMappingReference< E > & | operator= (std::initializer_list< T > const &list) |
Copy an initializer list's elements into the tensor's elements. More... | |
constexpr DiagonalMappingReference< E > & | operator= (Stream< C > const &s) |
Copy another tensor's elements into this tenosr's elements. 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, 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... | |
![]() | |
constexpr | Stream (Stream< DiagonalMappingReference< E > > const &)=default |
constexpr | Stream (Stream< DiagonalMappingReference< E > > &&)=default |
constexpr Stream< DiagonalMappingReference< E > > & | operator= (Stream< DiagonalMappingReference< E > > const &)=default |
constexpr Stream< DiagonalMappingReference< E > > & | operator= (Stream< DiagonalMappingReference< E > > &&)=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... | |
Private Attributes | |
Mapping< E > & | _mapping |
Additional Inherited Members | |
![]() | |
constexpr DiagonalMappingReference< E > & | derived () |
constexpr DiagonalMappingReference< E >const & | derived () const |
Generic diagonal reference with read and write access.
E | Underlying referenced type. |
This allows users to treat the diagonal elements of a mapping as a column vector. The underlying mapping must have traits making is a square matrix.
It's important to note, if the underlying mapping goes out of scope the reference is invalidated.
typedef traits<DiagonalMappingReference<E> > lin::internal::DiagonalMappingReference< E >::Traits |
Traits information for this type.
typedef vector_traits<DiagonalMappingReference<E> > lin::internal::DiagonalMappingReference< E >::VectorTraits |
Vector traits information for this type.
|
inline |
Constructs a new diagonal reference with the provided mapping.
mapping | Underlying mapping. |
The provided mapping must be square at runtime or lin assertion errors will be triggered.
Resizing the mapping to be something other than square after construction invalidates the reference.
|
inline |
This value is determined based on the size of the underlying mapping. If the mapping is resized, the returned row count may changed. If the resized mapping is no longer square, the diagonal reference is invalidated.
|
inline |
This always returns one.
|
inline |
Provides read and write access to tensor elements.
i | Row index. |
j | Column index. |
The diagonal of the underlying stream is exposed as a column vector.
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 reference's current size, lin assertion errors will be triggered.