kyosu v0.1.0
Complex Without Complexes
 
Loading...
Searching...
No Matches
kyosu::cayley_dickson< Type, N > Class Template Reference

Cayley-Dickson algebra main abstraction It is built so that all operation over C, Q and other such algebra can be done in a streamlined fashion based on the Cayley–Dickson construction. More...

#include <kyosu/types/cayley_dickson.hpp>

Detailed Description

template<eve::floating_scalar_value Type, unsigned int N>
requires (N> 1 && std::has_single_bit(N))
class kyosu::cayley_dickson< Type, N >

Cayley-Dickson algebra main abstraction It is built so that all operation over C, Q and other such algebra can be done in a streamlined fashion based on the Cayley–Dickson construction.

Public Member Functions

constexpr cayley_dickson () noexcept
 Default Cayley-Dickson constructor.
 
template<unsigned int M>
requires (M > 1 && M == N/2) (N>1)
constexpr cayley_dickson (cayley_dickson< Type, M > const &a) noexcept
 Constructs a Cayley-Dickson instance from an Cayley-Dickson of smaller dimension.
 
template<unsigned int M>
requires (M > 1 && M == N/2)
constexpr cayley_dickson (cayley_dickson< Type, M > const &a, cayley_dickson< Type, M > const &b) noexcept
 Constructs a Cayley-Dickson instance by aggregating two Cayley-Dickson of smaller dimension.
 
constexpr cayley_dickson (kumi::sized_product_type< N > auto const &vs)
 Construct a Cayley-Dickson instance from a properly sized product_type.
 
template<std::convertible_to< Type > T>
constexpr cayley_dickson (T v) noexcept
 Construct a Cayley-Dickson from a real value.
 
template<std::convertible_to< Type > T0, std::convertible_to< Type >... Ts>
requires ( (1+sizeof...(Ts)) <= static_dimension )
constexpr cayley_dickson (T0 v0, Ts... vs) noexcept
 Construct a Cayley-Dickson instance from a sequences of real values.
 
KYOSU_FORCEINLINE auto & operator++ () noexcept
 Pre-incrementation operator.
 
KYOSU_FORCEINLINE auto operator++ (int) noexcept
 Post-incrementation operator.
 
KYOSU_FORCEINLINE auto & operator-- () noexcept
 Pre-decrementation operator.
 
KYOSU_FORCEINLINE auto operator-- (int) noexcept
 Post-decrementation operator.
 
template<concepts::cayley_dickson T>
requires (T::static_dimension<N)
constexpr cayley_dicksonoperator= (T const &a) noexcept
 Assign a smaller Cayley-Dickson to another.
 

Related Functions

(Note that these are not member functions.)

Deduction Guides
template<kumi::product_type Tuple>
 cayley_dickson (Tuple const &) -> cayley_dickson< kumi::element_t< 0, Tuple >, kumi::size_v< Tuple > >
 Deduction guide for constructing from product type.
 
template<typename T0 , std::convertible_to< T0 >... Ts>
 cayley_dickson (T0, Ts...) -> cayley_dickson< T0, 1+sizeof...(Ts)>
 Deduction guide for constructing from sequence of values.
 
Compound Assignment Operators
constexpr auto & operator+= (concepts::cayley_dickson auto &self, concepts::real auto other) noexcept
 Adds the real value other to self and returns the new value of self.
 
template<concepts::cayley_dickson Self, concepts::cayley_dickson Other>
constexpr auto & operator+= (Self &self, Other const &other) noexcept
 Adds the Cayley-dickson value other to self and returns the new value of self.
 
constexpr auto & operator-= (concepts::cayley_dickson auto &self, concepts::real auto other) noexcept
 Substracts the real value other from self and returns the new value of self.
 
template<concepts::cayley_dickson Self, concepts::cayley_dickson Other>
constexpr auto & operator-= (Self &self, Other const &other) noexcept
 Substracts the Cayley-dickson value other from self and returns the new value of self.
 
constexpr auto & operator*= (concepts::cayley_dickson auto &self, concepts::real auto other) noexcept
 Multiplies self by the real value other and returns the new value of self.
 
template<concepts::cayley_dickson Self, concepts::cayley_dickson Other>
constexpr Self & operator*= (Self &self, Other const &other) noexcept
 Multiplies self by the Cayley-dickson value other and returns the new value of self.
 
constexpr auto & operator/= (concepts::cayley_dickson auto &self, concepts::real auto other) noexcept
 Divides self by the real value other and returns the new value of self.
 
template<concepts::cayley_dickson Self, concepts::cayley_dickson Other>
constexpr Self & operator/= (Self &self, Other const &other) noexcept
 Divides self by the Cayley-dickson value other and returns the new value of self.
 
Streaming Operators
template<concepts::cayley_dickson CD>
std::ostream & operator<< (std::ostream &os, CD const &z)
 Stream insertion for Cayley-dickson based types.
 
User-defined Literals
constexpr kyosu::complex_t< double > operator""_i (long double d) noexcept
 Forms a kyosu::complex_t<double> with real part zero and imaginary part d
 
constexpr kyosu::complex_t< float > operator""_if (long double d) noexcept
 Forms a kyosu::complex_t<float> with real part zero and imaginary part d
 
constexpr kyosu::quaternion_t< double > operator""_j (long double d) noexcept
 Forms a kyosu::quaternion_t<double> with all parts zero and \(j\) part equals to d
 
constexpr kyosu::quaternion_t< float > operator""_jf (long double d) noexcept
 Forms a kyosu::quaternion_t<float> with all parts zero and \(j\) part equals to d
 
constexpr kyosu::quaternion_t< double > operator""_k (long double d) noexcept
 Forms a kyosu::quaternion_t<double> with all parts zero and \(k\) part equals to d
 
constexpr kyosu::quaternion_t< float > operator""_kf (long double d) noexcept
 Forms a kyosu::quaternion_t<float> with all parts zero and \(k\) part equals to d
 
Unary Operators
template<concepts::cayley_dickson Z>
constexpr auto operator+ (Z const &z) noexcept
 Identity for Cayley-Dickson value.
 
template<concepts::cayley_dickson Z>
constexpr auto operator- (Z const &z) noexcept
 Compute the negation of a given Cayley-Dickson value.
 
Binary Operators
template<eve::value T1, eve::value T2>
as_cayley_dickson_t< T1, T2 > operator+ (T1 const &a, T2 const &b) noexcept
 Returns the sum of a Cayley-Dickson value and a real value in any order.
 
template<eve::value T1, eve::value T2>
as_cayley_dickson_t< T1, T2 > operator- (T1 const &a, T2 const &b) noexcept
 Returns the difference of two Cayley-Dickson values.
 
template<eve::value T1, eve::value T2>
as_cayley_dickson_t< T1, T2 > operator* (T1 const &a, T2 const &b) noexcept
 Returns the product of two Cayley-Dickson values.
 
template<eve::value T1, eve::value T2>
as_cayley_dickson_t< T1, T2 > operator/ (T1 const &a, T2 const &b) noexcept
 Returns the ration of two Cayley-Dickson values.
 
template<concepts::cayley_dickson T1, concepts::real T2>
constexpr auto operator== (T1 const &a, T2 b)
 Compares a Cayley-Dickson value and a real for equality.
 
template<concepts::real T1, concepts::cayley_dickson T2>
constexpr auto operator== (T1 const &a, T2 b)
 Compares a real and a Cayley-Dickson value for equality.