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

◆ cinf

kyosu::cinf = eve::functor<cinf_t>
inlineconstexpr

Computes the complex-infinite defined as \(\textrm{NaN} + i\, \textrm{inf}\) in the chosen type.

Defined in Header

#include <kyosu/constants.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> constexpr as_complex_t<eve::as_floating_point_t<T>> cinf(as<T> z) noexcept;
template<kyosu::real T> constexpr as_complex_t<eve::as_floating_point_t<T>> cinf(as<T> z) noexcept;
}
constexpr auto cinf
Computes the complex-infinite defined as in the chosen type.
Definition: cinf.hpp:77
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  • always returns a cayley_dickson value such that real(i) is a NaN and imag(i) is \(+\infty\) (the remaining parts being 0). This is meant to represent a quantity with infinite magnitude, but undetermined complex phase.

External references

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::as;
std::cout << "Real: \n";
auto cinf = kyosu::cinf(kyosu::as(72.9f));
std::cout << "cinf = " << cinf << "\n";
std::cout << "rec(cinf) = " << kyosu::rec(cinf) << std::endl;
std::cout << "1.0f/cinf = " << 1.0/cinf << std::endl;
std::cout << 1.0f/kyosu::complex_t<float>(0.0, 0.0) << std::endl;
std::cout << "kyosu::abs(cinf) " << kyosu::abs(cinf) << std::endl;
std::cout << "kyosu::arg(cinf) " << kyosu::arg(cinf) << std::endl;
std::cout << "Complex: \n";
auto c = kyosu::complex_t<float>(3.5f,-2.9f);
std::cout << "c = " << c << std::endl;
std::cout << "cinf(as(c)) " << " -> " << kyosu::cinf(as(c)) << "\n";
std::cout << c/kyosu::complex_t<float>(0.0, 0.0) << std::endl;
std::cout << c/0.0f << std::endl;
std::cout << "Quaternion: \n";
auto z = kyosu::quaternion_t<double>(1.,2.,3.,4.);
std::cout << "cinf(as(z)) " << " -> " << kyosu::cinf(as(z)) << "\n";
std::cout << "SIMD: ";
using wc_t = eve::wide<kyosu::complex_t<double>, eve::fixed<2>>;
auto wz = wc_t(complex_t<double>(1.3,-3.7));
std::cout << "cinf(as(wz)) " << " -> " << kyosu::cinf(as(wz)) << "\n";
return 0;
}
constexpr auto rec
Computes the inverse of the argument.
Definition: rec.hpp:67
constexpr auto arg
argument.
Definition: arg.hpp:70
constexpr auto abs
Computes the absolute value of the parameter.
Definition: abs.hpp:78
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:24
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27