12 namespace traits_detail {
24 template <
typename V1,
typename V2,
order V3,
size_t... R>
37 template <
typename V1,
typename V2,
order V3,
size_t... R>
50 template <
typename V1, order V2,
size_t V3>
63 template <
typename V1, order V2,
size_t V3>
76 template <
typename V1, order V2,
size_t V3>
89 template <
typename V1, sparse_storage V2,
size_t V3>
102 template <
typename E,
size_t D>
109 template <
typename T>
115 template <
typename E,
bool Aligned>
122 template <
typename T>
128 template <
typename Selector, Selector V,
typename Expr>
134 template <
template <
typename,
bool>
typename BTE,
typename T,
bool B>
135 std::true_type is_base_of_template_tb_impl(
const BTE<T, B>*);
140 template <
template <
typename,
bool>
typename BTE>
141 std::false_type is_base_of_template_tb_impl(...);
146 template <
typename T,
template <
typename,
bool>
typename C>
147 constexpr
bool is_base_of_template_tb = decltype(is_base_of_template_tb_impl<C>(std::declval<T*>()))::value;
149 template <
typename E>
150 constexpr
bool is_nongpu_temporary_impl() {
152 return !std::decay_t<E>::gpu_computable;
158 template <
typename E>
159 constexpr
bool is_gpu_temporary_impl() {
161 return std::decay_t<E>::gpu_computable;
173 template <
typename T>
180 template <
typename T>
187 template <
typename T>
194 template <
typename T>
201 template <
typename T>
208 template <
typename T>
215 template <
typename T>
222 template <
typename T>
229 template <
typename T>
236 template <
typename T>
243 template <
typename T>
250 template <
typename T>
257 template <
typename T>
264 template <
typename T>
271 template <
typename T>
272 constexpr
bool is_wrapper_expr = is_optimized_expr<T> || is_selected_expr<T> || is_serial_expr<T> || is_parallel_expr<T> || is_timed_expr<T>;
277 template <
typename T>
283 template <
typename T>
289 template <
typename T>
296 template <
typename T>
303 template <
typename T>
310 template <
typename T>
317 template <
typename T>
324 template <
typename T>
331 template <
typename T>
338 template <
typename T>
345 template <
typename T>
347 is_fast_matrix<T> || is_custom_fast_matrix<T> || is_dyn_matrix<T> || is_custom_dyn_matrix<T> || is_sparse_matrix<T> || is_gpu_dyn_matrix<T>;
353 template <
typename T>
354 constexpr
bool is_lhs = is_etl_value<T> || is_unary_expr<T>;
361 template <
typename T>
362 constexpr
bool is_simple_lhs = is_etl_value_class<T> || is_unary_expr<T> || is_sub_view<T> || is_slice_view<T> || is_dyn_matrix_view<T>;
368 template <
typename T>
369 constexpr
bool is_scalar = cpp::specialization_of<etl::scalar, T>;
375 template <
typename T>
382 template <
typename T>
389 template <
typename... E>
396 template <
typename T>
403 template <
typename T>
410 template <
typename T>
417 template <
typename... E>
424 template <
typename T>
425 constexpr
bool is_floating = is_single_precision<T> || is_double_precision<T>;
431 template <
typename T>
432 constexpr
bool is_floating_t = is_single_precision_t<T> || is_double_precision_t<T>;
438 template <
typename... E>
445 template <
typename... E>
452 template <
typename T>
453 constexpr
bool is_complex_t = cpp::specialization_of<std::complex, T> || cpp::specialization_of<etl::complex, T>;
459 template <
typename T>
460 constexpr
bool is_complex_single_t = std::is_same_v<T, std::complex<float>> || std::is_same_v<T, etl::complex<float>>;
466 template <
typename T>
467 constexpr
bool is_complex_double_t = std::is_same_v<T, std::complex<double>> || std::is_same_v<T, etl::complex<double>>;
473 template <
typename T>
480 template <
typename T>
487 template <
typename... E>
494 template <
typename... E>
501 template <
typename T>
502 constexpr
bool is_complex = is_complex_single_precision<T> || is_complex_double_precision<T>;
508 template <
typename... E>
517 template <
typename T>
526 template <
typename T>
538 template <
typename T>
539 constexpr
bool is_gpu_t = is_floating_t<T> || is_complex_t<T> || is_bool_t<T>;
545 template <
typename T>
552 template <
typename... E>
559 template <
typename E>
566 template <
typename... E>
573 template <
typename E>
580 template <
typename... E>
587 template <
typename E>
594 template <
typename... E>
601 template <
typename... E>
608 template <
typename T>
615 template <
typename... T>
616 constexpr
bool all_1d = (is_1d<T> && ...);
622 template <
typename T>
629 template <
typename... T>
630 constexpr
bool all_2d = (is_2d<T> && ...);
636 template <
typename T>
643 template <
typename... T>
644 constexpr
bool all_3d = (is_3d<T> && ...);
650 template <
typename T>
657 template <
typename... T>
658 constexpr
bool all_4d = (is_4d<T> && ...);
671 template <vector_mode_t V,
typename E>
686 template <
typename E>
694 template <
typename... E>
701 template <
typename T>
708 template <
typename T>
715 template <
typename... E>
724 template <
typename T>
733 template <
typename... E>
740 template <
typename... E>
747 template <
typename T>
754 template <
typename T>
761 template <
typename T>
764 namespace traits_detail {
773 template <
typename T>
774 constexpr
bool inplace_sub_transpose_able_impl() {
775 if constexpr (is_fast<T> && is_3d<T>) {
777 }
else if constexpr (!is_fast<T> && is_3d<T>) {
788 template <
typename T>
789 constexpr
bool inplace_transpose_able_impl() {
790 if constexpr (is_fast<T> && is_2d<T>) {
792 }
else if constexpr (!is_fast<T> && is_2d<T>) {
802 template <
typename Matrix>
803 constexpr
bool is_square_matrix_impl() {
804 if constexpr (is_fast<Matrix> && is_2d<Matrix>) {
806 }
else if constexpr (!is_fast<Matrix> && is_2d<Matrix>) {
819 template <
typename T>
829 template <
typename T>
835 template <
typename Matrix>
842 template <
typename E>
849 template <
typename E>
856 template <
typename E>
862 template <
typename T,
typename S>
864 std::is_const_v<std::remove_reference_t<S>>,
866 std::conditional_t<std::is_lvalue_reference_v<S> && !std::is_const_v<T>, value_t<T>&, value_t<T>>>;
871 template <
typename T,
typename S>
872 using const_return_helper = std::conditional_t<std::is_lvalue_reference_v<S>,
const value_t<T>&, value_t<T>>;
877 template <
typename T>
882 static constexpr
bool is_etl =
true;
883 static constexpr
bool is_transformer =
false;
884 static constexpr
bool is_view =
false;
885 static constexpr
bool is_magic_view =
false;
886 static constexpr
bool is_fast = is_fast_matrix<T> || is_custom_fast_matrix<T>;
887 static constexpr
bool is_value =
true;
888 static constexpr
bool is_direct = !is_sparse_matrix<T>;
889 static constexpr
bool is_thread_safe =
true;
890 static constexpr
bool is_linear =
true;
891 static constexpr
bool is_generator =
false;
892 static constexpr
bool is_temporary =
false;
893 static constexpr
bool is_padded = is_padded_value<T>;
894 static constexpr
bool is_aligned = is_aligned_value<T>;
895 static constexpr
order storage_order = T::storage_order;
896 static constexpr
bool gpu_computable = is_gpu_t<value_type> &&
cuda_enabled;
903 template <vector_mode_t V>
911 static size_t size(
const T& v) {
921 static size_t dim(
const T& v,
size_t d) {
929 static constexpr
size_t size()
requires(is_fast) {
940 return T::template dim<D>();
947 static constexpr
size_t dimensions() {
948 return T::n_dimensions;
constexpr bool is_transpose_expr
Traits indicating if the given type is a transpose expr.
Definition: traits.hpp:325
constexpr bool all_double_precision
Traits to test if all the given ETL expresion types contains double precision numbers.
Definition: traits.hpp:418
Traits to get the intrinsic traits for a vector mode.
Definition: vectorization.hpp:88
Definition: expr_fwd.hpp:44
constexpr bool is_complex_single_precision
Traits to test if the given ETL expresion type contains single precision complex numbers.
Definition: traits.hpp:474
constexpr bool fast_sub_matrix_able
Simple utility traits indicating if a light sub_matrix can be created out of this type...
Definition: traits.hpp:755
constexpr bool all_homogeneous
Traits to test if all the given ETL expresion types are padded.
Definition: traits.hpp:741
constexpr bool all_column_major
Traits to test if all the given ETL expresion types are column-major.
Definition: traits.hpp:581
Special traits helper to detect if type is a dyn_matrix_view.
Definition: traits.hpp:97
constexpr int complexity([[maybe_unused]] const E &expr) noexcept
Return the complexity of the expression.
Definition: helpers.hpp:38
constexpr bool all_vectorizable_t
Traits to test if all the given types are vectorizable types.
Definition: traits.hpp:679
constexpr bool is_sparse_matrix
Traits indicating if the given ETL type is a sparse matrix.
Definition: traits.hpp:209
constexpr bool all_etl_expr
Traits to test if all the given types are ETL types.
Definition: traits.hpp:602
constexpr bool is_etl_expr
Traits indicating if the given type is an ETL type.
Definition: traits.hpp:318
constexpr bool all_dma
Traits to test if all the given ETL expresion types have direct memory access (DMA).
Definition: traits.hpp:553
constexpr bool is_gpu_temporary
Traits to test if an expression is a temporary expression with GPU capabilities.
Definition: traits.hpp:850
Special traits helper to detect if type is a dyn_matrix.
Definition: traits.hpp:45
constexpr bool is_complex_double_t
Traits to test if a type is a double precision complex number type.
Definition: traits.hpp:467
constexpr bool is_scalar
Traits to test if a type is a scalar type.
Definition: traits.hpp:369
A temporary expression base.
Definition: base_temporary_expr.hpp:66
Special traits helper to detect if type is a sparse_matrix.
Definition: traits.hpp:84
constexpr bool is_temporary_expr
Traits indicating if the given type is a temporary expression.
Definition: traits.hpp:332
vector_mode_t
Vectorization mode.
Definition: config.hpp:184
value_t< sub_type > value_type
The value contained in the expression.
Definition: dyn_matrix_view.hpp:31
constexpr bool is_magic_view
Traits indicating if the given ETL type is a magic view expression.
Definition: traits.hpp:311
constexpr bool is_deep_double_precision
Traits to test if the given ETL expresion type contains double precision floating point or double pre...
Definition: traits.hpp:527
constexpr bool inplace_transpose_able
Traits to test if an expression is inplace transpose-able.
Definition: traits.hpp:820
D D
The number of dimensions.
Definition: dyn_matrix_view.hpp:24
constexpr bool is_generator_expr
Traits indicating if the given ETL type is a generator expression.
Definition: traits.hpp:230
constexpr bool is_selected_expr
Traits indicating if the given ETL type is a selector expression.
Definition: traits.hpp:251
constexpr bool is_dma
Traits indicating if the given ETL type has direct memory access.
Definition: traits.hpp:546
constexpr bool all_complex_double_precision
Traits to test if all the given ETL expresion types contains double precision complex numbers...
Definition: traits.hpp:495
constexpr bool is_single_precision
Traits to test if the given ETL expresion contains single precision numbers.
Definition: traits.hpp:383
order
Storage order of a matrix.
Definition: order.hpp:15
constexpr bool is_unary_expr
Traits indicating if the given ETL type is a unary expression.
Definition: traits.hpp:216
constexpr bool cuda_enabled
Indicates if CUDA is available.
Definition: config.hpp:94
constexpr bool all_complex
Traits to test if all the given ETL expresion types contains complex numbers.
Definition: traits.hpp:509
constexpr bool is_complex
Traits to test if the given ETL expresion type contains complex numbers.
Definition: traits.hpp:502
std::conditional_t< std::is_lvalue_reference_v< S >, const value_t< T > &, value_t< T > > const_return_helper
Definition: traits.hpp:872
constexpr bool is_gpu_computable
Traits indicating if the given ETL expression's type is computable on GPU.
Definition: traits.hpp:725
Special traits helper to detect if type is a sub_view.
Definition: traits.hpp:110
constexpr bool is_dyn_matrix_view
Traits to test if the given expression is a dyn_matrix_view.
Definition: traits.hpp:290
Definition: expr_fwd.hpp:80
constexpr bool is_aligned_value
Traits to test if the givn ETL expression is an aligned value class.
Definition: traits.hpp:709
constexpr bool is_slice_view
Traits to test if the given expression is a slice_view.
Definition: traits.hpp:284
constexpr bool is_nongpu_temporary
Traits to test if an expression is a temporary expression with non-GPU capabilities.
Definition: traits.hpp:843
constexpr bool is_fast
Traits to test if the given ETL expresion type is fast (sizes known at compile-time) ...
Definition: traits.hpp:588
constexpr bool is_dyn_matrix
Traits indicating if the given ETL type is a dyn matrix.
Definition: traits.hpp:188
constexpr bool is_row_major
Traits to test if all the given ETL expresion types are row-major.
Definition: traits.hpp:560
constexpr bool all_single_precision
Traits to test if all the given ETL expresion types contains single precision numbers.
Definition: traits.hpp:390
Traits to get information about ETL types.
Definition: tmp.hpp:68
Root namespace for the ETL library.
Definition: adapter.hpp:15
constexpr bool all_4d
Traits to test if all the given expression types are 4D.
Definition: traits.hpp:658
std::conditional_t< std::is_const_v< std::remove_reference_t< S > >, const value_t< T > &, std::conditional_t< std::is_lvalue_reference_v< S > &&!std::is_const_v< T >, value_t< T > &, value_t< T > >> return_helper
Definition: traits.hpp:866
Special traits helper to detect if type is a fast_matrix.
Definition: traits.hpp:19
constexpr bool is_single_precision_t
Traits to test if the given type is single precision type.
Definition: traits.hpp:376
static constexpr size_t dimensions()
Return the number of dimensions of the expression.
Definition: traits_base.hpp:31
constexpr bool is_column_major
Traits to test if all the given ETL expresion types are column-major.
Definition: traits.hpp:574
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
constexpr bool all_1d
Traits to test if all the given expression types are 1D.
Definition: traits.hpp:616
constexpr bool is_square_matrix
Traits to test if a matrix is a square matrix, if this can be defined.
Definition: traits.hpp:836
constexpr bool all_fast
Traits to test if all the given ETL expresion types are fast (sizes known at compile-time) ...
Definition: traits.hpp:595
constexpr bool is_complex_single_t
Traits to test if a type is a single precision complex number type.
Definition: traits.hpp:460
Special traits helper to detect if type is a custom_dyn_matrix.
Definition: traits.hpp:71
constexpr bool is_2d
Traits to test if the given expression type is 2D.
Definition: traits.hpp:623
constexpr bool is_fast_matrix
Traits indicating if the given ETL type is a fast matrix.
Definition: traits.hpp:174
constexpr bool is_sub_view
Traits to test if the given expression is a sub_view.
Definition: traits.hpp:278
constexpr bool is_complex_t
Traits to test if a type is a complex number type.
Definition: traits.hpp:453
constexpr bool all_complex_single_precision
Traits to test if all the given ETL expresion types contains single precision complex numbers...
Definition: traits.hpp:488
constexpr bool is_lhs
Traits indicating if the given ETL type can be left hand side type.
Definition: traits.hpp:354
constexpr bool is_etl_value_class
Traits indicating if the given ETL type is from a value class.
Definition: traits.hpp:346
Special traits helper to detect if type is a gpu_dyn_matrix.
Definition: traits.hpp:58
constexpr bool is_gpu_t
Traits to test if the given type contains a type that can be computed on a GPU.
Definition: traits.hpp:539
constexpr bool is_timed_expr
Traits indicating if the given ETL type is a timed expression.
Definition: traits.hpp:265
constexpr bool is_wrapper_expr
Traits indicating if the given ETL type is a wrapper expression (optimized, serial, ...).
Definition: traits.hpp:272
constexpr bool is_deep_single_precision
Traits to test if the given ETL expresion type contains single precision floating point or single pre...
Definition: traits.hpp:518
Matrix with run-time fixed dimensions.
Definition: dyn.hpp:26
constexpr bool is_floating
Traits to test if the given ETL expresion contains floating point numbers.
Definition: traits.hpp:425
constexpr bool should_gpu_compute_direct
Traits indicating if it's more efficient to use smart_gpu_compute(x) instead of smart_gpu_compute(x, y) for an expression of type E.
Definition: traits.hpp:857
constexpr bool all_floating_t
Traits to test if all the given types are floating point numbers.
Definition: traits.hpp:446
Matrix with compile-time fixed dimensions.
Definition: fast.hpp:26
constexpr bool is_double_precision
Traits to test if the given ETL expresion contains double precision numbers.
Definition: traits.hpp:411
constexpr bool is_transformer
Traits indicating if the given ETL type is a transformer expression.
Definition: traits.hpp:297
constexpr bool is_complex_double_precision
Traits to test if the given ETL expresion type contains double precision complex numbers.
Definition: traits.hpp:481
constexpr bool is_simple_lhs
Traits indicating if the given ETL type is a simple left hand side type. Adapter types are not taken ...
Definition: traits.hpp:362
constexpr bool fast_slice_view_able
Simple utility traits indicating if a light slice view can be created out of this type...
Definition: traits.hpp:762
constexpr bool is_gpu_dyn_matrix
Traits indicating if the given ETL type is a GPU dyn matrix.
Definition: traits.hpp:195
constexpr bool all_gpu_computable
Traits indicating if all the given ETL expresion types are computable on GPU.
Definition: traits.hpp:734
constexpr bool is_serial_expr
Traits indicating if the given ETL type is a serial expression.
Definition: traits.hpp:244
constexpr bool all_3d
Traits to test if all the given expression types are 3D.
Definition: traits.hpp:644
requires(D > 0) struct dyn_base
Matrix with run-time fixed dimensions.
Definition: dyn_base.hpp:113
constexpr bool is_view
Traits indicating if the given ETL type is a view expression.
Definition: traits.hpp:304
constexpr bool is_custom_dyn_matrix
Traits indicating if the given ETL type is a custom dyn matrix.
Definition: traits.hpp:202
constexpr bool all_2d
Traits to test if all the given expression types are 2D.
Definition: traits.hpp:630
constexpr bool is_padded_value
Traits to test if the givn ETL expression is a padded value class.
Definition: traits.hpp:702
Definition: expr_fwd.hpp:59
Matrix with run-time fixed dimensions.
Definition: custom_dyn.hpp:27
constexpr bool all_padded
Traits to test if all the given ETL expresion types are padded.
Definition: traits.hpp:716
constexpr bool is_etl_value
Traits indicating if the given ETL type is a value type.
Definition: traits.hpp:339
constexpr bool is_binary_expr
Traits indicating if the given ETL type is a binary expression.
Definition: traits.hpp:223
constexpr bool inplace_sub_transpose_able
Traits to test if an expression is inplace sub transpose-able.
Definition: traits.hpp:830
constexpr bool all_row_major
Traits to test if all the given ETL expresion types are row-major.
Definition: traits.hpp:567
constexpr bool all_vectorizable
Traits to test if all the given ETL expresion types are vectorizable.
Definition: traits.hpp:665
constexpr bool all_thread_safe
Traits to test if all the given ETL expresion types are thread safe.
Definition: traits.hpp:695
Matrix with compile-time fixed dimensions.
Definition: custom_fast.hpp:27
constexpr bool is_thread_safe
Traits to test if the given ETL expresion type is thread safe.
Definition: traits.hpp:687
constexpr bool is_custom_fast_matrix
Traits indicating if the given ETL type is a fast matrix.
Definition: traits.hpp:181
constexpr bool is_bool_t
Traits to test if the type is boolean.
Definition: traits.hpp:404
Special traits helper to detect if type is a custom_fast_matrix.
Definition: traits.hpp:32
constexpr bool all_floating
Traits to test if all the given ETL expresion types contains floating point numbers.
Definition: traits.hpp:439
constexpr bool is_3d
Traits to test if the given expression type is 3D.
Definition: traits.hpp:637
Sparse matrix implementation.
Definition: sparse.hpp:211
constexpr bool fast_sub_view_able
Simple utility traits indicating if a light subview can be created out of this type.
Definition: traits.hpp:748
constexpr bool is_floating_t
Traits to test if the type is floating point numbers.
Definition: traits.hpp:432
constexpr bool is_optimized_expr
Traits indicating if the given ETL type is an optimized expression.
Definition: traits.hpp:237
constexpr bool is_1d
Traits to test if the given expression type is 1D.
Definition: traits.hpp:609
typename decay_traits< E >::value_type value_t
Traits to extract the value type out of an ETL type.
Definition: tmp.hpp:81
GPU special Matrix with run-time fixed dimensions.
Definition: gpu_dyn.hpp:25
Special traits helper to detect if type is a selected_expr.
Definition: traits.hpp:123
constexpr bool is_parallel_expr
Traits indicating if the given ETL type is a parallel expression.
Definition: traits.hpp:258
constexpr bool is_4d
Traits to test if the given expression type is 4D.
Definition: traits.hpp:651
constexpr bool is_double_precision_t
Traits to test if the given type is double precision type.
Definition: traits.hpp:397