kyosu v0.1.0
Complex Without Complexes
Loading...
Searching...
No Matches

◆ agd

auto kyosu::agd = eve::functor<agd_t>
inlineconstexpr

Computes the principal branch inverse gudermanian of the argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
// regular call
constexpr auto agd(cayley_dickson_like z) noexcept;
constexpr auto agd(cayley_dickson_like z, eve::value k) noexcept;
// semantic modifyers
constexpr auto agd[real_only](Real z) noexcept;
constexpr auto agd[radpi](cayley_dickson_like z) noexcept;
constexpr auto agd[rad](cayley_dickson_like z) noexcept;
}
constexpr auto k
Computes the complex number k i.e. quaternion(0, 0, 0, 1) in the chosen type.
Definition k.hpp:74
constexpr auto agd
Computes the principal branch inverse gudermanian of the argument.
Definition agd.hpp:90
Main KYOSU namespace.
Definition cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  • A real typed input z is treated as if complex(z) was entered, unless the option real_only is used in which case the parameter must be a floating_value and the result will the same as a call to eve::agd,
  • For complex input, returns \(\log(\tan(z/2 +\pi/4))\).
  • For two parameters returns the kth branch of agd. If k is not a flint it is truncated before use.
  • The radpi option provides a result expressed in \(\pi\) multiples.
Note
agd has branch cut discontinuities in \([\pi/2, 3\pi/2] + 2\pi n\) in the complex plane for integer \(n\). Morover, with real_only option the used formula is \(2*\mathbb{atan}(\tanh(z/2))\)

External references

Example

#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
using kyosu::agd;
std::cout << "Real: ";
std::cout << 72.9f << " -> " << agd(72.9f) << "\n";
std::cout << "Complex: ";
std::cout << kyosu::complex_t<float>(3.5f, -2.9f) << " -> " << agd(kyosu::complex_t<float>(3.5f, -2.9f)) << "\n";
std::cout << "Quaternion: ";
std::cout << kyosu::quaternion_t<double>(1., 2., 3., 4.) << " -> " << agd(kyosu::quaternion_t<double>(1., 2., 3., 4.))
<< "\n";
std::cout << "SIMD: ";
using wc_t = eve::wide<kyosu::complex_t<double>, eve::fixed<2>>;
std::cout << wc_t(kyosu::complex_t<double>(1.3, -3.7)) << " -> " << agd(wc_t(kyosu::complex_t<double>(1.3, -3.7)))
<< "\n";
return 0;
}
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition complex.hpp:27
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition quaternion.hpp:24