lin
Public Types | Public Member Functions | Protected Member Functions | List of all members
lin::internal::Stream< D > Class Template Reference

Tensor interface providing read only access to elements. More...

#include <lin/core/types/stream.hpp>

Inheritance diagram for lin::internal::Stream< D >:
lin::internal::ConstBase< D > lin::internal::Mapping< D > lin::internal::TensorStreamReference< D, E > lin::internal::ConstTensorView< D > lin::internal::Base< D > lin::internal::TensorMappingReference< D, E > lin::internal::Tensor< D > lin::internal::TensorView< D >

Public Types

typedef traits< D > Traits
 Traits information for this type. More...
 

Public Member Functions

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

Protected Member Functions

constexpr D & derived ()
 
constexpr D const & derived () const
 

Detailed Description

template<class D>
class lin::internal::Stream< D >

Tensor interface providing read only access to elements.

Template Parameters
DDerived type.

This is the first of the three main entry points on the lin inheritance tree and is therefore the parent class for all other tensor types.

All that is provided at this level is read only access to tensor elements and dimension information. It also adds the ability to force the evaluation of any tensor stream to a value backed object.

This class, and the entire inheritance tree, employs the curiosly recurring template patter (CRTP). As such, derived types are required to implement most of the methods listed in this class.

It's main purpose is to provide an interface the supports lazy evaluation.

See also
internal::Mapping
internal::Base

Member Typedef Documentation

template<class D>
typedef traits<D> lin::internal::Stream< D >::Traits

Traits information for this type.

See also
internal::traits

Member Function Documentation

template<class D>
constexpr D& lin::internal::Stream< D >::derived ( )
inlineprotected
Returns
Reference to the derived object.
template<class D>
constexpr D const& lin::internal::Stream< D >::derived ( ) const
inlineprotected
Returns
Constant reference to the derived object.
template<class D>
constexpr size_t lin::internal::Stream< D >::rows ( ) const
inline
Returns
Number of rows in the tensor.
template<class D>
constexpr size_t lin::internal::Stream< D >::cols ( ) const
inline
Returns
Number of columns in the tensor.
template<class D>
constexpr size_t lin::internal::Stream< D >::size ( ) const
inline
Returns
Number of elements in the tensor.

This is always the number of rows times the number of columns in the tensor.

template<class D>
constexpr Traits::elem_t lin::internal::Stream< D >::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.

If accessing data from a lazily evaluation tensor operation, you may want to consider for the creation of a value backed type to reduce overhead.

See also
internal::Stream::eval
template<class D>
constexpr Traits::elem_t lin::internal::Stream< D >::operator() ( size_t  i) const
inline

Provides read only access to tensor elements.

Parameters
iIndex.
Returns
Value of the tensor elements.

Element access proceeds as if all the elements of the tensor stream were flattened into an array in row major order.

If accessing data from a lazily evaluation tensor operation, you may want to consider for the creation of a value backed type to reduce overhead.

See also
internal::Stream::eval
template<class D>
constexpr Traits::elem_t lin::internal::Stream< D >::operator[] ( size_t  i) const
inline

Provides read only access to tensor elements.

Parameters
iIndex.
Returns
Value of the tensor elements.

Element access proceeds as if all the elements of the tensor stream were flattened into an array in row major order.

If accessing data from a lazily evaluation tensor operation, you may want to consider for the creation of a value backed type to reduce overhead.

See also
internal::Stream::eval
template<class D>
constexpr Traits::eval_t lin::internal::Stream< D >::eval ( ) const
inline

Forces evaluation of this stream to a value backed type.

Returns
Resulting value.

This is especially useful when working with a proxy to a lazily evaluated expression.

The return type is dependant on the evaluation type stored in its traits.

See also
internal::traits

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