Expression Templates Library (ETL)
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
etl::magic_view< V > Struct Template Reference

A view (virtual) of a dynamic magic matrix. More...

#include <virtual_views.hpp>

Public Types

using value_type = V
 The value type in the matrix.
 

Public Member Functions

 magic_view (size_t n)
 Construct a new magic_view with the given dimension.
 
value_type operator[] (size_t i)
 Returns the element at the given index. More...
 
value_type operator[] (size_t i) const
 Returns the element at the given index. More...
 
value_type read_flat (size_t i) const
 Returns the value at the given index This function never has side effects. More...
 
value_type operator() (size_t i, size_t j)
 Access to the value at the given (i, j) position. More...
 
value_type operator() (size_t i, size_t j) const
 Access to the value at the given (i, j) position. More...
 
template<typename E >
constexpr bool alias (const E &rhs) const noexcept
 Test if this expression aliases with the given expression. More...
 
template<typename Visitor >
void visit ([[maybe_unused]] 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.
 

Public Attributes

const size_t n
 The dimensions of the magic matrix.
 

Static Public Attributes

static constexpr bool gpu_computable = false
 

Detailed Description

template<typename V>
struct etl::magic_view< V >

A view (virtual) of a dynamic magic matrix.

Member Function Documentation

◆ alias()

template<typename V >
template<typename E >
constexpr bool etl::magic_view< V >::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

◆ operator()() [1/2]

template<typename V >
value_type etl::magic_view< V >::operator() ( size_t  i,
size_t  j 
)
inline

Access to the value at the given (i, j) position.

Parameters
iThe first index
jThe second index
Returns
The value at the position (i, j)

◆ operator()() [2/2]

template<typename V >
value_type etl::magic_view< V >::operator() ( size_t  i,
size_t  j 
) const
inline

Access to the value at the given (i, j) position.

Parameters
iThe first index
jThe second index
Returns
The value at the position (i, j)

◆ operator[]() [1/2]

template<typename V >
value_type etl::magic_view< V >::operator[] ( size_t  i)
inline

Returns the element at the given index.

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

◆ operator[]() [2/2]

template<typename V >
value_type etl::magic_view< V >::operator[] ( size_t  i) const
inline

Returns the element at the given index.

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

◆ read_flat()

template<typename V >
value_type etl::magic_view< V >::read_flat ( size_t  i) const
inline

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

Parameters
iThe index
Returns
the value at the given index.

◆ visit()

template<typename V >
template<typename Visitor >
void etl::magic_view< V >::visit ( [[maybe_unused] ] 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 file: