Callable object computing the lpnorm operation \( \left(\sum_{i = 0}^n
|x_i|^p\right)^{\frac1p} \).
#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
int main()
{
wide_ft y = {-1.5f, 2.9f, 3.5f, -11.0f};
std::cout << "---- simd" << std::setprecision(5) << '\n'
<< "<- p = " << p << '\n'
<< "<- x = " << x << '\n'
<< "<- y = " << y << '\n'
<< "<- z = " << z << '\n'
<<
"-> lpnorm(p, x, y, z) = " <<
eve::lpnorm(p, x, y, z) <<
'\n'
;
double xf = 10.0;
double yf = 1.0;
double zf = 111.0;
double pf = 2.0;
std::cout << "---- scalar" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "<- zf = " << zf << '\n'
<<
"-> lpnorm(p, xf, yf, zf) = " <<
eve::lpnorm(pf, xf, yf, zf) <<
'\n'
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
constexpr pedantic_type const pedantic
Higher-order Callable Object imbuing more standard semantic onto other Callable Objects.
Definition: pedantic.hpp:56
constexpr callable_lpnorm_ lpnorm
Callable object computing the lpnorm operation .
Definition: lpnorm.hpp:55
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65