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

◆ lipart

kyosu::lipart = extractor<5>{}
inlineconstexpr

Extracts the \(li\) part of a value.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
constexpr decltype(auto) lipart(concepts::cayley_dickson auto&& v) noexcept; // 1
constexpr auto lipart(concepts::quaternion auto&& v) noexcept; // 2
constexpr auto lipart(concepts::complex auto&& v) noexcept; // 2
constexpr auto lipart(concepts::real auto&& v) noexcept; // 2
}
General Cayley-dickson concept.
Definition: concepts.hpp:19
Complex number concept.
Definition: concepts.hpp:36
Quaternion concept.
Definition: concepts.hpp:40
General real concept.
Definition: concepts.hpp:29
constexpr auto lipart
Extracts the part of a value.
Definition: parts.hpp:258
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • v: Original value.

Return value

  1. Returns a properly const-qualified reference to the \(li\) part of v.
  2. Returns T{0}.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "Real: ";
float f = 72.9f;
std::cout << f << " -> " << lipart(f) << "\n";
std::cout << "Complex: ";
auto z = kyosu::complex_t<float>(3.5f,-2.9f);
std::cout << z << " -> " << lipart(z) << "\n";
std::cout << "Quaternion: ";
auto q = kyosu::quaternion_t<double>(1.,2.,3.,4.);
std::cout << q << " -> " << lipart(q) << " => ";
std::cout << "octonion: ";
auto o = kyosu::octonion_t<double>(1.,2.,3.,4.,11.,12.,13.,14.);
std::cout << o << " -> " << lipart(q) << " => ";
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
as_cayley_dickson_n_t< 8, T > octonion_t
Type alias for octonion numbers.
Definition: octonion.hpp:23