E.V.E  0.1-beta

◆ arg

eve::arg = {}
inlineconstexpr

Callable object computing the phase angle (in radians).

Required header: #include <eve/function/arg.hpp>

Members Functions

Member Effect
operator() the computation of the phase angle (in radians)
operator[] Construct a conditional version of current function object

template<floating_value T> auto operator()(T x) const noexcept;

Parameters

x: floating value.

Return value

For each element of the input the phase angle is returned:

If the input type is a floating real value:

  • if the bit of sign of the entry element is not set, \(0\) is returned.
  • if the bit of sign of the entry element is set, \(\pi\) is returned.

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::arg

Parameters

cond : conditional expression

Return value

A Callable object so that the expression arg[cond](x, ...) is equivalent to if_else(cond,arg(x, ...),x)


Supported decorators

  • eve::pedantic

    Required header: #include <eve/function/pedantic/arg.hpp>

    With this decorator the function returns a Nan element for each corresponding Nan entry element.

  • eve::diff, eve::diff_1st, eve::diff_nth

    Required header: #include <eve/function/diff/arg.hpp>

    The expression diff(arg)(x) computes the derivative of the function at x.

Example

See it live on Compiler Explorer

#include <eve/function/arg.hpp>
#include <eve/function/pedantic/arg.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, -0.0f, -1.0f, -2.0f, 2.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> arg(pf) = " << eve::arg(pf) << '\n'
<< "-> pedantic(eve::arg)(pf) = " << eve::pedantic(eve::arg)(pf) << '\n';
float xf = 1.0f;
float yf = eve::nan(eve::as<float>());
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> arg(xf) = " << eve::arg(xf) << '\n'
<< "<- yf = " << yf << '\n'
<< "-> arg(yf) = " << eve::arg(yf) << '\n'
<< "-> pedantic(eve::arg)(yf) = " << eve::pedantic(eve::arg)(yf) << '\n';
return 0;
}
constexpr callable_arg_ arg
Callable object computing the phase angle (in radians).
Definition: arg.hpp:88
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
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
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65