lin
|
Tensor stream where all elements are zeros expects the elements on on the diagonal specified by an underlying stream. More...
#include <lin/generators/stream_diagonal.hpp>
Public Types | |
typedef traits< StreamDiagonal< E > > | Traits |
Traits information for this type. More... | |
![]() | |
typedef traits< StreamDiagonal< E > > | Traits |
Traits information for this type. More... | |
Public Member Functions | |
constexpr | StreamDiagonal (StreamDiagonal< E > const &)=default |
constexpr | StreamDiagonal (StreamDiagonal< E > &&)=default |
constexpr StreamDiagonal< E > & | operator= (StreamDiagonal< E > const &)=default |
constexpr StreamDiagonal< E > & | operator= (StreamDiagonal< E > &&)=default |
constexpr | StreamDiagonal (Stream< E > const &stream) |
Constructs a new diagonal stream from the provided vector 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< StreamDiagonal< E > > const &)=default |
constexpr | Stream (Stream< StreamDiagonal< E > > &&)=default |
constexpr Stream< StreamDiagonal< E > > & | operator= (Stream< StreamDiagonal< E > > const &)=default |
constexpr Stream< StreamDiagonal< E > > & | operator= (Stream< StreamDiagonal< 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 StreamDiagonal< E > & | derived () |
constexpr StreamDiagonal< E >const & | derived () const |
Tensor stream where all elements are zeros expects the elements on on the diagonal specified by an underlying stream.
E | Underlying vector stream. |
This allows a user to sparesly define a square matrix stream where all elements evaluate to zero except for the those along the diagonal, which are specified by the elements of an underlying vector.
Note the if the underlying vector goes out of scope the diagonal stream is invalidated.
typedef traits<StreamDiagonal<E> > lin::internal::StreamDiagonal< E >::Traits |
Traits information for this type.
|
inline |
Constructs a new diagonal stream from the provided vector stream.
stream | Underlying vector stream |
The provided vector streams length will determine the runtime dimensions of the diagonal stream.
Changes in element values and dimensions of the underlying vector stream will be reflected in the stream itself. The underlying stream must be in scope for the stream to be valid.
|
inline |
Equals the size of the underlying vector.
|
inline |
Equals the size of the underlying vector.
|
inline |
Provides read only access to tensor elements.
i | Row index. |
j | Column index. |
Zero if off the main diagonal and specified by the underlying vector stream otherwise.
If the indices are out of bounds as defined by the stream'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.
Zero if off the main diagonal and specified by the underlying vector stream otherwise.
If the index is out of bounds as defined by the stream's current size, lin assertion errors will be triggered.