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