Expression Templates Library (ETL)
mod.hpp
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 
8 #pragma once
9 
10 namespace etl {
11 
15 template <typename T>
16 struct mod_binary_op {
17  static constexpr bool linear = true;
18  static constexpr bool thread_safe = true;
19  static constexpr bool desc_func = false;
20 
26  template <vector_mode_t V>
27  static constexpr bool vectorizable = false;
28 
32  template <typename L, typename R>
33  static constexpr bool gpu_computable = false;
34 
39  static constexpr int complexity() {
40  return 2;
41  }
42 
49  static constexpr T apply(const T& lhs, const T& rhs) noexcept {
50  return lhs % rhs;
51  }
52 
57  static std::string desc() noexcept {
58  return "%";
59  }
60 };
61 
62 } //end of namespace etl
static constexpr bool gpu_computable
Indicates if the operator can be computed on GPU.
Definition: mod.hpp:33
Binary operator for scalar modulo.
Definition: mod.hpp:16
Root namespace for the ETL library.
Definition: adapter.hpp:15
static constexpr bool desc_func
Indicates if the description must be printed as function.
Definition: mod.hpp:19
static std::string desc() noexcept
Returns a textual representation of the operator.
Definition: mod.hpp:57
static constexpr int complexity()
Estimate the complexity of operator.
Definition: mod.hpp:39
static constexpr T apply(const T &lhs, const T &rhs) noexcept
Apply the unary operator on lhs and rhs.
Definition: mod.hpp:49
static constexpr bool vectorizable
Indicates if the expression is vectorizable using the given vector mode.
Definition: mod.hpp:27
static constexpr bool thread_safe
Indicates if the operator is thread safe or not.
Definition: mod.hpp:18
static constexpr bool linear
Indicates if the operator is linear or not.
Definition: mod.hpp:17