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

◆ complex

kyosu::complex = eve::functor<make_complex_t>
inlineconstexpr

Constructs a kyosu::complex_t instance.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
constexpr auto complex(eve::floating_value auto r, eve::floating_value auto i = 0) noexcept;
constexpr T complex(kyosu::concepts::complex auto z) noexcept;
}
constexpr auto i
Computes the complex number in the chosen type.
Definition: i.hpp:69
constexpr auto complex
Constructs a kyosu::complex_t instance.
Definition: to_complex.hpp:75
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z : Complex value.
  • r, i : Real and imaginary part used to construct a kyosu::complex..

Return value

Returns a kyosu::complex constructed from its arguments.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "Real:\n";
std::cout << " complex(72.9f) -> " << kyosu::complex(72.9f) << "\n";
std::cout << "Complex:\n";
std::cout << " complex(3.5f, 2.9f) -> " << kyosu::complex(3.5f,-2.9f) << "\n";
std::cout << "SIMD real:\n";
eve::wide<double,eve::fixed<2>> w(3.5f,-2.9f);
std::cout << " complex(w) -> " << kyosu::complex(w) << "\n";
std::cout << "SIMD complex:\n";
eve::wide<double,eve::fixed<2>> wr(3.5f,-2.9f), wi(1.0, -3.0);
std::cout << " complex(wr, wi) -> " << kyosu::complex(wr, wi) << "\n";
std::cout << "Mixed complex:\n";
std::cout << " complex(wr , 9.5) -> " << kyosu::complex(wr, 9.5) << "\n";
std::cout << " complex(-6.3, wi) -> " << kyosu::complex(-6.3, wi) << "\n";
}