E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ lcm

eve::lcm = functor<lcm_t>
inlineconstexpr

Callable Signatures

#include <eve/module/combinatorial.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <integral_value T0, integral_value T1> constexpr common_value_t<T0, T1> lcm(T0 p, T1 n) noexcept; // 1
// Lanes masking
constexpr auto lcm[conditional_expr auto c](integral_value auto p, integral_value auto n) noexcept; // 2
constexpr auto lcm[logical_value auto m](integral_value auto p, integral_value auto n) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:51
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto lcm
elementwise_callable object computing the least common multiple of the inputs.
Definition lcm.hpp:77
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. Returns the least common multiple of |p| and |n|.
  2. The operation is performed conditionnaly

External references

Example

#include <eve/eve.hpp>
#include <eve/module/combinatorial.hpp>
#include <iostream>
int main() {
eve::wide<float> wf0([](auto i, auto c)->float{ return (i-c/2);});
eve::wide<float> wf1([](auto i, auto )->float{ return 10*i; });
eve::wide n{93, 25, 32, 368, 216, 43, 18, 25};
eve::wide p{42, 30, 27, 1024, 36, 12, 51, 44};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wf1 = " << wf1 << "\n";
std::cout << "<- n = " << n << "\n";
std::cout << "<- p = " << p << "\n";
std::cout << "-> lcm(wf0, wf1) = " << eve::lcm(wf0, wf1) << "\n";
std::cout << "-> lcm[ignore_last(2)](wf0, wf1)= " << eve::lcm[eve::ignore_last(2)](wf0, wf1) << "\n";
std::cout << "-> lcm[wf0 != -2.0f](wf0, wf1) = " << eve::lcm[wf0 != -2.0f](wf0, wf1) << "\n";
std::cout << "-> lcm(p, n) = " << eve::lcm(p, n) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:320
Wrapper for SIMD registers.
Definition wide.hpp:94