◆ lpnorm
Callable object computing the lpnorm operation \( \left(\sum_{i = 0}^n |x_i|^p\right)^{\frac1p} \). Required header: Members Functions
template< floating_value P, floating_value T, floating_value ...Ts> auto operator()( T x,Ts... args ) const noexcept
requires (compatiblevalues< P, T, Ts > && ...);
Definition: value.hpp:83 Parameters
Return value The result type is the common compatible type of the parameters. auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::lpnorm Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/lpnorm.hpp>
#include <eve/function/pedantic/lpnorm.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float, eve::fixed<4>>;
int main()
{
wide_ft x = {eve::nan(eve::as<float>()), 1.0f, 1.0f, 1.0f};
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'
double xf = 10.0;
double yf = 1.0;
double zf = 111.0;
double pf = 2.0; //eve::inf(eve::as(xf));
std::cout << "---- scalar" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "<- zf = " << zf << '\n'
return 0;
}
constexpr callable_inf_ inf Callable object computing the infinity ieee value. Definition: inf.hpp:54 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:90 |