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

◆ hypot

auto eve::hypot = functor<hypot_t>
inlineconstexpr

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
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto hypot
tuple_callable computing the norm of its inputs.
Definition hypot.hpp:88
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. Returns \(\displaystyle\sqrt{\sum_1^n |x_i|^2}\). The result type is the common value type of the absolute values of the parameters.
  2. equivalent to the call on the elements of the tuple.
  3. The operation is performed conditionnaly
  4. 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

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";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto valmax
Computes the the greatest representable value.
Definition valmax.hpp:66
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:66
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:86