E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
lpnorm
eve::lpnorm =
functor
<lpnorm_t>
inline
constexpr
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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition:
conditional.hpp:27
eve::floating_value
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition:
value.hpp:95
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:107
eve::lpnorm
constexpr auto lpnorm
strict_elementwise_callable object computing the lpnorm operation .
Definition:
lpnorm.hpp:83
eve
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
\( \left(\sum_{i = 0}^n |x_i|^p\right)^{\frac1p} \).
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'
;
}
eve::nan
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition:
nan.hpp:67
eve::inf
constexpr auto inf
Computes the infinity ieee value.
Definition:
inf.hpp:66
eve::as
Lightweight type-wrapper.
Definition:
as.hpp:29
eve::wide
Wrapper for SIMD registers.
Definition:
wide.hpp:71
eve