Expression Templates Library (ETL)
expression_able.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 
22 template <typename D>
24  using derived_t = D;
25 
30  derived_t& as_derived() noexcept {
31  return *static_cast<derived_t*>(this);
32  }
33 
38  template <typename E>
39  auto scale(E&& e) {
40  return etl::scale(as_derived(), std::forward<E>(e));
41  }
42 
47  auto fflip() {
48  return etl::fflip(as_derived());
49  }
50 
55  auto hflip() {
56  return etl::hflip(as_derived());
57  }
58 
63  auto vflip() {
64  return etl::vflip(as_derived());
65  }
66 
71  auto transpose() {
72  return etl::transpose(as_derived());
73  }
74 
79  auto real() {
80  return etl::real(as_derived());
81  }
82 
87  auto imag() {
88  return etl::imag(as_derived());
89  }
90 
95  auto conj() {
96  return etl::conj(as_derived());
97  }
98 };
99 
100 } //end of namespace etl
auto real()
Extract the real part of a complex expression.
Definition: expression_able.hpp:79
D D
The number of dimensions.
Definition: dyn_matrix_view.hpp:24
auto fflip()
Flip the matrix horizontally and vertically.
Definition: expression_able.hpp:47
auto conj(E &&value)
Apply the conjugate operation on each complex value of the given expression.
Definition: expression_builder.hpp:206
auto hflip(const E &value)
Returns the horizontal flipping of the given expression.
Definition: expression_builder.hpp:498
auto transpose(const E &value)
Returns the transpose of the given expression.
Definition: expression_builder.hpp:528
Root namespace for the ETL library.
Definition: adapter.hpp:15
CRTP class to inject functions creating new expressions.
Definition: expression_able.hpp:23
auto real(E &&value)
Extract the real part of each complex value of the given expression.
Definition: expression_builder.hpp:186
auto scale(LE &&lhs, RE &&rhs)
Builds an expression representing the scalar multiplication of lhs and rhs.
Definition: binary_expression_builder.hpp:64
auto vflip()
Flip the matrix vertically.
Definition: expression_able.hpp:63
derived_t & as_derived() noexcept
Returns a reference to the derived object, i.e. the object using the CRTP injector.
Definition: expression_able.hpp:30
auto hflip()
Flip the matrix horizontally.
Definition: expression_able.hpp:55
auto conj()
Returns a new expression containg the conjugate of each value of the expression.
Definition: expression_able.hpp:95
auto transpose()
Transpose the matrix.
Definition: expression_able.hpp:71
Matrix with compile-time fixed dimensions.
Definition: custom_fast.hpp:27
auto fflip(const E &value)
Returns the horizontal and vertical flipping of the given expression.
Definition: expression_builder.hpp:518
auto imag(E &&value)
Extract the imag part of each complex value of the given expression.
Definition: expression_builder.hpp:196
auto imag()
Extract the imag part of a complex expression.
Definition: expression_able.hpp:87
auto vflip(const E &value)
Returns the vertical flipping of the given expression.
Definition: expression_builder.hpp:508
auto scale(E &&e)
Scale the expression by a scalar factor or another expression.
Definition: expression_able.hpp:39