22 template <
typename T,
size_t D>
24 static_assert(
D == 1 ||
D == 2,
"Invalid dimension");
118 template <
typename E>
119 bool alias(
const E& rhs)
const noexcept {
120 return sub.alias(rhs);
128 return sub.memory_start() + i *
subsize(sub);
136 return sub.memory_start() + i *
subsize(sub);
144 return sub.memory_start() + (i + 1) *
subsize(sub);
152 return sub.memory_start() + (i + 1) *
subsize(sub);
161 template <
typename L>
170 template <
typename L>
179 template <
typename L>
188 template <
typename L>
197 template <
typename L>
206 template <
typename L>
227 sub.ensure_cpu_up_to_date();
236 sub.ensure_gpu_up_to_date();
246 return os <<
"dim[" <<
D <<
"](" << v.sub <<
", " << v.i <<
")";
253 template <
typename T,
size_t D>
259 static constexpr
bool is_etl =
true;
264 static constexpr
bool is_linear =
false;
266 static constexpr
bool is_value =
false;
268 static constexpr
bool is_generator =
false;
269 static constexpr
bool is_padded =
false;
270 static constexpr
bool is_aligned =
false;
272 static constexpr
bool gpu_computable =
false;
280 template <vector_mode_t V>
281 static constexpr
bool vectorizable =
false;
302 static size_t dim(
const expr_t& v, [[maybe_unused]]
size_t d) {
303 cpp_assert(d == 0,
"Invalid dimension");
312 static constexpr
size_t size() {
330 static constexpr
size_t dimensions() {
void assign_add_to(L &&lhs) const
Add to the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:217
constexpr int complexity([[maybe_unused]] const E &expr) noexcept
Return the complexity of the expression.
Definition: helpers.hpp:38
static size_t dim(const expr_t &v, [[maybe_unused]] size_t d)
Returns the dth dimension of the given expression.
Definition: dim_view.hpp:302
T sub_type
The sub type.
Definition: dim_view.hpp:26
void std_assign_evaluate(Expr &&expr, Result &&result)
Evaluation of the expr into result.
Definition: evaluator.hpp:1176
void assign_div_to(L &&lhs) const
Divide the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:244
const_return_type operator[](size_t j) const
Returns the element at the given index.
Definition: dim_view.hpp:52
void assign_mul_to(L &&lhs) const
Multiply the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:235
constexpr bool is_magic_view
Traits indicating if the given ETL type is a magic view expression.
Definition: traits.hpp:311
memory_t< sub_type > memory_type
The memory acess type.
Definition: dim_view.hpp:28
static constexpr size_t size()
Returns the size of an expression of this fast type.
Definition: dim_view.hpp:312
std::decay_t< T > sub_expr_t
The sub expression type.
Definition: dim_view.hpp:256
void assign_to(L &&lhs) const
Assign to the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:208
bool alias(const E &rhs) const noexcept
Test if this expression aliases with the given expression.
Definition: dim_view.hpp:119
D D
The number of dimensions.
Definition: dyn_matrix_view.hpp:24
order
Storage order of a matrix.
Definition: order.hpp:15
std::conditional_t< std::is_lvalue_reference_v< S >, const value_t< T > &, value_t< T > > const_return_helper
Definition: traits.hpp:872
return_helper< sub_type, decltype(std::declval< sub_type >()(0, 0))> return_type
The type returned by the view.
Definition: dim_view.hpp:30
const_return_helper< sub_type, decltype(std::declval< sub_type >()(0, 0))> const_return_type
The const type return by the view.
Definition: dim_view.hpp:31
constexpr bool is_fast
Traits to test if the given ETL expresion type is fast (sizes known at compile-time) ...
Definition: traits.hpp:588
Traits to get information about ETL types.
Definition: tmp.hpp:68
Root namespace for the ETL library.
Definition: adapter.hpp:15
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
const_memory_t< sub_type > const_memory_type
The const memory access type.
Definition: dim_view.hpp:29
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
std::conditional_t< std::is_const_v< std::remove_reference_t< S > >, typename std::decay_t< S >::const_memory_type, typename std::decay_t< S >::memory_type > memory_t
Traits to extract the direct memory type out of an ETL type.
Definition: tmp.hpp:88
std::ostream & operator<<(std::ostream &os, const etl::complex< T > &c)
Outputs a textual representation of the complex number in the given stream.
Definition: complex.hpp:576
typename std::decay_t< S >::const_memory_type const_memory_t
Traits to extract the direct const memory type out of an ETL type.
Definition: tmp.hpp:94
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)...
Definition: dyn_matrix_view.hpp:271
Visitor to perform local evaluation when necessary.
Definition: eval_visitors.hpp:23
typename etl_traits< sub_expr_t >::value_type value_type
The value type.
Definition: dim_view.hpp:257
void std_mod_evaluate(Expr &&expr, Result &&result)
Compound modulo evaluation of the expr into result.
Definition: evaluator.hpp:1271
value_t< sub_type > value_type
The value contained in the expression.
Definition: dim_view.hpp:27
void std_mul_evaluate(Expr &&expr, Result &&result)
Compound multiply evaluation of the expr into result.
Definition: evaluator.hpp:1233
constexpr bool is_transformer
Traits indicating if the given ETL type is a transformer expression.
Definition: traits.hpp:297
void visit(detail::evaluator_visitor &visitor) const
Apply the given visitor to this expression and its descendants.
Definition: dyn_matrix_view.hpp:263
dim_view(sub_type sub, size_t i)
Construct a new dim_view over the given sub expression.
Definition: dim_view.hpp:45
const_return_type operator()(size_t j) const
Returns the element at the given index.
Definition: dim_view.hpp:92
View that shows one dimension of a matrix.
Definition: expr_fwd.hpp:56
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
void ensure_gpu_up_to_date() const
Copy back from the GPU to the expression memory if necessary.
Definition: dyn_matrix_view.hpp:280
static size_t size(const expr_t &v)
Returns the size of the given expression.
Definition: dim_view.hpp:288
value_type read_flat(size_t j) const noexcept
Returns the value at the given index This function never has side effects.
Definition: dim_view.hpp:79
void std_sub_evaluate(Expr &&expr, Result &&result)
Compound subtract evaluation of the expr into result.
Definition: evaluator.hpp:1214
void assign_mod_to(L &&lhs) const
Modulo the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:253
constexpr bool is_thread_safe
Traits to test if the given ETL expresion type is thread safe.
Definition: traits.hpp:687
return_type operator[](size_t j)
Returns the element at the given index.
Definition: dim_view.hpp:65
return_type operator()(size_t j)
Returns the element at the given index.
Definition: dim_view.hpp:105
typename decay_traits< E >::value_type value_t
Traits to extract the value type out of an ETL type.
Definition: tmp.hpp:81
void std_div_evaluate(Expr &&expr, Result &&result)
Compound divide evaluation of the expr into result.
Definition: evaluator.hpp:1252
size_t subsize(const E &expr)
Returns the sub-size of the given ETL expression, i.e. the size not considering the first dimension...
Definition: helpers.hpp:118
void std_add_evaluate(Expr &&expr, Result &&result)
Compound add evaluation of the expr into result.
Definition: evaluator.hpp:1195
void assign_sub_to(L &&lhs) const
Sub from the given left-hand-side expression.
Definition: dyn_matrix_view.hpp:226