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

◆ lpnorm

eve::lpnorm = functor<lpnorm_t>
inlineconstexpr

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto lpnorm(floating_value auto p, floating_value auto x,floating_value auto... xs ) noexcept; // 1
// Lanes masking
constexpr auto lpnorm[conditional_expr auto c](loating_value auto p, floating_value auto x,floating_value auto... xs) noexcept; // 2
constexpr auto lpnorm[logical_value auto m](loating_value auto p, floating_value auto x,floating_value auto... xs) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition: conditional.hpp:27
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition: value.hpp:95
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition: value.hpp:107
constexpr auto lpnorm
strict_elementwise_callable object computing the lpnorm operation .
Definition: lpnorm.hpp:83
EVE Main Namespace.
Definition: abi.hpp:18

Parameters

  • p: floating value
  • x, ... xs: floating values
  • c: Conditional expression masking the operation.
  • m: Logical value masking the operation.

Return value

  1. \( \left(\sum_{i = 0}^n |x_i|^p\right)^{\frac1p} \).
  2. The operation is performed conditionnaly

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide x = {eve::nan(eve::as<float>()), 1.0f, 1.0f, 1.0f};
eve::wide y = {-1.5f, 2.9f, 3.5f, -11.0f};
eve::wide z = { eve::inf(eve::as(1.0f)), -2.0f, 1.0f, 15.0f};
eve::wide p = { 3.2f, 3.0f, 2.0f, eve::inf(eve::as(1.0f))};
std::cout << std::setprecision(5) << '\n';
std::cout << "<- p = " << p << '\n';
std::cout << "<- x = " << x << '\n';
std::cout << "<- y = " << y << '\n';
std::cout << "<- z = " << z << '\n';
std::cout << "-> lpnorm(p, x, y, z) = " << eve::lpnorm(p, x, y, z) << '\n';
std::cout << "-> lpnorm[pedantic](p, x, y, z) = " << eve::lpnorm[eve::pedantic](p, x, y, z) << '\n';
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition: nan.hpp:67
constexpr auto inf
Computes the infinity ieee value.
Definition: inf.hpp:66
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:71