E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
lcm
eve::lcm = functor<lcm_t>
inline
constexpr
Callable Signatures
#include <eve/module/combinatorial.hpp>
Callable Signatures
namespace
eve
{
// Regular overload
template
<
int
egral_value T0,
int
egral_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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::integral_value
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:51
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::lcm
constexpr auto lcm
elementwise_callable object computing the least common multiple of the inputs.
Definition
lcm.hpp:77
eve::translate_t
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition
translation.hpp:107
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
p
,
n
:
integral values
.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
Returns the least common multiple of |p| and |n|.
The operation is performed conditionnaly
External references
Wikipedia: Greatest common divisor
C++ standard reference: gcd
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"
;
}
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:320
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve