Loading [MathJax]/extensions/tex2jax.js
kyosu v0.1.0
Complex Without Complexes
 
All Classes Namespaces Functions Variables Typedefs Modules Pages Concepts
Loading...
Searching...
No Matches

◆ arg

kyosu::arg = eve::functor<arg_t>
inlineconstexpr

argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson_like T> constexpr as_real_type_t<Z> arg(T z) noexcept; //3
}
constexpr auto arg
argument.
Definition: arg.hpp:62
typename as_real_type< T >::type as_real_type_t
Compute the real type associated to a Cayley-Dickson-like type.
Definition: traits.hpp:80
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  • For floating value input, returns \(0\) or \(\pi\) according to the non negativity of z (arg of minus zero is \(\pi\)).
  • For complex value input, returns elementwise the argument of the complex number i.e. eve::atan2[pedantic](imag(z),real(z)).
  • For general cayley_dickson, returns \(\mathrm{atan2}(\mathrm{sign}(z_1)|\underline{z}|, z_0)\) where \(z_0\) is the real part of \(z\), \(z_1\) is the ipart of \(z\) and \(\underline{z}\) the pure part of \(z\).

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using wide_ft = eve::wide <float, eve::fixed<4>>;
wide_ft ref1 = { 3.0f, 2.0f, 1.0f, 0.5f};
wide_ft imf1 = { 2.0f , -1.0, -5.0, 0.0};
wide_ft ref2 = { 0.0, -1.0, 2.0, eve::nan(eve::as<double>())};
auto zc = kyosu::complex_t<wide_ft>(ref1, imf1);
std::cout
<< "---- simd" << std::endl
<< "<- zc = " << zc << std::endl
<< "<- ref2 = " << ref2 << std::endl
<< "-> arg(zc) = " << kyosu::arg(zc)<< std::endl
<< "-> arg(ref2) = " << kyosu::arg(ref2) << std::endl
<< "-> arg(kyosu::cinf(eve::as<double>()) = " << kyosu::arg(kyosu::cinf(eve::as<double>())) << std::endl
<< "-> arg(kyosu::zero(kyosu::as(zc))) = " << kyosu::arg(kyosu::zero(kyosu::as(zc))) << std::endl;
return 0;
}
constexpr auto cinf
Computes the complex-infinite defined as in the chosen type.
Definition: cinf.hpp:77
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27