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

Member pointer backed constant tensor. More...

#include <lin/views/const_tensor_view.hpp>

Inheritance diagram for lin::internal::ConstTensorView< D >:
lin::internal::ConstBase< D > lin::internal::Stream< D > lin::internal::Dimensions< D >

Public Types

typedef traits< D > Traits
 Traits information for this type. More...
 
- Public Types inherited from lin::internal::ConstBase< D >
typedef traits< D > Traits
 Traits information for this type. More...
 
- Public Types inherited from lin::internal::Stream< D >
typedef traits< D > Traits
 Traits information for this type. More...
 

Public Member Functions

constexpr ConstTensorView (ConstTensorView< D > const &)=default
 
constexpr ConstTensorView (ConstTensorView< D > &&)=default
 
constexpr ConstTensorView< D > & operator= (ConstTensorView< D > const &)=default
 
constexpr ConstTensorView< D > & operator= (ConstTensorView< D > &&)=default
 
constexpr ConstTensorView (typename Traits::elem_t const *elems)
 Constructs a new constant tensor tensor view with the provided backing array. More...
 
constexpr ConstTensorView (typename Traits::elem_t const *elems, size_t r, size_t c)
 Constructs a new constant tensor tensor view with the provided backing array and requested dimensions. More...
 
constexpr Traits::elem_t const * data () const
 Retrives a constant pointer to the element backing array. More...
 
- Public Member Functions inherited from lin::internal::ConstBase< D >
constexpr ConstBase (ConstBase< D > const &)=default
 
constexpr ConstBase (ConstBase< D > &&)=default
 
constexpr ConstBase< D > & operator= (ConstBase< D > const &)=default
 
constexpr ConstBase< D > & operator= (ConstBase< D > &&)=default
 
constexpr Traits::elem_t const * data () const
 Retrives a constant pointer to the element backing array. More...
 
constexpr Traits::elem_t const & operator() (size_t i, size_t j) const
 Provides read only access to tensor elements. More...
 
constexpr Traits::elem_t const & operator() (size_t i)
 Provides read only access to tensor elements. More...
 
- Public Member Functions inherited from lin::internal::Stream< D >
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...
 
- Public Member Functions inherited from lin::internal::Dimensions< D >
constexpr Dimensions (Dimensions< D > const &)=default
 
constexpr Dimensions (Dimensions< D > &&)=default
 
constexpr Dimensions< D > & operator= (Dimensions< D > const &)=default
 
constexpr Dimensions< D > & operator= (Dimensions< D > &&)=default
 
constexpr size_t rows () const
 
constexpr size_t cols () const
 
constexpr void resize (size_t r, size_t c)
 Resizes a tensor's dimensions. More...
 

Private Attributes

Traits::elem_t const *const elems
 

Additional Inherited Members

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

Detailed Description

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

Member pointer backed constant tensor.

Template Parameters
DDerived type.

This allows users to interpret arbitrary buffers as tensor objects. The user specified buffer is assumed to be at least as large as the tensor's maximum size and elements are read and written to the buffer in row major order.

See also
internal::ConstBase
internal::ConstMatrixView
internal::ConstRowVectorView
internal::ConstVectorView

Member Typedef Documentation

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

Traits information for this type.

See also
internal::traits

Constructor & Destructor Documentation

template<class D>
constexpr lin::internal::ConstTensorView< D >::ConstTensorView ( typename Traits::elem_t const *  elems)
inline

Constructs a new constant tensor tensor view with the provided backing array.

Parameters
elemsConstant element backing array.

The element backing array is a assumed to be in row major order. Elements of the tensor initially hold whatever values were left in the backing array.

The backing array should be at least as large as the maximum size of the tensor (see internal::traits information).

The size of the tensor defaults to the maximum allowed size.

template<class D>
constexpr lin::internal::ConstTensorView< D >::ConstTensorView ( typename Traits::elem_t const *  elems,
size_t  r,
size_t  c 
)
inline

Constructs a new constant tensor tensor view with the provided backing array and requested dimensions.

Parameters
elemsConstant element backing array.
rInitial row dimension.
cInitial column dimension.

The element backing array is a assumed to be in row major order. Elements of the tensor initially hold whatever values were left in the backing array.

The backing array should be at least as large as the maximum size of the tensor (see internal::traits information).

Lin assertions errors will be triggered if the requested dimensions aren't possible given the tensor's traits.

See also
internal::traits

Member Function Documentation

template<class D>
constexpr Traits::elem_t const* lin::internal::ConstTensorView< D >::data ( ) const
inline

Retrives a constant pointer to the element backing array.

Returns
Constant pointer to the backing array.

This is the same buffer the tensor view was constructed with.


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