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

◆ complex

kyosu::complex = {}
inlineconstexpr

Constructs a kyosu::complex.

Defined in Header

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
template<eve::floating_ordered_value T> constexpr auto complex(T r, T i = 0) noexcept;
template<kyosu::concepts::complex T> constexpr T complex(T z) noexcept;
}
constexpr tags::callable_complex complex
Constructs a kyosu::complex.
Definition: to_complex.hpp:70
constexpr tags::callable_i i
Computes the complex number cinf i.e. complex(nan, inf) in the chosen type.
Definition: i.hpp:77
Main KYOSU namespace.
Definition: types.hpp:14

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: ";
std::cout << "complex(72.9f) -> " << complex(72.9f) << "\n";
std::cout << "Complex: ";
std::cout << "complex(3.5f, 2.9f) -> " << complex(3.5f,-2.9f) << "\n";
std::cout << "SIMD complex: ";
using w_t = eve::wide<double, eve::fixed<2>>;
w_t a(3.5f,-2.9f), b(1.0, -3.0);
std::cout << "complex(a, b) -> " << complex(a, b) << "\n";
return 0;
}