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

◆ j

kyosu::j = eve::functor<j_t>
inlineconstexpr

Computes the complex number j i.e. quaternion(0, 0, 1, 0) in the chosen type.

Defined in Header

#include <kyosu/constants.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> auto j(as<T> z) noexcept;
template<eve::floating_ordered_value T> auto j(as<T> z) noexcept;
}
constexpr auto j
Computes the complex number j i.e. quaternion(0, 0, 1, 0) in the chosen type.
Definition: j.hpp:74
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  • always returns a cayley-dickson which has dimension at least 4 and value j such that all parts are null except the jpart whose value is one.

Example

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