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

◆ i

kyosu::i = eve::functor<i_t>
inlineconstexpr

Computes the complex number \(i\) in the chosen type.

Defined in Header

#include <kyosu/constants.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> constexpr T i(as<T> t) noexcept;
template<kyosu::real T> constexpr as_complex_t<eve::as_floating_point_t<T>> i(as<T> t) noexcept;
}
constexpr auto i
Computes the complex number in the chosen type.
Definition: i.hpp:69
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • t : Type wrapper instance embedding the type of the constant.

Return value

A kyosu::complex value z such that real(z) is 0 and imag(z) is 1.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::i;
using kyosu::as;
std::cout << "Real: \n";
std::cout << "i(kyosu::as(72.9f))" << " -> " << i(as(72.9f)) << "\n";
std::cout << "Complex: \n";
auto c = kyosu::complex_t<float>(3.5f,-2.9f);
std::cout << "c = " << c << std::endl;
std::cout << "i(as(c) " << " -> " << i(as(c)) << "\n";
std::cout << "Quaternion: \n";
auto z = kyosu::quaternion_t<double>(1.,2.,3.,4.);
std::cout << "i(as(z) " << " -> " << i(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 << "i(as(wz)) " << " -> " << i(as(wz)) << "\n";
return 0;
}
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