Expression Templates Library (ETL)
Public Types | Public Member Functions | Friends | List of all members
etl::unary_expr< T, Expr, UnaryOp > Struct Template Referencefinal

An unary expression. More...

#include <unary_expr.hpp>

Inheritance diagram for etl::unary_expr< T, Expr, UnaryOp >:
Inheritance graph
[legend]
Collaboration diagram for etl::unary_expr< T, Expr, UnaryOp >:
Collaboration graph
[legend]

Public Types

using value_type = T
 The value type.
 
using memory_type = void
 The memory type.
 
using const_memory_type = void
 The const memory type.
 
using expr_t = Expr
 The sub expression type.
 
using iterator = etl::iterator< this_type >
 The iterator type.
 
using const_iterator = etl::iterator< const this_type >
 The const iterator type.
 
template<typename V = default_vec>
using vec_type = typename V::template vec_type< T >
 
- Public Types inherited from etl::value_testable< unary_expr< T, Expr, UnaryOp > >
using derived_t = unary_expr< T, Expr, UnaryOp >
 The derived type.
 
- Public Types inherited from etl::dim_testable< unary_expr< T, Expr, UnaryOp > >
using derived_t = unary_expr< T, Expr, UnaryOp >
 The derived type.
 
- Public Types inherited from etl::iterable< unary_expr< T, Expr, UnaryOp > >
using derived_t = unary_expr< T, Expr, UnaryOp >
 The derived type.
 

Public Member Functions

 unary_expr (Expr l)
 Construct a new unary_expr with the given sub expression. More...
 
 unary_expr (const unary_expr &rhs)=default
 
 unary_expr (unary_expr &&rhs) noexcept=default
 
unary_exproperator= (const unary_expr &rhs)=delete
 
unary_exproperator= (unary_expr &&rhs)=delete
 
value_type operator[] (size_t i) const
 Returns the element at the given index. More...
 
value_type read_flat (size_t i) const noexcept
 Returns the value at the given index This function never alters the state of the container. More...
 
template<typename V = default_vec>
vec_type< V > load (size_t i) const
 Load several elements of the matrix at once. More...
 
template<typename V = default_vec>
vec_type< V > loadu (size_t i) const
 Load several elements of the matrix at once. More...
 
template<size_c... S>
value_type operator() (S... args) const
 Returns the value at the position (args...) More...
 
template<typename E >
bool alias (const E &rhs) const noexcept
 Test if this expression aliases with the given expression. More...
 
template<typename Y >
decltype(auto) gpu_compute_hint (Y &y) const
 Return a GPU computed version of this expression. More...
 
template<typename Y >
decltype(auto) gpu_compute (Y &y) const
 Return a GPU computed version of this expression. 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.
 
- Public Member Functions inherited from etl::value_testable< unary_expr< T, Expr, UnaryOp > >
derived_tas_derived () noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
const derived_tas_derived () const noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
bool is_finite () const noexcept
 Indicates if the expression contains only finite values. More...
 
bool is_zero () const noexcept
 Indicates if the expression contains only zero values. More...
 
bool is_diagonal () const noexcept
 Indicates if the expression is diagonal. More...
 
bool is_uniform () const noexcept
 Indicates if the expression is uniform, i.e. all elements are of the same value. More...
 
- Public Member Functions inherited from etl::dim_testable< unary_expr< T, Expr, UnaryOp > >
derived_tas_derived () noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
const derived_tas_derived () const noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
bool is_square () const noexcept
 Indicates if the expressions is of square dimensions (only for 2d expression) More...
 
bool is_rectangular () const noexcept
 Indicates if the expressions is of rectangular dimensions (only for 2d expression) More...
 
bool is_sub_square () const noexcept
 Indicates if the expressions is of square dimensions, ignoring the first dimension (only for 3d expression) More...
 
bool is_sub_rectangular () const noexcept
 Indicates if the expressions is of rectangular dimensions, ignoring the first dimension (only for 3d expression) More...
 
bool is_symmetric () const noexcept
 Indicates if the given expression is a symmetric matrix or not. More...
 
bool is_lower_triangular () const noexcept
 Indicates if the given expression is a lower triangular matrix or not. More...
 
bool is_uni_lower_triangular () const noexcept
 Indicates if the given expression is a uni lower triangular matrix or not. More...
 
bool is_strictly_lower_triangular () const noexcept
 Indicates if the given expression is a strictly lower triangular matrix or not. More...
 
bool is_upper_triangular () const noexcept
 Indicates if the given expression is a upper triangular matrix or not. More...
 
bool is_uni_upper_triangular () const noexcept
 Indicates if the given expression is a uni upper triangular matrix or not. More...
 
bool is_strictly_upper_triangular () const noexcept
 Indicates if the given expression is a strictly upper triangular matrix or not. More...
 
bool is_triangular () const noexcept
 Indicates if the given expression is a triangular matrix or not. More...
 
- Public Member Functions inherited from etl::iterable< unary_expr< T, Expr, UnaryOp > >
derived_tas_derived () noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
const derived_tas_derived () const noexcept
 Returns a reference to the derived object, i.e. the object using the CRTP injector. More...
 
auto begin () noexcept
 Return an iterator to the first element of the matrix. More...
 
auto begin () const noexcept
 Return an iterator to the first element of the matrix. More...
 
auto end () noexcept
 Return an iterator to the past-the-end element of the matrix. More...
 
auto end () const noexcept
 Return an iterator to the past-the-end element of the matrix. More...
 
auto cbegin () const noexcept
 Return an iterator to the first element of the matrix. More...
 
auto cend () const noexcept
 Return an iterator to the past-the-end element of the matrix. More...
 

Friends

struct etl_traits< unary_expr >
 
struct optimizer< unary_expr >
 
struct optimizable< unary_expr >
 
struct transformer< unary_expr >
 
std::ostream & operator<< (std::ostream &os, const unary_expr &expr)
 Prints the type of the unary expression to the stream. More...
 

Detailed Description

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
struct etl::unary_expr< T, Expr, UnaryOp >

An unary expression.

This expression applies an unary operator on each element of a sub expression

Member Typedef Documentation

◆ vec_type

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename V = default_vec>
using etl::unary_expr< T, Expr, UnaryOp >::vec_type = typename V::template vec_type<T>

The vectorization type for V

Constructor & Destructor Documentation

◆ unary_expr()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
etl::unary_expr< T, Expr, UnaryOp >::unary_expr ( Expr  l)
inlineexplicit

Construct a new unary_expr with the given sub expression.

Parameters
lThe sub expression

Member Function Documentation

◆ alias()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename E >
bool etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::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, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename L >
void etl::unary_expr< T, Expr, UnaryOp >::assign_to ( L &&  lhs) const
inline

Assign to the given left-hand-side expression.

Parameters
lhsThe expression to which assign

◆ gpu_compute()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename Y >
decltype(auto) etl::unary_expr< T, Expr, UnaryOp >::gpu_compute ( Y &  y) const
inline

Return a GPU computed version of this expression.

Returns
a GPU-computed ETL expression for this expression

◆ gpu_compute_hint()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename Y >
decltype(auto) etl::unary_expr< T, Expr, UnaryOp >::gpu_compute_hint ( Y &  y) const
inline

Return a GPU computed version of this expression.

Returns
a GPU-computed ETL expression for this expression

◆ load()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename V = default_vec>
vec_type<V> etl::unary_expr< T, Expr, UnaryOp >::load ( size_t  i) const
inline

Load several elements of the matrix at once.

Parameters
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
Returns
a vector containing several elements of the matrix

◆ loadu()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<typename V = default_vec>
vec_type<V> etl::unary_expr< T, Expr, UnaryOp >::loadu ( size_t  i) const
inline

Load several elements of the matrix at once.

Parameters
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
Returns
a vector containing several elements of the matrix

◆ operator()()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
template<size_c... S>
value_type etl::unary_expr< T, Expr, UnaryOp >::operator() ( S...  args) const
inline

Returns the value at the position (args...)

Parameters
argsThe indices
Returns
The computed value at the position (args...)

◆ operator[]()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
value_type etl::unary_expr< T, Expr, UnaryOp >::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 T, expr_or_scalar< T > Expr, typename UnaryOp>
value_type etl::unary_expr< T, Expr, UnaryOp >::read_flat ( size_t  i) const
inlinenoexcept

Returns the value at the given index This function never alters the state of the container.

Parameters
iThe index
Returns
the value at the given index.

◆ visit()

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
void etl::unary_expr< T, Expr, UnaryOp >::visit ( detail::evaluator_visitor visitor) const
inline

Apply the given visitor to this expression and its descendants.

Parameters
visitorThe visitor to apply

Friends And Related Function Documentation

◆ operator<<

template<typename T, expr_or_scalar< T > Expr, typename UnaryOp>
std::ostream& operator<< ( std::ostream &  os,
const unary_expr< T, Expr, UnaryOp > &  expr 
)
friend

Prints the type of the unary expression to the stream.

Parameters
osThe output stream
exprThe expression to print
Returns
the output stream

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