lin
Public Types | Public Member Functions | Private Attributes | List of all members
lin::internal::DiagonalStreamReference< E > Class Template Reference

Generic diagonal reference with read only access. More...

#include <lin/references/diagonal_stream_reference.hpp>

Inheritance diagram for lin::internal::DiagonalStreamReference< E >:
lin::internal::Stream< DiagonalStreamReference< E > >

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...
 
- Public Types inherited from lin::internal::Stream< DiagonalStreamReference< E > >
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...
 
- Public Member Functions inherited from lin::internal::Stream< DiagonalStreamReference< E > >
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

- Protected Member Functions inherited from lin::internal::Stream< DiagonalStreamReference< E > >
constexpr DiagonalStreamReference< E > & derived ()
 
constexpr DiagonalStreamReference< E >const & derived () const
 

Detailed Description

template<class E>
class lin::internal::DiagonalStreamReference< E >

Generic diagonal reference with read only access.

Template Parameters
EUnderlying 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.

See also
internal::DiagonalMappingReference
internal::is_matrix
internal::is_square

Member Typedef Documentation

Traits information for this type.

See also
internal::traits

Vector traits information for this type.

See also
internal::vector_traits

Constructor & Destructor Documentation

template<class E >
constexpr lin::internal::DiagonalStreamReference< E >::DiagonalStreamReference ( Stream< E > const &  stream)
inline

Constructs a new diagonal reference with the provided stream.

Parameters
streamUnderlying 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.

Member Function Documentation

template<class E >
constexpr size_t lin::internal::DiagonalStreamReference< E >::rows ( ) const
inline
Returns
Number of rows.

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.

template<class E >
constexpr size_t lin::internal::DiagonalStreamReference< E >::cols ( ) const
inline
Returns
Number of columns.

This always returns one.

template<class E >
constexpr Traits::elem_t lin::internal::DiagonalStreamReference< E >::operator() ( size_t  i,
size_t  j 
) const
inline

Provides read only access to tensor elements.

Parameters
iRow index.
jColumn index.
Returns
Value of the tensor element.

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.

template<class E >
constexpr Traits::elem_t lin::internal::DiagonalStreamReference< E >::operator() ( size_t  i) const
inline

Provides read only access to tensor elements.

Parameters
iIndex.
Returns
Value of the tensor element.

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.


The documentation for this class was generated from the following file: