E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
hypot
auto eve::hypot =
functor
<hypot_t>
inline
constexpr
Header file
#include <eve/module/math.hpp>
Callable Signatures
namespace
eve
{
// Regular overloads
constexpr
auto
hypot
(
value
auto
x,
value
auto
... xs)
noexcept
;
// 1
constexpr
auto
hypot
(kumi::non_empty_product_type
auto
const
& tup)
noexcept
;
// 2
// Lanes masking
constexpr
auto
hypot
[
conditional_expr
auto
c](
/*any of the above overloads*/
)
noexcept
;
// 3
constexpr
auto
hypot
[
logical_value
auto
m](
/*any of the above overloads*/
)
noexcept
;
// 3
// Semantic options
constexpr
auto
hypot
[pedantic](
/*any of the above overloads*/
)
noexcept
;
// 4
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
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:132
eve::value
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition
value.hpp:34
eve::hypot
constexpr auto hypot
tuple_callable computing the norm of its inputs.
Definition
hypot.hpp:88
eve
EVE Main Namespace.
Definition
abi.hpp:18
Parameters
x
,
...xs
:
real
arguments.
tup
: non empty tuple of arguments.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
Returns \(\displaystyle\sqrt{\sum_1^n |x_i|^2}\). The result type is the
common value type
of the absolute values of the parameters.
equivalent to the call on the elements of the tuple.
The operation is performed conditionnaly
The pedantic option` computes the result without undue overflow or underflow at intermediate stages of the computation and can be more accurate than the regulard call.
External references
C++ standard reference
Wikipedia
Example
// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int
main()
{
eve::wide
pf = {-1.0, 2.0, -3.0,
eve::valmax
(
eve::as<double>
())};
eve::wide
qf = {-4.0, 3.0, -2.0,
eve::inf
(
eve::as<double>
())};
eve::wide
rf = {-40.0, 0.03, -2.0,
eve::nan
(
eve::as<double>
())};
kumi::tuple wt{pf, qf};
std::cout <<
"<- pf = "
<< pf <<
"\n"
;
std::cout <<
"<- qf = "
<< qf <<
"\n"
;
std::cout <<
"<- rf = "
<< rf <<
"\n"
;
std::cout <<
"<- wt = "
<< wt <<
"\n"
;
std::cout <<
"-> hypot(pf,qf) = "
<<
eve::hypot
(pf,qf) <<
"\n"
;
std::cout <<
"-> hypot(wt) = "
<<
eve::hypot
(wt) <<
"\n"
;
std::cout <<
"-> hypot[ignore_last(2)](pf,qf)= "
<<
eve::hypot
[
eve::ignore_last
(2)](pf,qf) <<
"\n"
;
std::cout <<
"-> hypot[pf > 0.0](pf,qf) = "
<<
eve::hypot
[pf > 0.0](pf,qf) <<
"\n"
;
std::cout <<
"-> hypot[pedantic](pf,qf) = "
<<
eve::hypot
[eve::pedantic](pf,qf) <<
"\n"
;
std::cout <<
"-> hypot(pf,qf,rf) = "
<<
eve::hypot
(pf,qf,rf) <<
"\n"
;
std::cout <<
"-> hypot[pedantic](pf,qf,rf) = "
<<
eve::hypot
[eve::pedantic](pf,qf,rf) <<
"\n"
;
}
eve::nan
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition
nan.hpp:67
eve::valmax
constexpr auto valmax
Computes the the greatest representable value.
Definition
valmax.hpp:66
eve::inf
constexpr auto inf
Computes the infinity ieee value.
Definition
inf.hpp:66
eve::as
Lightweight type-wrapper.
Definition
as.hpp:29
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:332
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:70
eve