E.V.E
v2022.09.01

◆ arg

eve::arg = {}
inlineconstexpr

Callable object computing the phase angle (in radians).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T arg(T x) noexcept; //1
template< eve::floating_value T >
T arg(eve::as_complex<T> z) noexcept; //2
}
constexpr callable_arg_ arg
Callable object computing the phase angle (in radians).
Definition: arg.hpp:61
Definition: all_of.hpp:22

Parameters

x: real or complex argument.

Return value

Returns the elementwise the phase angle (in radians) of the input.

Example

Real version

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = { 0.0f, 1.0f, -1.0f, -0.5f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> eve::arg(pf) = " << eve::arg(pf) << '\n';
float xf = 1.0f;
float yf = eve::nan(eve::as<float>());
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::arg(xf) = " << eve::arg(xf) << '\n'
<< "<- yf = " << yf << '\n'
<< "-> eve::arg(yf) = " << eve::arg(yf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Complex version

#include <eve/module/complex.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft ref = { 0.0f, 1.0f, -1.0f, 0.5f};
wide_ft imf = { 2.0f , -1.0, -5.0, 0.0};
auto z = eve::as_complex_t<wide_ft>(ref, imf);
std::cout
<< "---- simd" << std::endl
<< "<- z = " << z << std::endl
<< "-> arg(z) = " << eve::arg(z) << std::endl;
return 0;
}