Expression Templates Library (ETL)
wrapper_traits.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014-2023 Baptiste Wicht
3 // Distributed under the terms of the MIT License.
4 // (See accompanying file LICENSE or copy at
5 // http://opensource.org/licenses/MIT)
6 //=======================================================================
7 
13 #pragma once
14 
15 namespace etl {
16 
20 template <typename T>
22  using expr_t = T;
23  using sub_expr_t = std::decay_t<typename T::expr_t>;
26 
27  static constexpr bool is_etl = sub_traits::is_etl;
28  static constexpr bool is_transformer = sub_traits::is_transformer;
29  static constexpr bool is_view = sub_traits::is_view;
30  static constexpr bool is_magic_view = sub_traits::is_magic_view;
31  static constexpr bool is_fast = sub_traits::is_fast;
32  static constexpr bool is_value = sub_traits::is_value;
33  static constexpr bool is_direct = sub_traits::is_direct;
34  static constexpr bool is_linear = sub_traits::is_linear;
35  static constexpr bool is_thread_safe = sub_traits::is_thread_safe;
36  static constexpr bool is_generator = sub_traits::is_generator;
37  static constexpr bool is_padded = sub_traits::is_padded;
38  static constexpr bool is_aligned = sub_traits::is_aligned;
39  static constexpr bool is_temporary = sub_traits::is_temporary;
40  static constexpr bool gpu_computable = sub_traits::gpu_computable;
41  static constexpr order storage_order = sub_traits::storage_order;
42 
46  template <vector_mode_t V>
47  static constexpr bool vectorizable = sub_traits::template vectorizable<V>;
48 
54  static size_t size(const expr_t& v) {
55  return sub_traits::size(v.value);
56  }
57 
64  static size_t dim(const expr_t& v, size_t d) {
65  return sub_traits::dim(v.value, d);
66  }
67 
72  static constexpr size_t size() {
73  return sub_traits::size();
74  }
75 
81  template <size_t D>
82  static constexpr size_t dim() {
83  return sub_traits::template dim<D>();
84  }
85 
90  static constexpr size_t dimensions() {
91  return sub_traits::dimensions();
92  }
93 
98  static constexpr int complexity() noexcept {
99  return sub_traits::complexity();
100  }
101 };
102 
103 } //end of namespace etl
static size_t dim(const expr_t &v, size_t d)
Returns the dth dimension of the given expression.
Definition: wrapper_traits.hpp:64
value_t< sub_type > value_type
The value contained in the expression.
Definition: dyn_matrix_view.hpp:31
static constexpr bool is_thread_safe
Indicates if the expression is thread safe.
Definition: wrapper_traits.hpp:35
std::decay_t< typename uni_lower_matrix< Matrix > ::expr_t > sub_expr_t
The sub expression type.
Definition: wrapper_traits.hpp:23
order
Storage order of a matrix.
Definition: order.hpp:15
static constexpr bool is_etl
Indicates if T is an ETL type.
Definition: traits_base.hpp:21
static constexpr size_t dimensions()
Returns the number of expressions for this type.
Definition: wrapper_traits.hpp:90
static constexpr bool is_magic_view
Indicates if the type is a magic view.
Definition: wrapper_traits.hpp:30
static constexpr bool is_value
Indicates if the expression is of value type.
Definition: wrapper_traits.hpp:32
static constexpr bool is_magic_view
Indicates if T is a magic view.
Definition: traits_base.hpp:24
static size_t size(const expr_t &v)
Returns the size of the given expression.
Definition: wrapper_traits.hpp:54
static constexpr bool is_temporary
Indicaes if the expression needs an evaluator visitor.
Definition: wrapper_traits.hpp:39
static constexpr order storage_order
The expression storage order.
Definition: wrapper_traits.hpp:41
Traits to get information about ETL types.
Definition: tmp.hpp:68
Root namespace for the ETL library.
Definition: adapter.hpp:15
A uni lower triangular matrix adapter.
Definition: uni_lower.hpp:27
static constexpr size_t dimensions()
Return the number of dimensions of the expression.
Definition: traits_base.hpp:31
static constexpr size_t dim()
Returns the Dth dimension of an expression of this type.
Definition: wrapper_traits.hpp:82
auto dim(E &&value, size_t i) -> detail::identity_helper< E, dim_view< detail::build_identity_type< E >, D >>
Return a view representing the ith Dth dimension.
Definition: view_expression_builder.hpp:25
static constexpr bool is_transformer
Indicates if T is a transformer.
Definition: traits_base.hpp:22
static constexpr bool is_view
Indicates if the type is a view.
Definition: wrapper_traits.hpp:29
matrix_t value
The adapted matrix.
Definition: adapter.hpp:36
static constexpr size_t size()
Returns the size of an expression of this fast type.
Definition: wrapper_traits.hpp:72
static constexpr bool is_linear
Indicates if the expression is linear.
Definition: wrapper_traits.hpp:34
static constexpr bool is_direct
Indicates if the expression has direct memory access.
Definition: wrapper_traits.hpp:33
static constexpr bool vectorizable
Definition: wrapper_traits.hpp:47
static constexpr bool is_fast
Indicates if the expression is fast.
Definition: wrapper_traits.hpp:31
static constexpr bool is_view
Indicates if T is a view.
Definition: traits_base.hpp:23
static constexpr bool is_fast
Indicates if T is a fast structure.
Definition: traits_base.hpp:25
static constexpr bool is_padded
Indicates if the expression is a padded.
Definition: wrapper_traits.hpp:37
static constexpr bool is_aligned
Indicates if the expression is a padded.
Definition: wrapper_traits.hpp:38
static constexpr bool is_generator
Indicates if the expression is a generator expression.
Definition: wrapper_traits.hpp:36
static constexpr bool is_etl
Indicates if the type is an ETL expression.
Definition: wrapper_traits.hpp:27
static constexpr bool is_transformer
Indicates if the type is a transformer.
Definition: wrapper_traits.hpp:28
static constexpr int complexity() noexcept
Estimate the complexity of computation.
Definition: wrapper_traits.hpp:98
typename sub_expr_t::value_type value_type
The value type of the expression.
Definition: wrapper_traits.hpp:25
Traits for wrapper expressions.
Definition: wrapper_traits.hpp:21
static constexpr bool gpu_computable
Indicates if the expression can be computed on GPU.
Definition: wrapper_traits.hpp:40
static constexpr bool is_generator
Indicates if T is a generator expression.
Definition: traits_base.hpp:26