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

◆ k

kyosu::k = eve::functor<k_t>
inlineconstexpr

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

Defined in Header

#include <kyosu/constants.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> constexpr auto k(as<T> z) noexcept;
template<eve::floating_ordered_value T> constexpr auto k(as<T> z) noexcept;
}
constexpr auto k
Computes the complex number k i.e. quaternion(0, 0, 0, 1) in the chosen type.
Definition: k.hpp:72
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::k;
using kyosu::as;
std::cout << "Real: \n";
std::cout << "k(kyosu::as(72.9f))" << " -> " << k(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 << "k(as(c) " << " -> " << k(as(c)) << "\n";
std::cout << "Quaternion: \n";
auto z = kyosu::quaternion_t<double>(1.,2.,3.,4.);
std::cout << "k(as(z) " << " -> " << k(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 << "k(as(wz)) " << " -> " << k(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