Expression Templates Library (ETL)
Public Types | Public Member Functions | Friends | List of all members
etl::memory_slice_view< T, Aligned > Struct Template Reference

View that shows a slice of an expression. More...

#include <memory_slice_view.hpp>

Public Types

using sub_type = T
 The sub type.
 
using value_type = value_t< sub_type >
 The value contained in the expression.
 
using memory_type = value_type *
 The memory acess type.
 
using const_memory_type = const value_type *
 The const memory access type.
 
using return_type = return_helper< sub_type, decltype(std::declval< sub_type >()[0])>
 The type returned by the view.
 
using const_return_type = const_return_helper< sub_type, decltype(std::declval< sub_type >()[0])>
 The const type return by the view.
 
template<typename V = default_vec>
using vec_type = typename V::template vec_type< value_type >
 The vectorization type for V.
 

Public Member Functions

 memory_slice_view (sub_type sub, size_t first, size_t last)
 Construct a new memory_slice_view over the given sub expression. More...
 
const_return_type operator[] (size_t j) const
 Returns the element at the given index. More...
 
return_type operator[] (size_t j)
 Returns the element at the given index. More...
 
value_type read_flat (size_t j) const noexcept
 Returns the value at the given index This function never has side effects. More...
 
template<typename V = default_vec>
auto load (size_t x) const noexcept
 Load several elements of the expression at once. More...
 
template<typename V = default_vec>
auto loadu (size_t x) const noexcept
 Load several elements of the expression at once. More...
 
template<typename V = default_vec>
void store (vec_type< V > in, size_t i) noexcept
 Store several elements in the matrix at once. More...
 
template<typename V = default_vec>
void storeu (vec_type< V > in, size_t i) noexcept
 Store several elements in the matrix at once. More...
 
template<typename V = default_vec>
void stream (vec_type< V > in, size_t i) noexcept
 Store several elements in the matrix at once, using non-temporal store. More...
 
template<typename E >
bool alias (const E &rhs) const noexcept
 Test if this expression aliases with the given expression. More...
 
memory_type memory_start () noexcept
 Returns a pointer to the first element in memory. More...
 
const_memory_type memory_start () const noexcept
 Returns a pointer to the first element in memory. More...
 
memory_type memory_end () noexcept
 Returns a pointer to the past-the-end element in memory. More...
 
const_memory_type memory_end () const noexcept
 Returns a pointer to the past-the-end element in memory. More...
 
template<typename L >
void assign_to (L &&lhs) const
 Assign to the given left-hand-side expression. More...
 
template<typename L >
void assign_add_to (L &&lhs) const
 Add to the given left-hand-side expression. More...
 
template<typename L >
void assign_sub_to (L &&lhs) const
 Sub from the given left-hand-side expression. More...
 
template<typename L >
void assign_mul_to (L &&lhs) const
 Multiply the given left-hand-side expression. More...
 
template<typename L >
void assign_div_to (L &&lhs) const
 Divide the given left-hand-side expression. More...
 
template<typename L >
void assign_mod_to (L &&lhs) const
 Modulo the given left-hand-side expression. More...
 
void visit (detail::evaluator_visitor &visitor) const
 Apply the given visitor to this expression and its descendants. More...
 
void ensure_cpu_up_to_date () const
 Ensures that the GPU memory is allocated and that the GPU memory is up to date (to undefined value).
 
void ensure_gpu_up_to_date () const
 Copy back from the GPU to the expression memory if necessary.
 

Friends

struct etl_traits< memory_slice_view >
 

Detailed Description

template<typename T, bool Aligned>
struct etl::memory_slice_view< T, Aligned >

View that shows a slice of an expression.

Template Parameters
TThe type of expression on which the view is made

Constructor & Destructor Documentation

◆ memory_slice_view()

template<typename T , bool Aligned>
etl::memory_slice_view< T, Aligned >::memory_slice_view ( sub_type  sub,
size_t  first,
size_t  last 
)
inline

Construct a new memory_slice_view over the given sub expression.

Parameters
subThe sub expression
firstThe first index
lastThe last index

Member Function Documentation

◆ alias()

template<typename T , bool Aligned>
template<typename E >
bool etl::memory_slice_view< T, Aligned >::alias ( const E &  rhs) const
inlinenoexcept

Test if this expression aliases with the given expression.

Parameters
rhsThe other expression to test
Returns
true if the two expressions aliases, false otherwise

◆ assign_add_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_add_to ( L &&  lhs) const
inline

Add to the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ assign_div_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_div_to ( L &&  lhs) const
inline

Divide the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ assign_mod_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_mod_to ( L &&  lhs) const
inline

Modulo the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ assign_mul_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_mul_to ( L &&  lhs) const
inline

Multiply the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ assign_sub_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_sub_to ( L &&  lhs) const
inline

Sub from the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ assign_to()

template<typename T , bool Aligned>
template<typename L >
void etl::memory_slice_view< T, Aligned >::assign_to ( L &&  lhs) const
inline

Assign to the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ load()

template<typename T , bool Aligned>
template<typename V = default_vec>
auto etl::memory_slice_view< T, Aligned >::load ( size_t  x) const
inlinenoexcept

Load several elements of the expression at once.

Parameters
xThe position at which to start.
Template Parameters
VThe vectorization mode to use
Returns
a vector containing several elements of the expression

◆ loadu()

template<typename T , bool Aligned>
template<typename V = default_vec>
auto etl::memory_slice_view< T, Aligned >::loadu ( size_t  x) const
inlinenoexcept

Load several elements of the expression at once.

Parameters
xThe position at which to start.
Template Parameters
VThe vectorization mode to use
Returns
a vector containing several elements of the expression

◆ memory_end() [1/2]

template<typename T , bool Aligned>
memory_type etl::memory_slice_view< T, Aligned >::memory_end ( )
inlinenoexcept

Returns a pointer to the past-the-end element in memory.

Returns
a pointer tot the past-the-end element in memory.

◆ memory_end() [2/2]

template<typename T , bool Aligned>
const_memory_type etl::memory_slice_view< T, Aligned >::memory_end ( ) const
inlinenoexcept

Returns a pointer to the past-the-end element in memory.

Returns
a pointer tot the past-the-end element in memory.

◆ memory_start() [1/2]

template<typename T , bool Aligned>
memory_type etl::memory_slice_view< T, Aligned >::memory_start ( )
inlinenoexcept

Returns a pointer to the first element in memory.

Returns
a pointer tot the first element in memory.

◆ memory_start() [2/2]

template<typename T , bool Aligned>
const_memory_type etl::memory_slice_view< T, Aligned >::memory_start ( ) const
inlinenoexcept

Returns a pointer to the first element in memory.

Returns
a pointer tot the first element in memory.

◆ operator[]() [1/2]

template<typename T , bool Aligned>
const_return_type etl::memory_slice_view< T, Aligned >::operator[] ( size_t  j) const
inline

Returns the element at the given index.

Parameters
jThe index
Returns
a reference to the element at the given index.

◆ operator[]() [2/2]

template<typename T , bool Aligned>
return_type etl::memory_slice_view< T, Aligned >::operator[] ( size_t  j)
inline

Returns the element at the given index.

Parameters
jThe index
Returns
a reference to the element at the given index.

◆ read_flat()

template<typename T , bool Aligned>
value_type etl::memory_slice_view< T, Aligned >::read_flat ( size_t  j) const
inlinenoexcept

Returns the value at the given index This function never has side effects.

Parameters
jThe index
Returns
the value at the given index.

◆ store()

template<typename T , bool Aligned>
template<typename V = default_vec>
void etl::memory_slice_view< T, Aligned >::store ( vec_type< V >  in,
size_t  i 
)
inlinenoexcept

Store several elements in the matrix at once.

Parameters
inThe several elements to store
iThe position at which to start. This will be aligned from the beginning (multiple of the vector size).
Template Parameters
VThe vectorization mode to use

◆ storeu()

template<typename T , bool Aligned>
template<typename V = default_vec>
void etl::memory_slice_view< T, Aligned >::storeu ( vec_type< V >  in,
size_t  i 
)
inlinenoexcept

Store several elements in the matrix at once.

Parameters
inThe several elements to store
iThe position at which to start. This will be aligned from the beginning (multiple of the vector size).
Template Parameters
VThe vectorization mode to use

◆ stream()

template<typename T , bool Aligned>
template<typename V = default_vec>
void etl::memory_slice_view< T, Aligned >::stream ( vec_type< V >  in,
size_t  i 
)
inlinenoexcept

Store several elements in the matrix at once, using non-temporal store.

Parameters
inThe several elements to store
iThe position at which to start. This will be aligned from the beginning (multiple of the vector size).
Template Parameters
VThe vectorization mode to use

◆ visit()

template<typename T , bool Aligned>
void etl::memory_slice_view< T, Aligned >::visit ( detail::evaluator_visitor visitor) const
inline

Apply the given visitor to this expression and its descendants.

Parameters
visitorThe visitor to apply

The documentation for this struct was generated from the following files: