diff --git a/doc/index.md b/doc/index.md index 386c16d7..79a448e4 100644 --- a/doc/index.md +++ b/doc/index.md @@ -141,8 +141,10 @@ complex functions and rotation related quaternion usage. | [cospi](@ref kyosu::cospi ) | [cot](@ref kyosu::cot ) | [cotpi](@ref kyosu::cotpi ) | [coth](@ref kyosu::coth ) | [convert](@ref kyosu::convert ) | | [csc](@ref kyosu::csc ) | [cscpi](@ref kyosu::cscpi ) | [csch](@ref kyosu::csch ) | [dec](@ref kyosu::dec ) | [dist](@ref kyosu::dist ) | | [dot](@ref kyosu::dot ) | [exp](@ref kyosu::exp ) | [exp10](@ref kyosu::exp10 ) | [exp2](@ref kyosu::exp2 ) | [exp_i](@ref kyosu::exp_i ) | - | [exp_ipi](@ref kyosu::exp_ipi ) | [expm1](@ref kyosu::expm1 ) | [expmx2](@ref kyosu::expmx2 ) | [expx2](@ref kyosu::expx2 ) | [floor](@ref kyosu::floor ) | - | [frac](@ref kyosu::frac ) | [from_polar](@ref kyosu::from_polar ) | [hypot](@ref kyosu::hypot ) | [if_else](@ref kyosu::if_else )| [inc](@ref kyosu::inc ) | + | [exp_ipi](@ref kyosu::exp_ipi ) | [expm1](@ref kyosu::expm1 ) | [expmx2](@ref kyosu::expmx2 ) | [expx2](@ref kyosu::expx2 ) | [fam](@ref kyosu::fam ) | + | [floor](@ref kyosu::floor ) | [fma](@ref kyosu::fma ) | [fms](@ref kyosu::fms ) | [fnma](@ref kyosu::fnma ) | [fnms](@ref kyosu::fnms ) | + | [frac](@ref kyosu::frac ) | [fsm](@ref kyosu::fsm ) | [from_polar](@ref kyosu::from_polar ) | [horner](@ref kyosu::horner ) | [hypot](@ref kyosu::hypot ) | + | [if_else](@ref kyosu::if_else ) | [inc](@ref kyosu::inc ) |||| | [ipart](@ref kyosu::ipart ) | [is_denormal](@ref kyosu::is_denormal ) | [is_equal](@ref kyosu::is_equal ) | [is_eqz](@ref kyosu::is_eqz ) | [is_finite](@ref kyosu::is_finite ) | | [is_infinite](@ref kyosu::is_infinite ) | [is_imag](@ref kyosu::is_imag ) | [is_nan](@ref kyosu::is_nan ) | [is_nez](@ref kyosu::is_nez ) | [is_not_denormal](@ref kyosu::is_not_denormal ) | | [is_not_equal](@ref kyosu::is_not_equal ) | [is_not_finite](@ref kyosu::is_not_finite ) | [is_not_infinite](@ref kyosu::is_not_finite ) | [is_not_nan](@ref kyosu::is_not_nan ) | [is_not_real](@ref kyosu::is_not_real ) | @@ -152,7 +154,8 @@ complex functions and rotation related quaternion usage. | [lpart](@ref kyosu::lpart ) | [lipart](@ref kyosu::lipart ) | [ljpart](@ref kyosu::ljpart ) | [lkpart](@ref kyosu::lkpart ) | | | [nearest](@ref kyosu::nearest ) | [oneminus](@ref kyosu::oneminus ) | [pow](@ref kyosu::pow ) | [pow1p](@ref kyosu::pow1p ) | [pow_abs](@ref kyosu::pow_abs ) | | [powm1](@ref kyosu::powm1 ) | [proj](@ref kyosu::proj ) | [pure](@ref kyosu::imag ) | [radinpi](@ref kyosu::radinpi )| [real](@ref kyosu::real ) | - | [rec](@ref kyosu::rec ) | [reldist](@ref kyosu::reldist ) | [sec](@ref kyosu::sec ) | [secpi](@ref kyosu::secpi ) | [sech](@ref kyosu::sech ) | + | [rec](@ref kyosu::rec ) | [reldist](@ref kyosu::reldist ) | [reverse_horner](@ref kyosu::reverse_horner ) | [right_horner](@ref kyosu::right_horner ) | [right_reverse_horner](@ref kyosu::right_reverse_horner ) | + | [sec](@ref kyosu::sec ) | [secpi](@ref kyosu::secpi ) | [sech](@ref kyosu::sech ) | | | | [sign](@ref kyosu::sign ) | [sin](@ref kyosu::sin ) | [sinc](@ref kyosu::sinc ) | [sincos](@ref kyosu::sincos ) | [sinpi](@ref kyosu::sinpi ) | | [sinpicospi](@ref kyosu::sinpicospi ) | [sinh](@ref kyosu::sinh ) | [sinhcosh](@ref kyosu::sinhcosh ) | [slerp](@ref kyosu::slerp ) | [sqr](@ref kyosu::sqr ) | | [sqr_abs](@ref kyosu::sqr_abs ) | [sqrt](@ref kyosu::sqrt ) | [tan](@ref kyosu::tan ) | [tanpi](@ref kyosu::tanpi ) | [tanh](@ref kyosu::tanh ) | diff --git a/include/kyosu/complex/beta.hpp b/include/kyosu/complex/beta.hpp index 34818d2a..12813f9a 100644 --- a/include/kyosu/complex/beta.hpp +++ b/include/kyosu/complex/beta.hpp @@ -66,7 +66,7 @@ namespace kyosu //! **Return value** //! //! 1. If x and y are real typed values returns \f$\displaystyle \mathbf{B}(x,y) = \int_0^1 t^{x-1}(1-t)^{y-1}\mbox{d}t\f$ -//! 2. The complex value \f$\displaystyle \mathbb{B}(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\f$ is returned. +//! 2. if x or y is complex the value \f$\displaystyle \mathbf{B}(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\f$ is returned. //! //! @groupheader{Example} //! diff --git a/include/kyosu/complex/log_abs_gamma.hpp b/include/kyosu/complex/log_abs_gamma.hpp index 269f3eca..5e6fc7c1 100644 --- a/include/kyosu/complex/log_abs_gamma.hpp +++ b/include/kyosu/complex/log_abs_gamma.hpp @@ -55,8 +55,8 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constexpr T log_abs_gamma(T z) noexcept; -//! template constexpr T log_abs_gamma(T z) noexcept; +//! template constexpr T log_abs_gamma(T z) noexcept; +//! template constexpr as_real_t log_abs_gamma(T z) noexcept; //! } //! @endcode //! @@ -66,7 +66,7 @@ namespace kyosu //! //! **Return value** //! -//! Returns \f$\log(|\Gamma(z)|)\f$. If z is floating the result is as if complex(z) was used in the call. +//! Returns \f$\log(|\Gamma(z)|)\f$. //! //! @groupheader{Example} //! diff --git a/include/kyosu/complex/log_gamma.hpp b/include/kyosu/complex/log_gamma.hpp index e7f00c14..b9955865 100644 --- a/include/kyosu/complex/log_gamma.hpp +++ b/include/kyosu/complex/log_gamma.hpp @@ -53,8 +53,8 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constexpr T log_gamma(T z) noexcept; -//! template constexpr T log_gamma(T z) noexcept; +//! template constexpr auto log_gamma(T z) noexcept; +//! template constexpr auto log_gamma(T z) noexcept; //! } //! @endcode //! diff --git a/include/kyosu/complex/tgamma.hpp b/include/kyosu/complex/tgamma.hpp index 79d4944a..ac51cedf 100644 --- a/include/kyosu/complex/tgamma.hpp +++ b/include/kyosu/complex/tgamma.hpp @@ -41,7 +41,7 @@ namespace kyosu //! @addtogroup functions //! @{ //! @var tgamma -//! @brief Computes the tgammaolute value of the parameter. +//! @brief Computes \f$\Gamma(z)\f$r. //! //! **Defined in Header** //! @@ -54,7 +54,7 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constexpr T tgamma(T z) noexcept; +//! template constexpr T tgamma(T z) noexcept; //! template constexpr T tgamma(T z) noexcept; //! } //! @endcode diff --git a/include/kyosu/functions.hpp b/include/kyosu/functions.hpp index 2be2f76e..4a3cfbeb 100644 --- a/include/kyosu/functions.hpp +++ b/include/kyosu/functions.hpp @@ -57,10 +57,17 @@ #include #include #include +#include #include +#include +#include +#include +#include #include #include +#include #include +#include #include #include #include @@ -96,8 +103,14 @@ #include #include #include +#include +#include +#include +#include #include #include +#include +#include #include #include #include @@ -108,7 +121,10 @@ #include #include #include +#include +#include #include +#include #include #include #include diff --git a/include/kyosu/functions/abs.hpp b/include/kyosu/functions/abs.hpp index be9b4b0b..6d9abbbb 100644 --- a/include/kyosu/functions/abs.hpp +++ b/include/kyosu/functions/abs.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_abs : eve::elementwise + struct callable_abs: eve::elementwise { using callable_tag_type = callable_abs; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acos.hpp b/include/kyosu/functions/acos.hpp index c2c7c900..a68fe7b8 100644 --- a/include/kyosu/functions/acos.hpp +++ b/include/kyosu/functions/acos.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acos : eve::elementwise + struct callable_acos: eve::elementwise { using callable_tag_type = callable_acos; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acosh.hpp b/include/kyosu/functions/acosh.hpp index 85c96256..bdf2bf48 100644 --- a/include/kyosu/functions/acosh.hpp +++ b/include/kyosu/functions/acosh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acosh : eve::elementwise + struct callable_acosh: eve::elementwise { using callable_tag_type = callable_acosh; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! @@ -76,9 +76,9 @@ namespace kyosu //! in the interval \f$[0,\pi]\f$ along the real axis. //! //! * for every z: kyosu::acosh( [kyosu::conj](@ref kyosu::conj)(z)) == kyosu::conj([kyosu::acosh](@ref kyosu::acosh)(z) -//! * If z is \f$\pm0\f$, the result is \f$+0,\pi/2\f$ +//! * If z is \f$\pm0\f$, the result is \f$+0+i\pi/2\f$ //! * If z is \f$x+i\infty\f$ (for any finite x), the result is \f$\infty+i\pi/2\f$ -//! * If z is \f$x+i NaN\f$ (for any finite non zero x), the result is \f$NaN+i NaN\f$. +//! * If z is \f$x+i NaN\f$ (for any finite non zero x), the result is \f$NaN+iNaN\f$. //! * If z is \f$i NaN\f$ the result is \f$NaN+i\pi/2\f$. //! * If z is \f$-\infty,y\f$ (for any positive finite y), the result is \f$+\infty,\pi\f$ //! * If z is \f$+\infty,y\f$ (for any positive finite y), the result is \f$+\infty+i 0\f$ diff --git a/include/kyosu/functions/acospi.hpp b/include/kyosu/functions/acospi.hpp index e6bed903..23abd6c7 100644 --- a/include/kyosu/functions/acospi.hpp +++ b/include/kyosu/functions/acospi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_acospi : eve::elementwise + struct callable_acospi: eve::elementwise { using callable_tag_type = callable_acospi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acot.hpp b/include/kyosu/functions/acot.hpp index 12d81282..23648834 100644 --- a/include/kyosu/functions/acot.hpp +++ b/include/kyosu/functions/acot.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acot : eve::elementwise + struct callable_acot: eve::elementwise { using callable_tag_type = callable_acot; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acoth.hpp b/include/kyosu/functions/acoth.hpp index 3d16ddc3..17c66f1b 100644 --- a/include/kyosu/functions/acoth.hpp +++ b/include/kyosu/functions/acoth.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acoth : eve::elementwise + struct callable_acoth: eve::elementwise { using callable_tag_type = callable_acoth; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! @@ -75,7 +75,7 @@ namespace kyosu //! //! 3. Returns \f$(\log(z+1)-\log(z-1))/2 \f$. //! -///! @groupheader{Example} +//! @groupheader{Example} //! //! @godbolt{doc/acoth.cpp} //! @} diff --git a/include/kyosu/functions/acotpi.hpp b/include/kyosu/functions/acotpi.hpp index dc0bbb6a..f1f888cb 100644 --- a/include/kyosu/functions/acotpi.hpp +++ b/include/kyosu/functions/acotpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_acotpi : eve::elementwise + struct callable_acotpi: eve::elementwise { using callable_tag_type = callable_acotpi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acsc.hpp b/include/kyosu/functions/acsc.hpp index 5bab3e21..9c7e7908 100644 --- a/include/kyosu/functions/acsc.hpp +++ b/include/kyosu/functions/acsc.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acsc : eve::elementwise + struct callable_acsc: eve::elementwise { using callable_tag_type = callable_acsc; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acsch.hpp b/include/kyosu/functions/acsch.hpp index 39ad4a3e..4017e888 100644 --- a/include/kyosu/functions/acsch.hpp +++ b/include/kyosu/functions/acsch.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_acsch : eve::elementwise + struct callable_acsch: eve::elementwise { using callable_tag_type = callable_acsch; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acscpi.hpp b/include/kyosu/functions/acscpi.hpp index f6360f32..c9f57af1 100644 --- a/include/kyosu/functions/acscpi.hpp +++ b/include/kyosu/functions/acscpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_acscpi : eve::elementwise + struct callable_acscpi: eve::elementwise { using callable_tag_type = callable_acscpi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/acsh.hpp b/include/kyosu/functions/acsh.hpp index f205f121..57cf38b1 100644 --- a/include/kyosu/functions/acsh.hpp +++ b/include/kyosu/functions/acsh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_acsch : eve::elementwise + struct callable_acsch: eve::elementwise { using callable_tag_type = callable_acsch; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/align.hpp b/include/kyosu/functions/align.hpp index 1c831a9e..bbdeed52 100644 --- a/include/kyosu/functions/align.hpp +++ b/include/kyosu/functions/align.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_align : eve::elementwise + struct callable_align: eve::elementwise { using callable_tag_type = callable_align; @@ -93,20 +93,20 @@ namespace kyosu //! @code //! namespace kyosu //! { - //! auto align(auto angle, auto axis, auto norming = normalize) const noexcept; + //! auto align(auto v1, auto v2, auto norming = normalize) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! * `v0` : span of 3 elements - //! * `v1` : span of 3 elements - //! * normalize : can be assume_normalized or normalize. In the second case axis is normalized. - //! if axis is already normalized use assume_normalized is more efficient. + //! * `v0`: span of 3 elements + //! * `v1`: span of 3 elements + //! * normalize: can be assume_normalized or normalize. In the second case axis is normalized. + //! if axis is already normalized use of assume_normalized is more efficient. //! //! **Return value** //! - //! An unitaryquaternion value representing a rotation that align v0 to v1. + //! An unitary quaternion value representing a rotation that align v0 to v1. //! //! If v0 or v1 is a nullvector the result is UB //! diff --git a/include/kyosu/functions/arg.hpp b/include/kyosu/functions/arg.hpp index c92d96fb..f410bea1 100644 --- a/include/kyosu/functions/arg.hpp +++ b/include/kyosu/functions/arg.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_arg : eve::elementwise + struct callable_arg: eve::elementwise { using callable_tag_type = callable_arg; @@ -61,12 +61,12 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! -//! 1. Returns 0 or pi acording to the non negativity of z. -//! 2. Returns elementwise the argument of the complex number i.e. eve::atan2([kyosu::imag(z)](@ref kyosu::imag )(z), [kyosu::real(z)](@ref kyosu::real )(z)). +//! 1. Returns 0 or pi according to the non negativity of z. +//! 2. Returns elementwise the argument of the complex number i.e. eve::atan2([kyosu::imag](@ref kyosu::imag )(z), [kyosu::real](@ref kyosu::real )(z)). //! 3. Returns \f$\mathrm{atan2}(\mathrm{sign}(z_1)|\underline{z}|, z_0)\f$ where \f$z_0\f$ is the real part of \f$z\f$, \f$z_1\f$ is the ipart of \f$z\f$ and //! \f$\underline{z}\f$ the [pure](@ref kyosu::imag ) part of \f$z\f$. //! diff --git a/include/kyosu/functions/asec.hpp b/include/kyosu/functions/asec.hpp index 7dc0f78e..2c87a2cc 100644 --- a/include/kyosu/functions/asec.hpp +++ b/include/kyosu/functions/asec.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_asec : eve::elementwise + struct callable_asec: eve::elementwise { using callable_tag_type = callable_asec; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/asech.hpp b/include/kyosu/functions/asech.hpp index 7a507173..7a221f4d 100644 --- a/include/kyosu/functions/asech.hpp +++ b/include/kyosu/functions/asech.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_asech : eve::elementwise + struct callable_asech: eve::elementwise { using callable_tag_type = callable_asech; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/asecpi.hpp b/include/kyosu/functions/asecpi.hpp index 805218ef..f4a9e3dc 100644 --- a/include/kyosu/functions/asecpi.hpp +++ b/include/kyosu/functions/asecpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_asecpi : eve::elementwise + struct callable_asecpi: eve::elementwise { using callable_tag_type = callable_asecpi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/asin.hpp b/include/kyosu/functions/asin.hpp index 9f930f5e..6a4ef500 100644 --- a/include/kyosu/functions/asin.hpp +++ b/include/kyosu/functions/asin.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_asin : eve::elementwise + struct callable_asin: eve::elementwise { using callable_tag_type = callable_asin; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/asinh.hpp b/include/kyosu/functions/asinh.hpp index 3fe2e72a..928ef8ea 100644 --- a/include/kyosu/functions/asinh.hpp +++ b/include/kyosu/functions/asinh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_asinh : eve::elementwise + struct callable_asinh: eve::elementwise { using callable_tag_type = callable_asinh; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/asinpi.hpp b/include/kyosu/functions/asinpi.hpp index 6461a273..d7caae13 100644 --- a/include/kyosu/functions/asinpi.hpp +++ b/include/kyosu/functions/asinpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_asinpi : eve::elementwise + struct callable_asinpi: eve::elementwise { using callable_tag_type = callable_asinpi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/associator.hpp b/include/kyosu/functions/associator.hpp index dee7660b..f1e2ddb5 100644 --- a/include/kyosu/functions/associator.hpp +++ b/include/kyosu/functions/associator.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_associator : eve::elementwise + struct callable_associator: eve::elementwise { using callable_tag_type = callable_associator; @@ -55,7 +55,7 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto associator(auto z0, auto, z1, auto, z2) noexcept; +//! constexpr auto associator(auto z0, auto z1, auto z2) noexcept; //! } //! @endcode //! diff --git a/include/kyosu/functions/atan.hpp b/include/kyosu/functions/atan.hpp index 77c514a3..469ccb30 100644 --- a/include/kyosu/functions/atan.hpp +++ b/include/kyosu/functions/atan.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_atan : eve::elementwise + struct callable_atan: eve::elementwise { using callable_tag_type = callable_atan; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/atanh.hpp b/include/kyosu/functions/atanh.hpp index 2db9b46a..d3444eaf 100644 --- a/include/kyosu/functions/atanh.hpp +++ b/include/kyosu/functions/atanh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_atanh : eve::elementwise + struct callable_atanh: eve::elementwise { using callable_tag_type = callable_atanh; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/atanpi.hpp b/include/kyosu/functions/atanpi.hpp index 2e779242..f7aa25a2 100644 --- a/include/kyosu/functions/atanpi.hpp +++ b/include/kyosu/functions/atanpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_atanpi : eve::elementwise + struct callable_atanpi: eve::elementwise { using callable_tag_type = callable_atanpi; @@ -63,7 +63,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/average.hpp b/include/kyosu/functions/average.hpp index b59b70e5..e48e76c1 100644 --- a/include/kyosu/functions/average.hpp +++ b/include/kyosu/functions/average.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_average : eve::elementwise + struct callable_average: eve::elementwise { using callable_tag_type = callable_average; @@ -18,15 +18,15 @@ namespace kyosu::tags static KYOSU_FORCEINLINE auto deferred_call(auto , eve::floating_ordered_value auto const& v0 - , eve::floating_ordered_value auto const& v1) noexcept + , eve::floating_ordered_value auto const& ...v1) noexcept { - return eve::average(v0, v1); + return eve::average(v0, v1...); } - KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1) const noexcept - -> decltype(eve::tag_invoke(*this, target0, target1)) + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& ...target1) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1...)) { - return eve::tag_invoke(*this, target0, target1); + return eve::tag_invoke(*this, target0, target1...); } template @@ -41,7 +41,7 @@ namespace kyosu //! @addtogroup functions //! @{ //! @var average -//! @brief Computes the average of the two parameters. +//! @brief Computes the average of the parameters. //! //! **Defined in Header** //! @@ -54,17 +54,17 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto average(auto z0, auto, z1) noexcept; +//! constexpr auto average(auto z0, auto... z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Value to process. Can be a mix of complex and real floating values and complex values. +//! * `z0`, `z1...`: Values to process. Can be a mix of complex and real floating values and complex values. //! //! **Return value** //! -//! Returns the arithmetic mean of the two arguments. +//! Returns the arithmetic mean of the arguments. //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/ceil.hpp b/include/kyosu/functions/ceil.hpp index 0829dba5..380d431f 100644 --- a/include/kyosu/functions/ceil.hpp +++ b/include/kyosu/functions/ceil.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_ceil : eve::elementwise + struct callable_ceil: eve::elementwise { using callable_tag_type = callable_ceil; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value for which ceil is computed. +//! * `z`: Value for which ceil is computed. //! //! **Return value** //! diff --git a/include/kyosu/functions/commutator.hpp b/include/kyosu/functions/commutator.hpp index 1662c63f..9c99a110 100644 --- a/include/kyosu/functions/commutator.hpp +++ b/include/kyosu/functions/commutator.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_commutator : eve::elementwise + struct callable_commutator: eve::elementwise { using callable_tag_type = callable_commutator; @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto commutator(auto z0, auto, z1) noexcept; +//! constexpr auto commutator(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0`, `z1` : Values to process. Can be a mix of complex and real floating values and complex values. +//! * `z0`, `z1`: Values to process. Can be a mix of complex and real floating values and complex values. //! //! **Return value** //! diff --git a/include/kyosu/functions/conj.hpp b/include/kyosu/functions/conj.hpp index e4e42dec..01ffcca2 100644 --- a/include/kyosu/functions/conj.hpp +++ b/include/kyosu/functions/conj.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_conj : eve::elementwise + struct callable_conj: eve::elementwise { using callable_tag_type = callable_conj; @@ -58,11 +58,11 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to conjugate. +//! * `z`: Value to conjugate. //! //! **Return value** //! -//! Returns the conjugate of its argument. i.e. the value with the same real part +//! Returns the conjugate of its argument. i.e. the value with the same [real](@ref kyosu::real ) part //! and the opposite [pure](@ref kyosu::imag ) part. //! //! For real inputs the call reduces to identity. diff --git a/include/kyosu/functions/convert.hpp b/include/kyosu/functions/convert.hpp index 28561ea8..4e3cb7c3 100644 --- a/include/kyosu/functions/convert.hpp +++ b/include/kyosu/functions/convert.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_convert : eve::elementwise + struct callable_convert: eve::elementwise { using callable_tag_type = callable_convert; @@ -59,9 +59,12 @@ namespace kyosu //! } //! @endcode //! -//! **Parameters** +//! **Parameter** //! //! * `x`: floating or Cayley Dickinson value to process. +//! +//! **Template Parameter** +//! //! * `U`: target type to convert to. //! //! **Return value** diff --git a/include/kyosu/functions/cos.hpp b/include/kyosu/functions/cos.hpp index 64581095..ac69bbc5 100644 --- a/include/kyosu/functions/cos.hpp +++ b/include/kyosu/functions/cos.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cos : eve::elementwise + struct callable_cos: eve::elementwise { using callable_tag_type = callable_cos; @@ -60,7 +60,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! @@ -68,7 +68,7 @@ namespace kyosu //! //! 2. The behavior of this function is equivalent to `eve::cosh(i*z)`. //! -//! 3 Returns \f$\cosh(I_z\; z)\f$ if \f$z\f$ is not zero else \f$\cos(z_0)\f$, where \f$I_z = \frac{\underline{z}}{|\underline{z}|}\f$ and +//! 3. Returns \f$\cosh(I_z\; z)\f$ if \f$z\f$ is not zero else \f$\cos(z_0)\f$, where \f$I_z = \frac{\underline{z}}{|\underline{z}|}\f$ and //! \f$\underline{z}\f$ is the [pure](@ref kyosu::imag ) part of \f$z\f$. //! //! @groupheader{Example} diff --git a/include/kyosu/functions/cosh.hpp b/include/kyosu/functions/cosh.hpp index b1d5b6ac..3f895b47 100644 --- a/include/kyosu/functions/cosh.hpp +++ b/include/kyosu/functions/cosh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cosh : eve::elementwise + struct callable_cosh: eve::elementwise { using callable_tag_type = callable_cosh; @@ -56,12 +56,11 @@ namespace kyosu //! template constexpr T cosh(T z) noexcept; //2 //! template constexpr T cosh(T z) noexcept; //3 //! } -//! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/cospi.hpp b/include/kyosu/functions/cospi.hpp index f8d137f1..da407acf 100644 --- a/include/kyosu/functions/cospi.hpp +++ b/include/kyosu/functions/cospi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cospi : eve::elementwise + struct callable_cospi: eve::elementwise { using callable_tag_type = callable_cospi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/cot.hpp b/include/kyosu/functions/cot.hpp index ca9bb5a8..72868d15 100644 --- a/include/kyosu/functions/cot.hpp +++ b/include/kyosu/functions/cot.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cot : eve::elementwise + struct callable_cot: eve::elementwise { using callable_tag_type = callable_cot; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/coth.hpp b/include/kyosu/functions/coth.hpp index 37d0091b..ab742f0a 100644 --- a/include/kyosu/functions/coth.hpp +++ b/include/kyosu/functions/coth.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_coth : eve::elementwise + struct callable_coth: eve::elementwise { using callable_tag_type = callable_coth; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/cotpi.hpp b/include/kyosu/functions/cotpi.hpp index b8d5c9a0..d73af88f 100644 --- a/include/kyosu/functions/cotpi.hpp +++ b/include/kyosu/functions/cotpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cotpi : eve::elementwise + struct callable_cotpi: eve::elementwise { using callable_tag_type = callable_cotpi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/csc.hpp b/include/kyosu/functions/csc.hpp index b3762171..6baf19be 100644 --- a/include/kyosu/functions/csc.hpp +++ b/include/kyosu/functions/csc.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_csc : eve::elementwise + struct callable_csc: eve::elementwise { using callable_tag_type = callable_csc; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/csch.hpp b/include/kyosu/functions/csch.hpp index 09664df9..8b0f8014 100644 --- a/include/kyosu/functions/csch.hpp +++ b/include/kyosu/functions/csch.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_csch : eve::elementwise + struct callable_csch: eve::elementwise { using callable_tag_type = callable_csch; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/cscpi.hpp b/include/kyosu/functions/cscpi.hpp index bf1cc947..6ce586c1 100644 --- a/include/kyosu/functions/cscpi.hpp +++ b/include/kyosu/functions/cscpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_cscpi : eve::elementwise + struct callable_cscpi: eve::elementwise { using callable_tag_type = callable_cscpi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/dec.hpp b/include/kyosu/functions/dec.hpp index 009f877d..8ca9932a 100644 --- a/include/kyosu/functions/dec.hpp +++ b/include/kyosu/functions/dec.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_dec : eve::elementwise + struct callable_dec: eve::elementwise { using callable_tag_type = callable_dec; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to decrement. +//! * `z`: Value to decrement. //! //! **Return value** //! diff --git a/include/kyosu/functions/dist.hpp b/include/kyosu/functions/dist.hpp index f6f61661..92317e01 100644 --- a/include/kyosu/functions/dist.hpp +++ b/include/kyosu/functions/dist.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_dist : eve::elementwise + struct callable_dist: eve::elementwise { using callable_tag_type = callable_dist; @@ -61,12 +61,12 @@ namespace kyosu //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! //! Returns the distance between the two arguments computed as the absolute value of the arguments difference. -//! Arguments can be a mix of floting or Cayley-Dicson values. +//! Arguments can be a mix of floating or Cayley-Dicson values. //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/dot.hpp b/include/kyosu/functions/dot.hpp index dbdae74b..5fab9889 100644 --- a/include/kyosu/functions/dot.hpp +++ b/include/kyosu/functions/dot.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_dot : eve::elementwise + struct callable_dot: eve::elementwise { using callable_tag_type = callable_dot; @@ -61,7 +61,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/exp.hpp b/include/kyosu/functions/exp.hpp index 3fcb71f1..dbb9c1cb 100644 --- a/include/kyosu/functions/exp.hpp +++ b/include/kyosu/functions/exp.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_exp : eve::elementwise + struct callable_exp: eve::elementwise { using callable_tag_type = callable_exp; @@ -52,18 +52,38 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constexpr T exp(T z) noexcept; -//! template constexpr T exp(T z) noexcept; +//! template constexpr T exp(T z) noexcept; //1 +//! template constexpr T exp(T z) noexcept; //2 +//! template constexpr T exp(T z) noexcept; //3 //! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! -//! Returns the exponential of the argument. +//! 1. Returns the exponential of the argument, calling `eve::exp`. +//! +//! 2. Returns the exponential of the complex input following IEEE standards: +//! +//! * for every z: kyosu::exp(eve::conj(z)) == kyosu::conj(std::exp(z)) +//! * If z is \f$\pm0\f$, the result is \f$1\f$ +//! * If z is \f$x+i \infty\f$ (for any finite x), the result is \f$NaN+i NaN\f$. +//! * If z is \f$x+i NaN\f$ (for any finite x), the result is \f$NaN+i NaN\f$. +//! * If z is \f$+\infty+i 0\f$, the result is \f$+\infty\f$ +//! * If z is \f$-\infty+i y\f$ (for any finite y), the result is \f$+0 \mathrm{cis}(y)\f$. +//! * If z is \f$+\infty+i y\f$ (for any finite nonzero y), the result is \f$+\infty \mathrm{cis}(y)\f$. +//! * If z is \f$-\infty+i \infty\f$, the result is \f$\pm 0+i \pm 0\f$ (signs are unspecified) +//! * If z is \f$+\infty+i \pm\infty\f$, the result is \f$\pm \infty+i NaN\f$ (the sign of the real part is unspecified). +//! * If z is \f$-\infty+i NaN\f$, the result is \f$\pm 0+i \pm 0\f$ (signs are unspecified). +//! * If z is \f$\pm\infty+i NaN\f$, the result is \f$\pm \infty+i NaN\f$ (the sign of the real part is unspecified). +//! * If z is \f$NaN\f$, the result is \f$NaN\f$. +//! * If z is \f$NaN+i y\f$ (for any nonzero y), the result is \f$NaN+i NaN\f$. +//! * If z is \f$NaN+i NaN\f$, the result is \f$NaN+i NaN\f$. +//! +//! 3. Returns \f$e^{z_0}(\cos|\underline{z}|+\underline{z}\; \mathop{sinc}|\underline{z}|)\f$ //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/exp10.hpp b/include/kyosu/functions/exp10.hpp index e209ccb0..a1fbfb21 100644 --- a/include/kyosu/functions/exp10.hpp +++ b/include/kyosu/functions/exp10.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_exp10 : eve::elementwise + struct callable_exp10: eve::elementwise { using callable_tag_type = callable_exp10; @@ -59,11 +59,11 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! -//! Returns 10 to the argument. +//! Returns 10 to the argument. The call is semantically equivalent to \f$e^{\log(10)z}\f$ //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/exp2.hpp b/include/kyosu/functions/exp2.hpp index 236c45fd..72017302 100644 --- a/include/kyosu/functions/exp2.hpp +++ b/include/kyosu/functions/exp2.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_exp2 : eve::elementwise + struct callable_exp2: eve::elementwise { using callable_tag_type = callable_exp2; @@ -59,11 +59,11 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! -//! Returns 2 to the argument. +//! Returns 2 to the argument. The call is semantically equivalent to \f$e^{\log(2)z}\f$ //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/exp_i.hpp b/include/kyosu/functions/exp_i.hpp index 9050d649..7332370d 100644 --- a/include/kyosu/functions/exp_i.hpp +++ b/include/kyosu/functions/exp_i.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_exp_i : eve::elementwise + struct callable_exp_i: eve::elementwise { using callable_tag_type = callable_exp_i; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/exp_ipi.hpp b/include/kyosu/functions/exp_ipi.hpp index 7814ceb2..1761f9a8 100644 --- a/include/kyosu/functions/exp_ipi.hpp +++ b/include/kyosu/functions/exp_ipi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_exp_ipi : eve::elementwise + struct callable_exp_ipi: eve::elementwise { using callable_tag_type = callable_exp_ipi; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/expm1.hpp b/include/kyosu/functions/expm1.hpp index 79f6d3c9..cbd3aa74 100644 --- a/include/kyosu/functions/expm1.hpp +++ b/include/kyosu/functions/expm1.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_expm1 : eve::elementwise + struct callable_expm1: eve::elementwise { using callable_tag_type = callable_expm1; @@ -59,12 +59,12 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! //! Returns the expm1onential of the argument minus 1. -//! for real and complex typed inputs, provisions are made to ensure good precision near zero. +//! Provisions are made to ensure good precision near zero. //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/expmx2.hpp b/include/kyosu/functions/expmx2.hpp index 5234853d..67827a35 100644 --- a/include/kyosu/functions/expmx2.hpp +++ b/include/kyosu/functions/expmx2.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_expmx2 : eve::elementwise + struct callable_expmx2: eve::elementwise { using callable_tag_type = callable_expmx2; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/expx2.hpp b/include/kyosu/functions/expx2.hpp index 8de316c5..909942fb 100644 --- a/include/kyosu/functions/expx2.hpp +++ b/include/kyosu/functions/expx2.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_expx2 : eve::elementwise + struct callable_expx2: eve::elementwise { using callable_tag_type = callable_expx2; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/fam.hpp b/include/kyosu/functions/fam.hpp new file mode 100644 index 00000000..9cbd4a7c --- /dev/null +++ b/include/kyosu/functions/fam.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fam: eve::elementwise + { + using callable_tag_type = callable_fam; + + KYOSU_DEFERS_CALLABLE(fam_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fam(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fam +//! @brief Computes fused add multiply. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fam(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`,`z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `z0+z1*z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fam.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fam fam = {}; +} diff --git a/include/kyosu/functions/floor.hpp b/include/kyosu/functions/floor.hpp index e35b328f..6a05444a 100644 --- a/include/kyosu/functions/floor.hpp +++ b/include/kyosu/functions/floor.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_floor : eve::elementwise + struct callable_floor: eve::elementwise { using callable_tag_type = callable_floor; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which floor is computed. +//! * `z`: Value to for which floor is computed. //! //! **Return value** //! diff --git a/include/kyosu/functions/fma.hpp b/include/kyosu/functions/fma.hpp new file mode 100644 index 00000000..3ba9a7b1 --- /dev/null +++ b/include/kyosu/functions/fma.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fma: eve::elementwise + { + using callable_tag_type = callable_fma; + + KYOSU_DEFERS_CALLABLE(fma_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fma(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fma +//! @brief Computes fused multiply add. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fma(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`,`z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `z0*z1+z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fma.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fma fma = {}; +} diff --git a/include/kyosu/functions/fms.hpp b/include/kyosu/functions/fms.hpp new file mode 100644 index 00000000..1725aa3a --- /dev/null +++ b/include/kyosu/functions/fms.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fms: eve::elementwise + { + using callable_tag_type = callable_fms; + + KYOSU_DEFERS_CALLABLE(fms_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fms(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fms +//! @brief Computes fused multiply add. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fms(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`, `z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `z0*z1+z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fms.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fms fms = {}; +} diff --git a/include/kyosu/functions/fnma.hpp b/include/kyosu/functions/fnma.hpp new file mode 100644 index 00000000..c71adf35 --- /dev/null +++ b/include/kyosu/functions/fnma.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fnma: eve::elementwise + { + using callable_tag_type = callable_fnma; + + KYOSU_DEFERS_CALLABLE(fnma_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fnma(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fnma +//! @brief Computes fused negate multiply add. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fnma(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`,`z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `-z0*z1+z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fnma.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fnma fnma = {}; +} diff --git a/include/kyosu/functions/fnms.hpp b/include/kyosu/functions/fnms.hpp new file mode 100644 index 00000000..e2c71258 --- /dev/null +++ b/include/kyosu/functions/fnms.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fnms: eve::elementwise + { + using callable_tag_type = callable_fnms; + + KYOSU_DEFERS_CALLABLE(fnms_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fnms(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fnms +//! @brief Computes fused negate multiply sub. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fnms(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`,`z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `-z0*z1-z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fnms.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fnms fnms = {}; +} diff --git a/include/kyosu/functions/frac.hpp b/include/kyosu/functions/frac.hpp index 7a902c8c..f58dad10 100644 --- a/include/kyosu/functions/frac.hpp +++ b/include/kyosu/functions/frac.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_frac : eve::elementwise + struct callable_frac: eve::elementwise { using callable_tag_type = callable_frac; @@ -58,11 +58,11 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which frac is computed. +//! * `z`: Value to process. //! //! **Return value** //! -//! Returns the frac of its argument. i.e. the value with parts are the fractionnal +//! Returns the fractionnal part of its argument. i.e. the value whose parts are the fractionnal //! parts of the original ones. //! //! @groupheader{Example} diff --git a/include/kyosu/functions/from_angle_axis.hpp b/include/kyosu/functions/from_angle_axis.hpp index 9d376123..4ea32a40 100644 --- a/include/kyosu/functions/from_angle_axis.hpp +++ b/include/kyosu/functions/from_angle_axis.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_from_angle_axis : eve::elementwise + struct callable_from_angle_axis: eve::elementwise { using callable_tag_type = callable_from_angle_axis; @@ -23,9 +23,26 @@ namespace kyosu::tags static KYOSU_FORCEINLINE auto deferred_call(auto , V angle , U axis) noexcept + { + auto fn = callable_from_angle_axis{}; + return fn(angle, axis, normalize); +// using e_t = decltype(axis[0]+angle); +// auto q = quaternion(e_t(0), e_t(axis[0]), e_t(axis[1]), e_t(axis[2])); +// auto [s, c] = eve::sincos(angle*eve::half(eve::as(angle))); +// return c+s*q; + } + + template + static KYOSU_FORCEINLINE auto deferred_call(auto + , V angle + , U axis + , _::norming) noexcept { using e_t = decltype(axis[0]+angle); auto q = quaternion(e_t(0), e_t(axis[0]), e_t(axis[1]), e_t(axis[2])); + if constexpr(n){ + q = if_else(is_eqz(q), quaternion(e_t(0), e_t(1)), sign(q)); + } auto [s, c] = eve::sincos(angle*eve::half(eve::as(angle))); return c+s*q; } @@ -39,6 +56,16 @@ namespace kyosu::tags return eve::tag_invoke(*this, target0, target1); } + template + KYOSU_FORCEINLINE auto operator()(T0 target0, + T1 target1, + _::norming nr + ) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, nr)) + { + return eve::tag_invoke(*this, target0, target1, nr); + } + template eve::unsupported_call operator()(T&&... x) const requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; @@ -52,9 +79,8 @@ namespace kyosu //! @{ //! @var from_angle_axis //! - //! @brief Callable object computing a quaternion from its angle_axis representation. - //! - //! This function build an unitary quaternion from an angle value and a 3 dimensionnal axis vector + //! @brief Callable object computing an an unitary quaternion from an angle value + //! and a 3 dimensionnal axis vector //! //! **Defined in header** //! @@ -73,10 +99,13 @@ namespace kyosu //! //! **Parameters** //! - //! * `angle` : rotation angle in radian - //! * `axis`` : rotation axis given by an std::span of dimension 3. - //! * normalize : can be assume_normalized or normalize. In the second case axis is normalized. - //! if axis is already normalized use assume_normalized is more efficient. + //! * `angle`: rotation angle in radian + //! * `axis`: rotation axis given by an std::span of dimension 3. + //! * `normalize`: can be `assume_normalized` or `normalize`. + //! - In the second case the axis is normalized before use. + //! - if the axis is already normalized using `assume_normalized` is more efficient, + //! but the result is u.b. if it is not the case. + //! - if the axis is null the axis is normalized as (1, 0, 0). //! //! **Return value** //! diff --git a/include/kyosu/functions/from_cylindrical.hpp b/include/kyosu/functions/from_cylindrical.hpp index 7cc6c864..c7a7ebd7 100644 --- a/include/kyosu/functions/from_cylindrical.hpp +++ b/include/kyosu/functions/from_cylindrical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_cylindrical : eve::elementwise + struct callable_from_cylindrical: eve::elementwise { using callable_tag_type = callable_from_cylindrical; @@ -81,7 +81,7 @@ namespace kyosu //! //! **Parameters** //! - //! * `r`, angle`, `h1`, `h2` + //! * `r`, `angle`, `h1`, `h2` //! //! **Return value** //! diff --git a/include/kyosu/functions/from_cylindricospherical.hpp b/include/kyosu/functions/from_cylindricospherical.hpp index 1b204278..ea4b713b 100644 --- a/include/kyosu/functions/from_cylindricospherical.hpp +++ b/include/kyosu/functions/from_cylindricospherical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_cylindrospherical : eve::elementwise + struct callable_from_cylindrospherical: eve::elementwise { using callable_tag_type = callable_from_cylindrospherical; @@ -58,10 +58,10 @@ namespace kyosu //! @brief Callable object computing a quaternion from its cylindrospherical representation. //! //! cylindrospherical is specific to quaternions. It is often interesting to consider - //! \f$\mathbb{H}\f$ as the cartesian product of \f$\mathbb{R}\f$ by \f$\mathbb{R3}\f$ + //! \f$\mathbb{H}\f$ as the cartesian product of \f$\mathbb{R}\f$ by \f$\mathbb{R}^3\f$ //! (the quaternionic multiplication has then a special form, as given here). - //! This function therefore builds a quaternion from this representation, with the \f$\mathbb{R3}\f$ component given - //! in usual \f$\mathbb{R3}\f$ spherical coordinates. + //! This function therefore builds a quaternion from this representation, with the \f$\mathbb{R}^3\f$ component given + //! in usual \f$\mathbb{R}^3\f$ spherical coordinates. //! //! **Defined in header** //! diff --git a/include/kyosu/functions/from_cylindrospherical.hpp b/include/kyosu/functions/from_cylindrospherical.hpp index 1b204278..8eb8a85a 100644 --- a/include/kyosu/functions/from_cylindrospherical.hpp +++ b/include/kyosu/functions/from_cylindrospherical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_cylindrospherical : eve::elementwise + struct callable_from_cylindrospherical: eve::elementwise { using callable_tag_type = callable_from_cylindrospherical; diff --git a/include/kyosu/functions/from_euler.hpp b/include/kyosu/functions/from_euler.hpp index a900afdd..2235bdc5 100644 --- a/include/kyosu/functions/from_euler.hpp +++ b/include/kyosu/functions/from_euler.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_from_euler : eve::elementwise + struct callable_from_euler: eve::elementwise { using callable_tag_type = callable_from_euler; @@ -97,7 +97,7 @@ namespace kyosu //! //! @brief Callable object computing a quaternion from its euler representation. //! - //! This function build euler angles from 3 euler angles in radian. Template parameters I, J, K of type int + //! This function builds a quaternion from 3 euler angles in radian. Template parameters I, J, K of type int //! are used to choose the euler axis order. //! //! for instance I = 3, J = 2, K = 3 choose the ZYZ sequence. @@ -124,16 +124,16 @@ namespace kyosu //! //! **Parameters** //! - //! * `a`, `b`, `c` : the angles in radian + //! * `a`, `b`, `c`: the angles in radian //! * `a1`, `a2`, `a3` the axis parameters to be chosen between X_, Y_, Z_ (two consecutive axis cannot be the same) - //! * `e' : allows to choose between Extrinsic or Intrinsic representations. + //! * `e': allows to choose between extrinsic or intrinsic representations. //! //! **Template parameters** //! - //! * I, J, K : are on call deduced from the axis parameters + //! * I, J, K: are on call deduced from the axis parameters //! //! - //! The computation method is taken from the article : "Quaternion to Euler angles conversion: A + //! The computation method is taken from the article: "Quaternion to Euler angles conversion: A //! direct, general and computationally efficient method". PLoS ONE //! 17(11): e0276302. https://doi.org/10.1371/journal pone 0276302. //! Evandro Bernardes, and Stephane Viollet diff --git a/include/kyosu/functions/from_multipolar.hpp b/include/kyosu/functions/from_multipolar.hpp index 9eed28b2..e965b3c1 100644 --- a/include/kyosu/functions/from_multipolar.hpp +++ b/include/kyosu/functions/from_multipolar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_from_multipolar : eve::elementwise + struct callable_from_multipolar: eve::elementwise { using callable_tag_type = callable_from_multipolar; @@ -73,14 +73,15 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto from_multipolar( auto rho1, auto theta1 auto rho2, auto theta2) const noexcept; + //! auto from_multipolar(auto rho1, auto theta1, auto rho2, auto theta2) noexcept; //! } //! @endcode //! //! **Parameters** //! //! `rho1`, `rho2`: the moduli - //! 'theta1', 'theta2': the angles in radian + //! + //! `theta1`, `theta2`: the angles in radian //! //! **Return value** //! diff --git a/include/kyosu/functions/from_polar.hpp b/include/kyosu/functions/from_polar.hpp index 3c9c409f..22e9257f 100644 --- a/include/kyosu/functions/from_polar.hpp +++ b/include/kyosu/functions/from_polar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_polar : eve::elementwise + struct callable_from_polar: eve::elementwise { using callable_tag_type = callable_from_polar; @@ -60,7 +60,7 @@ namespace kyosu //! //! @brief Callable object computing a complex or a general Cayley-Dickson from a polar representation. //! - //! This function is the reciprocal of from_polar + //! This function is the reciprocal of to_polar //! //! **Defined in header** //! @@ -82,11 +82,11 @@ namespace kyosu //! //! **Parameters** //! - //! `rho` : modulus. + //! `rho` : modulus. //! - //! `theta` : argument. + //! `theta`: argument. //! - //! `iz' : unitary cayley dickson value. + //! `iz` : unitary cayley dickson value. //! //! **Return value** //! diff --git a/include/kyosu/functions/from_rotation_matrix.hpp b/include/kyosu/functions/from_rotation_matrix.hpp index f1653e60..cd99927a 100644 --- a/include/kyosu/functions/from_rotation_matrix.hpp +++ b/include/kyosu/functions/from_rotation_matrix.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_rotation_matrix : eve::elementwise + struct callable_from_rotation_matrix: eve::elementwise { using callable_tag_type = callable_from_rotation_matrix; @@ -94,7 +94,7 @@ namespace kyosu //! the ith line and jth column element of the matrix (indices starting from 0). //! //! - //! The computation method is inspired from the article : "Accurate Computation of + //! The computation method is inspired from the article: "Accurate Computation of //! Quaternions from Rotation Matrices", by Soheil Sarabandi and Federico Thomas //! Institut de Robotica i Informatica Industrial (CSIC-UPC) //! Llorens Artigas 4-6, 08028 Barcelona, Spain. diff --git a/include/kyosu/functions/from_semipolar.hpp b/include/kyosu/functions/from_semipolar.hpp index 036cf575..9b5a77ac 100644 --- a/include/kyosu/functions/from_semipolar.hpp +++ b/include/kyosu/functions/from_semipolar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_semipolar : eve::elementwise + struct callable_from_semipolar: eve::elementwise { using callable_tag_type = callable_from_semipolar; @@ -58,7 +58,7 @@ namespace kyosu //! @brief Callable object computing a quaternion from its semipolar representation. //! //! This function build quaternions in a way similar to the way polar builds complex numbers - //! from a semipolar representation of an \f$\mathbb{R}^2\f$ element. + //! from a polar representation of an \f$\mathbb{R}^2\f$ element. //! //! from_semipolar first two inputs are the polar coordinates of the first \f$\mathbb{C}\f$ //! component of the quaternion. diff --git a/include/kyosu/functions/from_spherical.hpp b/include/kyosu/functions/from_spherical.hpp index 7ed43029..63167f3c 100644 --- a/include/kyosu/functions/from_spherical.hpp +++ b/include/kyosu/functions/from_spherical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_from_spherical : eve::elementwise + struct callable_from_spherical: eve::elementwise { using callable_tag_type = callable_from_spherical; @@ -83,7 +83,7 @@ namespace kyosu //! **Parameters** //! //! * `rho`: the modulus - //! * `theta`, 'phi1`, 'phi2`: angles in radian + //! * `theta`, `phi1`, `phi2`: angles in radian //! //! **Return value** //! diff --git a/include/kyosu/functions/fsm.hpp b/include/kyosu/functions/fsm.hpp new file mode 100644 index 00000000..c75f4174 --- /dev/null +++ b/include/kyosu/functions/fsm.hpp @@ -0,0 +1,77 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_fsm: eve::elementwise + { + using callable_tag_type = callable_fsm; + + KYOSU_DEFERS_CALLABLE(fsm_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const& v0 + , eve::floating_ordered_value auto const& v1 + , eve::floating_ordered_value auto const& v2) noexcept + { + return eve::fsm(v0, v1, v2); + } + + KYOSU_FORCEINLINE auto operator()(auto const& target0, auto const& target1, auto const & target2) const noexcept + -> decltype(eve::tag_invoke(*this, target0, target1, target2)) + { + return eve::tag_invoke(*this, target0, target1, target2); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var fsm +//! @brief Computes fused sub multiply. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! constexpr auto fsm(auto z0, auto z1, auto z2) noexcept; +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `z0`, `z1`,`z2`: Values to process. +//! +//! **Return value** +//! +//! The call is semantically equivalent to `-z0+z1*z2`. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/fsm.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_fsm fsm = {}; +} diff --git a/include/kyosu/functions/horner.hpp b/include/kyosu/functions/horner.hpp new file mode 100644 index 00000000..7cd8869f --- /dev/null +++ b/include/kyosu/functions/horner.hpp @@ -0,0 +1,110 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include +#include +#include + +namespace kyosu::tags +{ + struct callable_horner: eve::elementwise + { + using callable_tag_type = callable_horner; + + KYOSU_DEFERS_CALLABLE(horner_); + + template < eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , Ts const & ... vs) noexcept + { + return eve::horner(vs...); + } + + template < eve::floating_ordered_value T0, eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , T0 x, kumi::tuple tup) noexcept + { + return eve::horner(x, tup); + } + + template < typename ... Ts> + KYOSU_FORCEINLINE auto operator()(Ts const& ...targets) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var horner +//! @brief Implement the horner scheme to evaluate polynomials +//! +//! If \f$(a_i)_{0\le i\le n-1}\f$ denotes the coefficients of the polynomial by decreasing +//! power order, the Horner scheme evaluates the polynom \f$p\f$ at \f$x\f$ by : +//! \f$\displaystyle p(x) = (((a_0x+a_1)x+ ... )x + a_{n-1})\f$.\n +//! For non commutative cases it is a left-horner scheme: coefficients are at the left of the x powers). +//! +//! **Defined in header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace eve +//! { +//! template auto horner(T x, C ... coefs) noexcept; //1 +//! template< auto C, auto K> auto horner(T x, K tup) noexcept; //2 +//! +//! } +//! @endcode +//! +//! 1. Polynom is evaluated at x the other inputs are the polynomial coefficients. +//! 2. Polynom is evaluated at x the other input is a kumi tuple containing the coefficients +//! +//! **Parameters** +//! +//! * `x` : real or cayley-dickson argument. +//! +//! * `coefs...` : real or cayley-dickson arguments. The coefficients by decreasing power order +//! +//! * `tup` : kumi tuple containing The coefficients by decreasing power order. +//! +//! **Return value** +//! +//! The value of the polynom at `x` is returned, according to the formula: +//! \f$\displaystyle p(x) = (((a_0x+a_1)x+ ... )x + a_{n-1})\f$.\n +//! For non commutative cases it is a left-horner scheme. See [right_horner](@ref right_horner) +//! for the right scheme +//! +//! **Notes** +//! +//! If the coefficients are simd values of cardinal N, this means you simultaneously +//! compute the values of N polynomials. +//! * If x is scalar, the polynomials are all computed at the same point +//! * If x is simd, the nth polynomial is computed on the nth value of x +//! +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/horner.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_horner horner = {}; +} diff --git a/include/kyosu/functions/hypot.hpp b/include/kyosu/functions/hypot.hpp index 35d0f3ea..649410ec 100644 --- a/include/kyosu/functions/hypot.hpp +++ b/include/kyosu/functions/hypot.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_hypot : eve::elementwise + struct callable_hypot: eve::elementwise { using callable_tag_type = callable_hypot; @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template< f typename ... Ts> auto hypot(Ts ... zi ) const noexcept -///! } +//! template auto hypot(Ts ... zi ) const noexcept +//! } //! @endcode //! //! **Parameters** //! -//! * ` zi...` : Values to process: mix of floating and Cayley-Dickson. +//! * `zi...`: Values to process: mix of floating and Cayley-Dickson. //! //! **Return value** //! diff --git a/include/kyosu/functions/if_else.hpp b/include/kyosu/functions/if_else.hpp index 4ca6cafb..3361cdda 100644 --- a/include/kyosu/functions/if_else.hpp +++ b/include/kyosu/functions/if_else.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_if_else : eve::elementwise + struct callable_if_else: eve::elementwise { using callable_tag_type = callable_if_else; @@ -46,16 +46,18 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constexpr auto if_else(T x, U, y, V z ) noexcept; +//! constexpr auto if_else(auto x, auto y, auto z ) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `x`: logical mask. +//! * `y`, `z`: values to be selected. //! //! **Return value** //! +//! elementwise `y` or `z` according the truth value of `x`. //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/inc.hpp b/include/kyosu/functions/inc.hpp index 155b254a..d66ec585 100644 --- a/include/kyosu/functions/inc.hpp +++ b/include/kyosu/functions/inc.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_inc : eve::elementwise + struct callable_inc: eve::elementwise { using callable_tag_type = callable_inc; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to increment. +//! * `z`: Value to increment. //! //! **Return value** //! diff --git a/include/kyosu/functions/ipart.hpp b/include/kyosu/functions/ipart.hpp index 42500eea..d8acd472 100644 --- a/include/kyosu/functions/ipart.hpp +++ b/include/kyosu/functions/ipart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_ipart : eve::elementwise, extractor<1> + struct callable_ipart: eve::elementwise, extractor<1> { using callable_tag_type = callable_ipart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_denormal.hpp b/include/kyosu/functions/is_denormal.hpp index 15dcf60f..2b5156e6 100644 --- a/include/kyosu/functions/is_denormal.hpp +++ b/include/kyosu/functions/is_denormal.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_denormal : eve::elementwise + struct callable_is_denormal: eve::elementwise { using callable_tag_type = callable_is_denormal; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_equal.hpp b/include/kyosu/functions/is_equal.hpp index 92f323b3..9e54aa88 100644 --- a/include/kyosu/functions/is_equal.hpp +++ b/include/kyosu/functions/is_equal.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_equal : eve::elementwise + struct callable_is_equal: eve::elementwise { using callable_tag_type = callable_is_equal; @@ -62,7 +62,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_eqz.hpp b/include/kyosu/functions/is_eqz.hpp index 0088e85e..7d884d98 100644 --- a/include/kyosu/functions/is_eqz.hpp +++ b/include/kyosu/functions/is_eqz.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_eqz : eve::elementwise + struct callable_is_eqz: eve::elementwise { using callable_tag_type = callable_is_eqz; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_finite.hpp b/include/kyosu/functions/is_finite.hpp index ef762865..68029609 100644 --- a/include/kyosu/functions/is_finite.hpp +++ b/include/kyosu/functions/is_finite.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_finite : eve::elementwise + struct callable_is_finite: eve::elementwise { using callable_tag_type = callable_is_finite; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_imag.hpp b/include/kyosu/functions/is_imag.hpp index 2d5b53d6..3cd375d6 100644 --- a/include/kyosu/functions/is_imag.hpp +++ b/include/kyosu/functions/is_imag.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -29,17 +29,17 @@ namespace kyosu //! namespace kyosu //! { //! template constexpr auto is_imag(T z) noexcept; -//! template constexpr auto is_imag(T z) noexcept; +//! template constexpr auto is_imag(T z) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! -//! Returns elementwise true the real part of the argument is zero. +//! Returns elementwise true if the real part of the argument is zero. //! is_imag is an alias of is_pure. //! //! @groupheader{Example} diff --git a/include/kyosu/functions/is_infinite.hpp b/include/kyosu/functions/is_infinite.hpp index c8494d98..623247b1 100644 --- a/include/kyosu/functions/is_infinite.hpp +++ b/include/kyosu/functions/is_infinite.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_infinite : eve::elementwise + struct callable_is_infinite: eve::elementwise { using callable_tag_type = callable_is_infinite; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_nan.hpp b/include/kyosu/functions/is_nan.hpp index edf2e7c1..0121eb95 100644 --- a/include/kyosu/functions/is_nan.hpp +++ b/include/kyosu/functions/is_nan.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_nan : eve::elementwise + struct callable_is_nan: eve::elementwise { using callable_tag_type = callable_is_nan; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_nez.hpp b/include/kyosu/functions/is_nez.hpp index 9eca7d96..f63f9d8d 100644 --- a/include/kyosu/functions/is_nez.hpp +++ b/include/kyosu/functions/is_nez.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_nez : eve::elementwise + struct callable_is_nez: eve::elementwise { using callable_tag_type = callable_is_nez; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_not_denormal.hpp b/include/kyosu/functions/is_not_denormal.hpp index 92c446a7..b2dce237 100644 --- a/include/kyosu/functions/is_not_denormal.hpp +++ b/include/kyosu/functions/is_not_denormal.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_denormal : eve::elementwise + struct callable_is_not_denormal: eve::elementwise { using callable_tag_type = callable_is_not_denormal; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_not_equal.hpp b/include/kyosu/functions/is_not_equal.hpp index 93461292..0f618907 100644 --- a/include/kyosu/functions/is_not_equal.hpp +++ b/include/kyosu/functions/is_not_equal.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_equal : eve::elementwise + struct callable_is_not_equal: eve::elementwise { using callable_tag_type = callable_is_not_equal; @@ -56,17 +56,17 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto is_equal(auto z0, auto z1) noexcept; +//! constexpr auto is_not_equal(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! -//! Returns elemtwise true or false according the inequality of the parameters +//! Returns elemtwise true or false according to the inequality of the parameters //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/is_not_finite.hpp b/include/kyosu/functions/is_not_finite.hpp index 059f3b41..48de0594 100644 --- a/include/kyosu/functions/is_not_finite.hpp +++ b/include/kyosu/functions/is_not_finite.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_finite : eve::elementwise + struct callable_is_not_finite: eve::elementwise { using callable_tag_type = callable_is_not_finite; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_not_infinite.hpp b/include/kyosu/functions/is_not_infinite.hpp index 88ac4f0e..7cb72ae9 100644 --- a/include/kyosu/functions/is_not_infinite.hpp +++ b/include/kyosu/functions/is_not_infinite.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_infinite : eve::elementwise + struct callable_is_not_infinite: eve::elementwise { using callable_tag_type = callable_is_not_infinite; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_not_nan.hpp b/include/kyosu/functions/is_not_nan.hpp index df430b20..b3ebcff3 100644 --- a/include/kyosu/functions/is_not_nan.hpp +++ b/include/kyosu/functions/is_not_nan.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_nan : eve::elementwise + struct callable_is_not_nan: eve::elementwise { using callable_tag_type = callable_is_not_nan; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_not_real.hpp b/include/kyosu/functions/is_not_real.hpp index 26bf451b..555901b3 100644 --- a/include/kyosu/functions/is_not_real.hpp +++ b/include/kyosu/functions/is_not_real.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_not_real : eve::elementwise + struct callable_is_not_real: eve::elementwise { using callable_tag_type = callable_is_not_real; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_pure.hpp b/include/kyosu/functions/is_pure.hpp index ad07490a..0bf09343 100644 --- a/include/kyosu/functions/is_pure.hpp +++ b/include/kyosu/functions/is_pure.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_pure : eve::elementwise + struct callable_is_pure: eve::elementwise { using callable_tag_type = callable_is_pure; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_real.hpp b/include/kyosu/functions/is_real.hpp index 2cc1faf7..2a7e964e 100644 --- a/include/kyosu/functions/is_real.hpp +++ b/include/kyosu/functions/is_real.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_real : eve::elementwise + struct callable_is_real: eve::elementwise { using callable_tag_type = callable_is_real; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/is_unitary.hpp b/include/kyosu/functions/is_unitary.hpp index f732ad29..53a260e9 100644 --- a/include/kyosu/functions/is_unitary.hpp +++ b/include/kyosu/functions/is_unitary.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_is_unitary : eve::elementwise + struct callable_is_unitary: eve::elementwise { using callable_tag_type = callable_is_unitary; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/jpart.hpp b/include/kyosu/functions/jpart.hpp index bcccd008..e365ca21 100644 --- a/include/kyosu/functions/jpart.hpp +++ b/include/kyosu/functions/jpart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_jpart : eve::elementwise, extractor<2> + struct callable_jpart: eve::elementwise, extractor<2> { using callable_tag_type = callable_jpart; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/kpart.hpp b/include/kyosu/functions/kpart.hpp index 7d26e289..885eb909 100644 --- a/include/kyosu/functions/kpart.hpp +++ b/include/kyosu/functions/kpart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_kpart : eve::elementwise, extractor<3> + struct callable_kpart: eve::elementwise, extractor<3> { using callable_tag_type = callable_kpart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/ldiv.hpp b/include/kyosu/functions/ldiv.hpp index 1a40c59b..fdac7353 100644 --- a/include/kyosu/functions/ldiv.hpp +++ b/include/kyosu/functions/ldiv.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_ldiv : eve::elementwise + struct callable_ldiv: eve::elementwise { using callable_tag_type = callable_ldiv; @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto ldiv(auto z0, auto, z1) noexcept; +//! constexpr auto ldiv(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/lerp.hpp b/include/kyosu/functions/lerp.hpp index 528b733b..e6bb04fa 100644 --- a/include/kyosu/functions/lerp.hpp +++ b/include/kyosu/functions/lerp.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_lerp : eve::elementwise + struct callable_lerp: eve::elementwise { using callable_tag_type = callable_lerp; @@ -56,14 +56,14 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto lerp(auto z0, auto, z1, floating_ordered_value t) noexcept; +//! constexpr auto lerp(auto z0, auto z1, floating_ordered_value t) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Value to process. -//! * `t` : floating value interpolation coefficient. +//! * `z0`, `z1`: Values to process. +//! * `t`: floating value interpolation coefficient. //! //! **Return value** //! diff --git a/include/kyosu/functions/lipart.hpp b/include/kyosu/functions/lipart.hpp index 758d9b1c..33cf2d70 100644 --- a/include/kyosu/functions/lipart.hpp +++ b/include/kyosu/functions/lipart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_lipart : eve::elementwise, extractor<5> + struct callable_lipart: eve::elementwise, extractor<5> { using callable_tag_type = callable_lipart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/ljpart.hpp b/include/kyosu/functions/ljpart.hpp index cbf6c382..c62d3a9f 100644 --- a/include/kyosu/functions/ljpart.hpp +++ b/include/kyosu/functions/ljpart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_ljpart : eve::elementwise, extractor<6> + struct callable_ljpart: eve::elementwise, extractor<6> { using callable_tag_type = callable_ljpart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/lkpart.hpp b/include/kyosu/functions/lkpart.hpp index 452d72a8..dc25879c 100644 --- a/include/kyosu/functions/lkpart.hpp +++ b/include/kyosu/functions/lkpart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_lkpart : eve::elementwise, extractor<7> + struct callable_lkpart: eve::elementwise, extractor<7> { using callable_tag_type = callable_lkpart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/log.hpp b/include/kyosu/functions/log.hpp index f74dee9c..1de6dde2 100644 --- a/include/kyosu/functions/log.hpp +++ b/include/kyosu/functions/log.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_log : eve::elementwise + struct callable_log: eve::elementwise { using callable_tag_type = callable_log; @@ -58,14 +58,14 @@ namespace kyosu //! namespace kyosu //! { //! template constexpr T log(T z) noexcept; //1 -//! template constexpr T log(T z) noexcept; //2 +//! template constexpr T log(T z) noexcept; //2 //! template constexpr T log(T z) noexcept; //2 //! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/log10.hpp b/include/kyosu/functions/log10.hpp index 680c4bfc..3c007234 100644 --- a/include/kyosu/functions/log10.hpp +++ b/include/kyosu/functions/log10.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_log10 : eve::elementwise + struct callable_log10: eve::elementwise { using callable_tag_type = callable_log10; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/log1p.hpp b/include/kyosu/functions/log1p.hpp index 8c6140d0..55edda00 100644 --- a/include/kyosu/functions/log1p.hpp +++ b/include/kyosu/functions/log1p.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_log1p : eve::elementwise + struct callable_log1p: eve::elementwise { using callable_tag_type = callable_log1p; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/log2.hpp b/include/kyosu/functions/log2.hpp index e7369d24..8a2021cf 100644 --- a/include/kyosu/functions/log2.hpp +++ b/include/kyosu/functions/log2.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_log2 : eve::elementwise + struct callable_log2: eve::elementwise { using callable_tag_type = callable_log2; @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/log_abs.hpp b/include/kyosu/functions/log_abs.hpp index f28c087b..974178a5 100644 --- a/include/kyosu/functions/log_abs.hpp +++ b/include/kyosu/functions/log_abs.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_log_abs : eve::elementwise + struct callable_log_abs: eve::elementwise { using callable_tag_type = callable_log_abs; @@ -57,14 +57,14 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template constlog_absr auto log_abs(T z) noexcept; -//! template constlog_absr auto log_abs(T z) noexcept; +//! template constexpr auto log_abs(T z) noexcept; +//! template constexpr auto log_abs(T z) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/lpart.hpp b/include/kyosu/functions/lpart.hpp index 73eb0c74..5fbd8877 100644 --- a/include/kyosu/functions/lpart.hpp +++ b/include/kyosu/functions/lpart.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_lpart : eve::elementwise, extractor<4> + struct callable_lpart: eve::elementwise, extractor<4> { using callable_tag_type = callable_lpart; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/lpnorm.hpp b/include/kyosu/functions/lpnorm.hpp index 00fd6592..15fc99fd 100644 --- a/include/kyosu/functions/lpnorm.hpp +++ b/include/kyosu/functions/lpnorm.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_lpnorm : eve::elementwise + struct callable_lpnorm: eve::elementwise { using callable_tag_type = callable_lpnorm; @@ -57,13 +57,13 @@ namespace kyosu //! namespace kyosu //! { //! template< floating_value P, typename T, typename ... Ts> auto lpnorm(P p, T z,Ts ... zs ) const noexcept -///! } +//! } //! @endcode //! //! **Parameters** //! -//! * `p`: : positive floating ordered value -//! * `zs...` : Values to process. +//! * `p`: : positive floating ordered value +//! * `zs...`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/manhattan.hpp b/include/kyosu/functions/manhattan.hpp index ba2cad73..58877889 100644 --- a/include/kyosu/functions/manhattan.hpp +++ b/include/kyosu/functions/manhattan.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_manhattan : eve::elementwise + struct callable_manhattan: eve::elementwise { using callable_tag_type = callable_manhattan; @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! template< floating_value P, typename ... Ts> auto manhattan(Ts ... zi ) const noexcept -///! } +//! template auto manhattan(Ts ... zi ) const noexcept +//! } //! @endcode //! //! **Parameters** //! -//! * ` zi...` : Values to process. +//! * `zi...`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/maxabs.hpp b/include/kyosu/functions/maxabs.hpp new file mode 100644 index 00000000..f6229ca4 --- /dev/null +++ b/include/kyosu/functions/maxabs.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_maxabs: eve::elementwise + { + using callable_tag_type = callable_maxabs; + + KYOSU_DEFERS_CALLABLE(maxabs_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::maxabs(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var maxabs +//! @brief Callable object computing the maxabs operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto maxabs(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the maximum of the absolute values of the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/maxabs.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_maxabs maxabs = {}; +} diff --git a/include/kyosu/functions/maxmag.hpp b/include/kyosu/functions/maxmag.hpp new file mode 100644 index 00000000..37e25214 --- /dev/null +++ b/include/kyosu/functions/maxmag.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_maxmag: eve::elementwise + { + using callable_tag_type = callable_maxmag; + + KYOSU_DEFERS_CALLABLE(maxmag_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::maxmag(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var maxmag +//! @brief Callable object computing the maxmag operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto maxmag(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the value which has the maximum of the absolute values between the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/maxmag.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_maxmag maxmag = {}; +} diff --git a/include/kyosu/functions/minabs.hpp b/include/kyosu/functions/minabs.hpp new file mode 100644 index 00000000..bf3fd597 --- /dev/null +++ b/include/kyosu/functions/minabs.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_minabs: eve::elementwise + { + using callable_tag_type = callable_minabs; + + KYOSU_DEFERS_CALLABLE(minabs_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::minabs(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var minabs +//! @brief Callable object computing the minabs operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto minabs(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the minimum of the absolute values of the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/minabs.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_minabs minabs = {}; +} diff --git a/include/kyosu/functions/minmag.hpp b/include/kyosu/functions/minmag.hpp new file mode 100644 index 00000000..f6b67a61 --- /dev/null +++ b/include/kyosu/functions/minmag.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_minmag: eve::elementwise + { + using callable_tag_type = callable_minmag; + + KYOSU_DEFERS_CALLABLE(minmag_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::minmag(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var minmag +//! @brief Callable object computing the minmag operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto minmag(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the value which has the minimum of the absolute values between the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/minmag.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_minmag minmag = {}; +} diff --git a/include/kyosu/functions/minus.hpp b/include/kyosu/functions/minus.hpp index 5e6e9b83..d7ae1a0d 100644 --- a/include/kyosu/functions/minus.hpp +++ b/include/kyosu/functions/minus.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_minus : eve::elementwise + struct callable_minus: eve::elementwise { using callable_tag_type = callable_minus; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/nearest.hpp b/include/kyosu/functions/nearest.hpp index de722120..d77f1365 100644 --- a/include/kyosu/functions/nearest.hpp +++ b/include/kyosu/functions/nearest.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_nearest : eve::elementwise + struct callable_nearest: eve::elementwise { using callable_tag_type = callable_nearest; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which nearest is computed. +//! * `z`: Value to for which nearest is computed. //! //! **Return value** //! diff --git a/include/kyosu/functions/negmaxabs.hpp b/include/kyosu/functions/negmaxabs.hpp new file mode 100644 index 00000000..b0cc597d --- /dev/null +++ b/include/kyosu/functions/negmaxabs.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_negmaxabs: eve::elementwise + { + using callable_tag_type = callable_negmaxabs; + + KYOSU_DEFERS_CALLABLE(negmaxabs_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::negmaxabs(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var negmaxabs +//! @brief Callable object computing the negmaxabs operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto negmaxabs(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the negated maximum of the absolute values of the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/negmaxabs.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_negmaxabs negmaxabs = {}; +} diff --git a/include/kyosu/functions/negminabs.hpp b/include/kyosu/functions/negminabs.hpp new file mode 100644 index 00000000..3e1b58b2 --- /dev/null +++ b/include/kyosu/functions/negminabs.hpp @@ -0,0 +1,75 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include + +namespace kyosu::tags +{ + struct callable_negminabs: eve::elementwise + { + using callable_tag_type = callable_negminabs; + + KYOSU_DEFERS_CALLABLE(negminabs_); + + static KYOSU_FORCEINLINE auto deferred_call(auto + , eve::floating_ordered_value auto const&... vs) noexcept + { + return eve::negminabs(vs...); + } + + KYOSU_FORCEINLINE auto operator()(auto const&... targets ) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} + +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var negminabs +//! @brief Callable object computing the negminabs operation. +//! +//! **Defined in Header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace kyosu +//! { +//! template auto negminabs(Ts ... zi ) const noexcept +//! } +//! @endcode +//! +//! **Parameters** +//! +//! * `zi...`: Values to process. +//! +//! **Return value** +//! +//! Returns elementwise the negminimum of the absolute values of the parameters. +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/negminabs.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_negminabs negminabs = {}; +} diff --git a/include/kyosu/functions/oneminus.hpp b/include/kyosu/functions/oneminus.hpp index 100e9cd9..4c7dc8b0 100644 --- a/include/kyosu/functions/oneminus.hpp +++ b/include/kyosu/functions/oneminus.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_oneminus : eve::elementwise + struct callable_oneminus: eve::elementwise { using callable_tag_type = callable_oneminus; @@ -43,7 +43,7 @@ namespace kyosu //! **Defined in Header** //! //! @code -//! #oneminuslude +//! #include //! @endcode //! //! @groupheader{Callable Signatures} @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : argument. +//! * `z`: argument. //! //! **Return value** //! diff --git a/include/kyosu/functions/pow.hpp b/include/kyosu/functions/pow.hpp index a040d9aa..e9797575 100644 --- a/include/kyosu/functions/pow.hpp +++ b/include/kyosu/functions/pow.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_pow : eve::elementwise + struct callable_pow: eve::elementwise { using callable_tag_type = callable_pow; @@ -61,14 +61,14 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto pow(auto z0, auto, z1) noexcept; \\123 +//! constexpr auto pow(auto z0, auto z1) noexcept; \\123 //! constexpr auto pow(auto z0, eve::integral_value n) noexcept; \\4 //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! 1. if both parameters are floating the call will act as if they were converted to complex before call @@ -99,7 +99,7 @@ namespace kyosu //! * pow(\f$+\infty\f$, y) returns \f$+\infty\f$ for any y greater than 0 //! * except where specified above, if any argument is NaN, NaN is returned //! -//! 3. if any parameter as a dimensionnality greater yhan 2, the call is semantically equivalent +//! 3. if any parameter as a dimensionnality greater than 2, the call is semantically equivalent //! to `kyosu::exp(z1*eve::log(z0))` //! //! 4. pow can accept an integral typed second parameter, in this case it is the russian peasant algorithm diff --git a/include/kyosu/functions/pow1p.hpp b/include/kyosu/functions/pow1p.hpp index 42f5eb44..16b9c798 100644 --- a/include/kyosu/functions/pow1p.hpp +++ b/include/kyosu/functions/pow1p.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_pow1p : eve::elementwise + struct callable_pow1p: eve::elementwise { using callable_tag_type = callable_pow1p; @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto average(auto z0, auto, z1) noexcept; +//! constexpr auto average(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/pow_abs.hpp b/include/kyosu/functions/pow_abs.hpp index e2b375d8..e4cee533 100644 --- a/include/kyosu/functions/pow_abs.hpp +++ b/include/kyosu/functions/pow_abs.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -10,7 +10,7 @@ #include namespace kyosu::tags { - struct callable_pow_abs : eve::elementwise + struct callable_pow_abs: eve::elementwise { using callable_tag_type = callable_pow_abs; @@ -41,7 +41,7 @@ namespace kyosu //! @addtogroup functions //! @{ //! @var pow_abs -//! @brief Computes the computing the pow_abs operation \f$(|x|)^y\f$. +//! @brief Computes the computing the pow_abs operation \f$|x|^y\f$. //! //! **Defined in Header** //! @@ -54,13 +54,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto pow_abs(auto z0, auto, z1) noexcept; +//! constexpr auto pow_abs(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/powm1.hpp b/include/kyosu/functions/powm1.hpp index 35320e75..d1101786 100644 --- a/include/kyosu/functions/powm1.hpp +++ b/include/kyosu/functions/powm1.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ #include namespace kyosu::tags { - struct callable_powm1 : eve::elementwise + struct callable_powm1: eve::elementwise { using callable_tag_type = callable_powm1; @@ -55,17 +55,17 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto average(auto z0, auto, z1) noexcept; +//! constexpr auto average(auto z0, auto z1) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Values to process. +//! * `z0`, `z1`: Values to process. //! //! **Return value** //! -//! the call is semantically equivalent to `dec(eve::pow(z0, z1))` +//! the call is semantically equivalent to `dec(eve::pow(z0`, `z1))` //! //! @groupheader{Example} //! diff --git a/include/kyosu/functions/proj.hpp b/include/kyosu/functions/proj.hpp index 75450e3f..47f2a424 100644 --- a/include/kyosu/functions/proj.hpp +++ b/include/kyosu/functions/proj.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_proj : eve::elementwise + struct callable_proj: eve::elementwise { using callable_tag_type = callable_proj; @@ -61,13 +61,13 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to project. +//! * `z`: Value to project. //! //! **Return value** //! //! * For most z, proj(z)==z, but all infinities, even the numbers where one component //! is infinite and the other is NaN, become positive real\n -//! infinity, (inf, 0.0...) or (inf, -0.0...).\n +//! infinity, (inf, 0...) or (inf, -0...).\n //! The sign of the pure (zero) components are the signs of the components of pure(z). //! //! @groupheader{Example} diff --git a/include/kyosu/functions/pure.hpp b/include/kyosu/functions/pure.hpp index b61bf59d..a5261a41 100644 --- a/include/kyosu/functions/pure.hpp +++ b/include/kyosu/functions/pure.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -64,7 +64,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/radinpi.hpp b/include/kyosu/functions/radinpi.hpp index 189b19c0..41653cf9 100644 --- a/include/kyosu/functions/radinpi.hpp +++ b/include/kyosu/functions/radinpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_radinpi : eve::elementwise + struct callable_radinpi: eve::elementwise { using callable_tag_type = callable_radinpi; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/real.hpp b/include/kyosu/functions/real.hpp index 5ace6aac..10e0cfc8 100644 --- a/include/kyosu/functions/real.hpp +++ b/include/kyosu/functions/real.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_real : eve::elementwise, extractor<0> + struct callable_real: eve::elementwise, extractor<0> { using callable_tag_type = callable_real; @@ -69,7 +69,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Original value. +//! * `z`: Original value. //! //! **Return value** //! diff --git a/include/kyosu/functions/rec.hpp b/include/kyosu/functions/rec.hpp index 12238a1c..1f6ceba6 100644 --- a/include/kyosu/functions/rec.hpp +++ b/include/kyosu/functions/rec.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_rec : eve::elementwise + struct callable_rec: eve::elementwise { using callable_tag_type = callable_rec; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/reldist.hpp b/include/kyosu/functions/reldist.hpp index e8617fa8..9598b9aa 100644 --- a/include/kyosu/functions/reldist.hpp +++ b/include/kyosu/functions/reldist.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_reldist : eve::elementwise + struct callable_reldist: eve::elementwise { using callable_tag_type = callable_reldist; @@ -56,13 +56,13 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto reldist(auto z0, auto, z1) noexcept; -///! } +//! constexpr auto reldist(auto z0, auto z1) noexcept; +//! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : Value to process. +//! * `z0`, `z1`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/reverse_horner.hpp b/include/kyosu/functions/reverse_horner.hpp new file mode 100644 index 00000000..89ecbf40 --- /dev/null +++ b/include/kyosu/functions/reverse_horner.hpp @@ -0,0 +1,112 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include +#include +#include + +namespace kyosu::tags +{ + struct callable_reverse_horner: eve::elementwise + { + using callable_tag_type = callable_reverse_horner; + + KYOSU_DEFERS_CALLABLE(reverse_horner_); + + template < eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , Ts const & ... vs) noexcept + { + return eve::reverse_horner(vs...); + } + + template < eve::floating_ordered_value T0, eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , T0 x, kumi::tuple tup) noexcept + { + return eve::reverse_horner(x, tup); + } + + template < typename ... Ts> + KYOSU_FORCEINLINE auto operator()(Ts const& ...targets) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var reverse_horner +//! @brief Implement the reverse_horner scheme to evaluate polynomials +//! +//! If \f$(a_i)_{0\le i\le n-1}\f$ denotes the coefficients of the polynomial by decreasing +//! power order, the Reverse_Horner scheme evaluates the polynom \f$p\f$ at \f$x\f$ by : +//! \f$\displaystyle p(x) = (((a_0x+a_1)x+ ... )x + a_{n-1})\f$.\n +//! For non commutative cases it is a left-reverse_horner scheme. The coefficients +//! are at the left of the x powers. +//! +//! **Defined in header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace eve +//! { +//! template auto reverse_horner(T x, C ... coefs) noexcept; //1 +//! template< auto C, kumi::tuple T> auto reverse_horner(C x, T t) noexcept; //2 +//! +//! } +//! @endcode +//! +//! 1. Polynom is evaluated at x the other inputs are the polynomial coefficients. +//! 2. Polynom is evaluated at x the other input is a range containing the coefficients +//! +//! **Parameters** +//! +//! * `x` : real or cayley-dickson argument. +//! +//! * `coefs...` : real or cayley-dickson arguments. +//! The coefficients by decreasing power order +//! +//! * `t` : kumi::tuple containing The coefficients by decreasing power order. +//! +//! **Return value** +//! +//! The value of the polynom at `x` is returned, according to the formula: +//! \f$\displaystyle p(x) = (((a_{n-1}x+a_{n-2})x+ ... )x + a_0)\f$.\n +//! For non commutative cases it is a rigt-reverse_horner scheme. See [left_reverse_horner](@ref leftreverse_horner) +//! for the left scheme +//! +//! **Notes** +//! +//! If the coefficients are simd values of cardinal N, this means you simultaneously +//! compute the values of N polynomials. +//! * If x is scalar, the polynomials are all computed at the same point +//! * If x is simd, the nth polynomial is computed on the nth value of x +//! +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/reverse_horner.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_reverse_horner reverse_horner = {}; +} diff --git a/include/kyosu/functions/right_horner.hpp b/include/kyosu/functions/right_horner.hpp new file mode 100644 index 00000000..3f68529c --- /dev/null +++ b/include/kyosu/functions/right_horner.hpp @@ -0,0 +1,111 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include +#include +#include + +namespace kyosu::tags +{ + struct callable_right_horner: eve::elementwise + { + using callable_tag_type = callable_right_horner; + + KYOSU_DEFERS_CALLABLE(right_horner_); + + template < eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , Ts const & ... vs) noexcept + { + return eve::horner(vs...); + } + + template < eve::floating_ordered_value T0, eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , T0 x, kumi::tuple tup) noexcept + { + return eve::horner(x, tup); + } + + template < typename ... Ts> + KYOSU_FORCEINLINE auto operator()(Ts const& ...targets) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var right_horner +//! @brief Implement the right_horner scheme to evaluate polynomials +//! +//! If \f$(a_i)_{0\le i\le n-1}\f$ denotes the coefficients of the polynomial by decreasing +//! power order, the Right_Horner scheme evaluates the polynom \f$p\f$ at \f$x\f$ by : +//! \f$\displaystyle p(x) = (a_{n-1}+x(...+x (a_1+ x a_0)) ))\f$.\n +//! For non commutative cases it is a right_horner scheme (the coefficients are at the right of the x powers). +//! +//! **Defined in header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace eve +//! { +//! template auto right_horner(T x, C ... coefs) noexcept; //1 +//! template< auto C, eve::Range R> auto right_horner(T x, R r) noexcept; //2 +//! +//! } +//! @endcode +//! +//! 1. Polynom is evaluated at x the other inputs are the polynomial coefficients. +//! 2. Polynom is evaluated at x the other input is a range containing the coefficients +//! +//! **Parameters** +//! +//! * `x` : real or cayley-dickson argument. +//! +//! * `coefs...` : real or cayley-dickson arguments. +//! The coefficients by decreasing power order +//! +//! * `r` : Range containing The coefficients by decreasing power order. +//! +//! **Return value** +//! +//! The value of the polynom at `x` is returned, according to the formula: +//! \f$\displaystyle p(x) = (a_{n-1}+x(...+x (a_1+ x a_0)) ))\f$.\n +//! For non commutative cases it is a rigt-right_horner scheme. See [horner](@ref horner) +//! for the left scheme +//! +//! **Notes** +//! +//! If the coefficients are simd values of cardinal N, this means you simultaneously +//! compute the values of N polynomials. +//! * If x is scalar, the polynomials are all computed at the same point +//! * If x is simd, the nth polynomial is computed on the nth value of x +//! +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/right_horner.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_right_horner right_horner = {}; +} diff --git a/include/kyosu/functions/right_reverse_horner.hpp b/include/kyosu/functions/right_reverse_horner.hpp new file mode 100644 index 00000000..24d47463 --- /dev/null +++ b/include/kyosu/functions/right_reverse_horner.hpp @@ -0,0 +1,112 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright: KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#pragma once + +#include +#include +#include + +namespace kyosu::tags +{ + struct callable_right_reverse_horner: eve::elementwise + { + using callable_tag_type = callable_right_reverse_horner; + + KYOSU_DEFERS_CALLABLE(right_reverse_horner_); + + template < eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , Ts const & ... vs) noexcept + { + return eve::reverse_horner(vs...); + } + + template < eve::floating_ordered_value T0, eve::floating_ordered_value ... Ts> + static KYOSU_FORCEINLINE auto deferred_call(auto + , T0 x, kumi::tuple tup) noexcept + { + return eve::reverse_horner(x, tup); + } + + template < typename ... Ts> + KYOSU_FORCEINLINE auto operator()(Ts const& ...targets) const noexcept + -> decltype(eve::tag_invoke(*this, targets...)) + { + return eve::tag_invoke(*this, targets...); + } + + template + eve::unsupported_call operator()(T&&... x) const + requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; + }; +} +namespace kyosu +{ +//====================================================================================================================== +//! @addtogroup functions +//! @{ +//! @var right_reverse_horner +//! @brief Implement the right_reverse_horner scheme to evaluate polynomials +//! +//! If \f$(a_i)_{0\le i\le n-1}\f$ denotes the coefficients of the polynomial by increasing +//! power order, the Right_Reverse_Horner scheme evaluates the polynom \f$p\f$ at \f$x\f$ by : +//! \f$\displaystyle p(x) = (a_0+x(...+x (a_{n-2}+ x a_{n-1})) ))\f$.\n +//! For non commutative cases it is a right_reverse_horner scheme +//! (the coefficients are at the right of the x powers). +//! +//! **Defined in header** +//! +//! @code +//! #include +//! @endcode +//! +//! @groupheader{Callable Signatures} +//! +//! @code +//! namespace eve +//! { +//! template auto right_reverse_horner(T x, C ... coefs) noexcept; //1 +//! template< auto C, eve::Range R> auto right_reverse_horner(T x, R r) noexcept; //2 +//! +//! } +//! @endcode +//! +//! 1. Polynom is evaluated at x the other inputs are the polynomial coefficients. +//! 2. Polynom is evaluated at x the other input is a range containing the coefficients +//! +//! **Parameters** +//! +//! * `x` : real or cayley-dickson argument. +//! +//! * `coefs...` : real or cayley-dickson arguments. +//! The coefficients by decreasing power order +//! +//! * `r` : Range containing The coefficients by increasing power order. +//! +//! **Return value** +//! +//! The value of the polynom at `x` is returned, according to the formula: +//! \f$\displaystyle p(x) = (a_0+x(...+x (a_{n-2}+ x a_{n-1})) ))\f$ +//! For non commutative cases it is a right_reverse_horner scheme. See [reverse_horner](@ref reverse_horner) +//! for the left scheme. +//! +//! **Notes** +//! +//! If the coefficients are simd values of cardinal N, this means you simultaneously +//! compute the values of N polynomials. +//! * If x is scalar, the polynomials are all computed at the same point +//! * If x is simd, the nth polynomial is computed on the nth value of x +//! +//! +//! @groupheader{Example} +//! +//! @godbolt{doc/right_reverse_horner.cpp} +//! @} +//====================================================================================================================== +inline constexpr tags::callable_right_reverse_horner right_reverse_horner = {}; +} diff --git a/include/kyosu/functions/rot_angle.hpp b/include/kyosu/functions/rot_angle.hpp index 04464fc8..9af07642 100644 --- a/include/kyosu/functions/rot_angle.hpp +++ b/include/kyosu/functions/rot_angle.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_rot_angle : eve::elementwise + struct callable_rot_angle: eve::elementwise { using callable_tag_type = callable_rot_angle; @@ -47,8 +47,6 @@ namespace kyosu //! //! @brief Callable object computing the normalized angle of rotation defined by a quaternion. //! - //! This function is the reciprocal of from_polar - //! //! **Defined in header** //! //! @code @@ -60,13 +58,13 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto rot_angle( auto q) const noexcept; + //! auto rot_angle(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion, complex or floating + //! `q`: quaternion, complex or floating //! //! **Return value** //! diff --git a/include/kyosu/functions/rot_axis.hpp b/include/kyosu/functions/rot_axis.hpp index bb189c5a..b70f837d 100644 --- a/include/kyosu/functions/rot_axis.hpp +++ b/include/kyosu/functions/rot_axis.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_rot_axis : eve::elementwise + struct callable_rot_axis: eve::elementwise { using callable_tag_type = callable_rot_axis; @@ -47,8 +47,6 @@ namespace kyosu //! //! @brief Callable object computing the normalized axis of rotation defined by a quaternion. //! - //! This function is the reciprocal of from_polar - //! //! **Defined in header** //! //! @code @@ -60,13 +58,13 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto rot_axis( auto q) const noexcept; + //! auto rot_axis(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion, complex or floating. + //! `q`: quaternion, complex or floating. //! //! **Return value** //! diff --git a/include/kyosu/functions/rotate_vec.hpp b/include/kyosu/functions/rotate_vec.hpp index 07c3f1db..1dd3f11d 100644 --- a/include/kyosu/functions/rotate_vec.hpp +++ b/include/kyosu/functions/rotate_vec.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_rotate_vec : eve::elementwise + struct callable_rotate_vec: eve::elementwise { using callable_tag_type = callable_rotate_vec; @@ -80,7 +80,7 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto rotate_vec( auto q, auto v) const noexcept; + //! auto rotate_vec(auto q, auto v) const noexcept; //! } //! @endcode //! diff --git a/include/kyosu/functions/sec.hpp b/include/kyosu/functions/sec.hpp index 7b193ff4..b466000c 100644 --- a/include/kyosu/functions/sec.hpp +++ b/include/kyosu/functions/sec.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sec : eve::elementwise + struct callable_sec: eve::elementwise { using callable_tag_type = callable_sec; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sech.hpp b/include/kyosu/functions/sech.hpp index 94c0f0ff..c9ba9814 100644 --- a/include/kyosu/functions/sech.hpp +++ b/include/kyosu/functions/sech.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sech : eve::elementwise + struct callable_sech: eve::elementwise { using callable_tag_type = callable_sech; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/secpi.hpp b/include/kyosu/functions/secpi.hpp index 046ec24a..58fe514c 100644 --- a/include/kyosu/functions/secpi.hpp +++ b/include/kyosu/functions/secpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_secpi : eve::elementwise + struct callable_secpi: eve::elementwise { using callable_tag_type = callable_secpi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sign.hpp b/include/kyosu/functions/sign.hpp index e28d4c7e..b9768f07 100644 --- a/include/kyosu/functions/sign.hpp +++ b/include/kyosu/functions/sign.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_sign : eve::elementwise + struct callable_sign: eve::elementwise { using callable_tag_type = callable_sign; @@ -61,7 +61,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sin.hpp b/include/kyosu/functions/sin.hpp index 35632931..0c00f379 100644 --- a/include/kyosu/functions/sin.hpp +++ b/include/kyosu/functions/sin.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sin : eve::elementwise + struct callable_sin: eve::elementwise { using callable_tag_type = callable_sin; @@ -60,7 +60,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sinc.hpp b/include/kyosu/functions/sinc.hpp index c1df71f9..6481c6ec 100644 --- a/include/kyosu/functions/sinc.hpp +++ b/include/kyosu/functions/sinc.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sinc : eve::elementwise + struct callable_sinc: eve::elementwise { using callable_tag_type = callable_sinc; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sincos.hpp b/include/kyosu/functions/sincos.hpp index d14ad61a..5185b6fd 100644 --- a/include/kyosu/functions/sincos.hpp +++ b/include/kyosu/functions/sincos.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sincos : eve::elementwise + struct callable_sincos: eve::elementwise { using callable_tag_type = callable_sincos; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sinh.hpp b/include/kyosu/functions/sinh.hpp index 94e117f9..6f03bfea 100644 --- a/include/kyosu/functions/sinh.hpp +++ b/include/kyosu/functions/sinh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sinh : eve::elementwise + struct callable_sinh: eve::elementwise { using callable_tag_type = callable_sinh; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sinhcosh.hpp b/include/kyosu/functions/sinhcosh.hpp index c35f2c6f..42016d9d 100644 --- a/include/kyosu/functions/sinhcosh.hpp +++ b/include/kyosu/functions/sinhcosh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sinhcosh : eve::elementwise + struct callable_sinhcosh: eve::elementwise { using callable_tag_type = callable_sinhcosh; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sinpi.hpp b/include/kyosu/functions/sinpi.hpp index a286302d..431a6998 100644 --- a/include/kyosu/functions/sinpi.hpp +++ b/include/kyosu/functions/sinpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sinpi : eve::elementwise + struct callable_sinpi: eve::elementwise { using callable_tag_type = callable_sinpi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sinpicospi.hpp b/include/kyosu/functions/sinpicospi.hpp index 68943ab5..5446d1be 100644 --- a/include/kyosu/functions/sinpicospi.hpp +++ b/include/kyosu/functions/sinpicospi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_sinpicospi : eve::elementwise + struct callable_sinpicospi: eve::elementwise { using callable_tag_type = callable_sinpicospi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/slerp.hpp b/include/kyosu/functions/slerp.hpp index 0c21f286..d8d3cc1a 100644 --- a/include/kyosu/functions/slerp.hpp +++ b/include/kyosu/functions/slerp.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_slerp : eve::elementwise + struct callable_slerp: eve::elementwise { using callable_tag_type = callable_slerp; @@ -57,14 +57,14 @@ namespace kyosu //! @code //! namespace kyosu //! { -//! constexpr auto lerp(auto z0, auto, z1, floating_ordered_value t) noexcept; +//! constexpr auto slerp(auto z0, auto z1, floating_ordered_value t) noexcept; //! } //! @endcode //! //! **Parameters** //! -//! * `z0, z1` : unitary quaternions to process. -//! * `t` : floating value interpolation coefficient. +//! * `z0`, `z1`: unitary quaternions to process. +//! * `t`: floating value interpolation coefficient. //! //! **Return value** //! diff --git a/include/kyosu/functions/sqr.hpp b/include/kyosu/functions/sqr.hpp index 285b066e..85194400 100644 --- a/include/kyosu/functions/sqr.hpp +++ b/include/kyosu/functions/sqr.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_sqr : eve::elementwise + struct callable_sqr: eve::elementwise { using callable_tag_type = callable_sqr; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which square is computed. +//! * `z`: Value to for which square is computed. //! //! **Return value** //! diff --git a/include/kyosu/functions/sqr_abs.hpp b/include/kyosu/functions/sqr_abs.hpp index 8e52711f..04ab7dd1 100644 --- a/include/kyosu/functions/sqr_abs.hpp +++ b/include/kyosu/functions/sqr_abs.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_sqr_abs : eve::elementwise + struct callable_sqr_abs: eve::elementwise { using callable_tag_type = callable_sqr_abs; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/sqrt.hpp b/include/kyosu/functions/sqrt.hpp index a06f3071..5a171172 100644 --- a/include/kyosu/functions/sqrt.hpp +++ b/include/kyosu/functions/sqrt.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_sqrt : eve::elementwise + struct callable_sqrt: eve::elementwise { using callable_tag_type = callable_sqrt; @@ -65,7 +65,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which square root is computed. +//! * `z`: Value to for which square root is computed. //! //! **Return value** //! diff --git a/include/kyosu/functions/tan.hpp b/include/kyosu/functions/tan.hpp index 07ed7dc2..4904ebba 100644 --- a/include/kyosu/functions/tan.hpp +++ b/include/kyosu/functions/tan.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_tan : eve::elementwise + struct callable_tan: eve::elementwise { using callable_tag_type = callable_tan; @@ -60,7 +60,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/tanh.hpp b/include/kyosu/functions/tanh.hpp index fc20bd97..e86f4a29 100644 --- a/include/kyosu/functions/tanh.hpp +++ b/include/kyosu/functions/tanh.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_tanh : eve::elementwise + struct callable_tanh: eve::elementwise { using callable_tag_type = callable_tanh; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/tanpi.hpp b/include/kyosu/functions/tanpi.hpp index fefc2d91..ccf7ff0f 100644 --- a/include/kyosu/functions/tanpi.hpp +++ b/include/kyosu/functions/tanpi.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_tanpi : eve::elementwise + struct callable_tanpi: eve::elementwise { using callable_tag_type = callable_tanpi; @@ -59,7 +59,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to process. +//! * `z`: Value to process. //! //! **Return value** //! diff --git a/include/kyosu/functions/to_angle_axis.hpp b/include/kyosu/functions/to_angle_axis.hpp index d8af749b..c1e5972c 100644 --- a/include/kyosu/functions/to_angle_axis.hpp +++ b/include/kyosu/functions/to_angle_axis.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_angle_axis : eve::elementwise + struct callable_to_angle_axis: eve::elementwise { using callable_tag_type = callable_to_angle_axis; @@ -46,7 +46,7 @@ namespace kyosu //! @{ //! @var to_angle_axis //! - //! @brief Callable object computing the angle_axis coordinates from a quaternion. + //! @brief Callable object computing the angle and axis coordinates from a quaternion. //! //! This function is the reciprocal of from_angle_axis //! @@ -61,18 +61,18 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_angle_axis( auto q) const noexcept; + //! auto to_angle_axis(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `rho1`, 'theta1', `rho2` 'theta2': the moduli - //! and the angles in radian of the angle_axis \f$\mathbb{R}^4\f$ coordinates + //! a tuple an angle of rotation and a vector of \f$\mathbb{R}^3\f$ + //! representing the direction of the rotation axis. //! //! --- //! diff --git a/include/kyosu/functions/to_complex.hpp b/include/kyosu/functions/to_complex.hpp index cb29647a..ed67def0 100644 --- a/include/kyosu/functions/to_complex.hpp +++ b/include/kyosu/functions/to_complex.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -55,8 +55,8 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Complex value. -//! * `r`, `i` : Real and imaginary part used to construct a @ref kyosu::complex.. +//! * `z` : Complex value. +//! * `r`, `i` : Real and imaginary part used to construct a @ref kyosu::complex.. //! //! **Return value** //! diff --git a/include/kyosu/functions/to_cylindrical.hpp b/include/kyosu/functions/to_cylindrical.hpp index 68a9c42d..48c8c324 100644 --- a/include/kyosu/functions/to_cylindrical.hpp +++ b/include/kyosu/functions/to_cylindrical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_cylindrical : eve::elementwise + struct callable_to_cylindrical: eve::elementwise { using callable_tag_type = callable_to_cylindrical; @@ -62,17 +62,17 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_cylindrical( auto q) const noexcept; + //! auto to_cylindrical(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `rho1`, 'theta1', `h1` 'h2': the components + //! a tuple containing in this order `rho1`, `theta1`, `h1`, `h2`: the components //! of the cylindrical parametrisation of \f$\mathbb{R}^4\f$ coordinates //! //! --- diff --git a/include/kyosu/functions/to_cylindrospherical.hpp b/include/kyosu/functions/to_cylindrospherical.hpp index 1118c0dd..7b0f8e94 100644 --- a/include/kyosu/functions/to_cylindrospherical.hpp +++ b/include/kyosu/functions/to_cylindrospherical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_cylindrospherical : eve::elementwise + struct callable_to_cylindrospherical: eve::elementwise { using callable_tag_type = callable_to_cylindrospherical; @@ -62,17 +62,17 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_cylindrospherical( auto q) const noexcept; + //! auto to_cylindrospherical(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `t`, 'radius', `longitude` 'latitude': the components + //! a tuple containing in this order `t`, `radius`, `longitude` `latitude`: the components //! of the cylindrospherical parametrisation of \f$\mathbb{R}^4\f$ coordinates //! //! --- diff --git a/include/kyosu/functions/to_euler.hpp b/include/kyosu/functions/to_euler.hpp index ed8830ee..392a2702 100644 --- a/include/kyosu/functions/to_euler.hpp +++ b/include/kyosu/functions/to_euler.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_to_euler : eve::elementwise + struct callable_to_euler: eve::elementwise { using callable_tag_type = callable_to_euler; @@ -87,25 +87,24 @@ namespace kyosu //! namespace eve //! { //! template < int I, int J, int K > - //! auto to_euler(auto q - //! , axis const & a1, axis const & a2, axis const & a3) const noexcept - //! requires(I != J && J != K) + //! auto to_euler(auto q, axis const & a1, axis const & a2, axis const & a3) noexcept + //! requires(I != J && J != K) //! } //! @endcode //! //! **Parameters** //! //! * `q` the rotation quaternion (not necesseraly normalized) - //! * `a1`, `a2`, `a3` : the axis parameters to be chosen between X_, Y_, Z_ (two consecutive axis cannot be the same) + //! * `a1`, `a2`, `a3`: the axis parameters to be chosen between X_, Y_, Z_ (two consecutive axis cannot be the same) //! * depending of the euler order //! //! **Template parameters** //! - //! * I, J, K : actual parameters can be chosen between axis values X_, Y_, Z_ from + //! * I, J, K: actual parameters can be chosen between axis values X_, Y_, Z_ from //! which I, J and K are deduced //! //! - //! The computation method is taken from the article : "Quaternion to Euler angles conversion: A + //! The computation method is taken from the article: "Quaternion to Euler angles conversion: A //! direct, general and computationally efficient method". PLoS ONE //! 17(11): e0276302. https://doi.org/10.1371/journal pone 0276302. //! Evandro Bernardes, and Stephane Viollet diff --git a/include/kyosu/functions/to_multipolar.hpp b/include/kyosu/functions/to_multipolar.hpp index 2fea07be..cd000d8c 100644 --- a/include/kyosu/functions/to_multipolar.hpp +++ b/include/kyosu/functions/to_multipolar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_multipolar : eve::elementwise + struct callable_to_multipolar: eve::elementwise { using callable_tag_type = callable_to_multipolar; @@ -62,17 +62,17 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_multipolar( auto q) const noexcept; + //! auto to_multipolar(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `rho1`, 'theta1', `rho2` 'theta2': the moduli + //! a tuple containing in this order `rho1`, `theta1`, `rho2` `theta2`: the moduli //! and the angles in radian of the multipolar \f$\mathbb{R}^4\f$ coordinates //! //! --- diff --git a/include/kyosu/functions/to_polar.hpp b/include/kyosu/functions/to_polar.hpp index 60afd958..9c9910b8 100644 --- a/include/kyosu/functions/to_polar.hpp +++ b/include/kyosu/functions/to_polar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_polar : eve::elementwise + struct callable_to_polar: eve::elementwise { using callable_tag_type = callable_to_polar; @@ -70,7 +70,7 @@ namespace kyosu //! //! **Parameters** //! - //! `q` : cayley dickson value + //! `q`: cayley dickson value //! //! **Return value** //! diff --git a/include/kyosu/functions/to_quaternion.hpp b/include/kyosu/functions/to_quaternion.hpp index b122936f..2a2103ca 100644 --- a/include/kyosu/functions/to_quaternion.hpp +++ b/include/kyosu/functions/to_quaternion.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -56,9 +56,9 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Quaternion value. -//! * `c0 `,`c1` : Complex values generates the quaternion c0+j*conj(c1) i.e. real(c0+i*imag(c1)+j*real(1)+k*imag(c1) -//! * `r`, `i`, `j`, `k` : Real and unreal parts sued to construct a @ref kyosu::quaternion from its components +//! * `z` : Quaternion value. +//! * `c0 `,`c1` : Complex values generates the quaternion c0+j*conj(c1) i.e. real(c0+i*imag(c1)+j*real(1)+k*imag(c1) +//! * `r`, `i`, `j`, `k` : Real and unreal parts sued to construct a @ref kyosu::quaternion from its components //! //! **Return value** //! diff --git a/include/kyosu/functions/to_rotation_matrix.hpp b/include/kyosu/functions/to_rotation_matrix.hpp index 398c96ad..cac4b94c 100644 --- a/include/kyosu/functions/to_rotation_matrix.hpp +++ b/include/kyosu/functions/to_rotation_matrix.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -13,7 +13,7 @@ namespace kyosu::tags { - struct callable_to_rotation_matrix : eve::elementwise + struct callable_to_rotation_matrix: eve::elementwise { using callable_tag_type = callable_to_rotation_matrix; @@ -93,7 +93,7 @@ namespace kyosu //! **Parameters** //! //! * `q` quaternion representing the rotation - //! * `assume_normalized``: suppose that q is already normalized + //! * `assume_normalized`: suppose that q is already normalized //! //! //! diff --git a/include/kyosu/functions/to_semipolar.hpp b/include/kyosu/functions/to_semipolar.hpp index 75a03cfa..b497946b 100644 --- a/include/kyosu/functions/to_semipolar.hpp +++ b/include/kyosu/functions/to_semipolar.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_semipolar : eve::elementwise + struct callable_to_semipolar: eve::elementwise { using callable_tag_type = callable_to_semipolar; @@ -62,17 +62,17 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_semipolar( auto q) const noexcept; + //! auto to_semipolar(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `rho1`, 'theta1', `h1` 'h2': the components + //! a tuple containing in this order `rho1`, `theta1`, `h1` `h2`: the components //! of the semipolar parametrisation of \f$\mathbb{R}^4\f$ coordinates //! //! --- diff --git a/include/kyosu/functions/to_spherical.hpp b/include/kyosu/functions/to_spherical.hpp index 88b59a8c..15d05828 100644 --- a/include/kyosu/functions/to_spherical.hpp +++ b/include/kyosu/functions/to_spherical.hpp @@ -1,7 +1,7 @@ //================================================================================================== /* KYOSU - Expressive Vector Engine - Copyright : KYOSU Project Contributors + Copyright: KYOSU Project Contributors SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== @@ -12,7 +12,7 @@ namespace kyosu::tags { - struct callable_to_spherical : eve::elementwise + struct callable_to_spherical: eve::elementwise { using callable_tag_type = callable_to_spherical; @@ -62,17 +62,17 @@ namespace kyosu //! @code //! namespace eve //! { - //! auto to_spherical( auto q) const noexcept; + //! auto to_spherical(auto q) const noexcept; //! } //! @endcode //! //! **Parameters** //! - //! `q` : quaternion + //! `q`: quaternion //! //! **Return value** //! - //! a tuple containing in this order `rho`, 'theta', `ph1` 'ph2': the components + //! a tuple containing in this order `rho`, `theta`, `ph1` `ph2`: the components //! of the spherical parametrisation of \f$\mathbb{R}^4\f$ coordinates //! //! --- diff --git a/include/kyosu/functions/trunc.hpp b/include/kyosu/functions/trunc.hpp index 810ccbaa..2a592dde 100644 --- a/include/kyosu/functions/trunc.hpp +++ b/include/kyosu/functions/trunc.hpp @@ -1,7 +1,7 @@ //====================================================================================================================== /* Kyosu - Complex Without Complexes - Copyright : KYOSU Contributors & Maintainers + Copyright: KYOSU Contributors & Maintainers SPDX-License-Identifier: BSL-1.0 */ //====================================================================================================================== @@ -11,7 +11,7 @@ namespace kyosu::tags { - struct callable_trunc : eve::elementwise + struct callable_trunc: eve::elementwise { using callable_tag_type = callable_trunc; @@ -58,7 +58,7 @@ namespace kyosu //! //! **Parameters** //! -//! * `z` : Value to for which trunc is computed. +//! * `z`: Value to for which trunc is computed. //! //! **Return value** //! diff --git a/include/kyosu/types/impl/arithmetic.hpp b/include/kyosu/types/impl/arithmetic.hpp index 8e494810..31d99e32 100644 --- a/include/kyosu/types/impl/arithmetic.hpp +++ b/include/kyosu/types/impl/arithmetic.hpp @@ -212,18 +212,6 @@ namespace kyosu::_ return kyosu::if_else(kyosu::is_nez(c), c/abs(c), C(0)); } - template - KYOSU_FORCEINLINE constexpr - auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1) noexcept - { - using r_t = kyosu::as_cayley_dickson_t; - using er_t = eve::element_type_t; - return r_t{kumi::map([](auto const& e, auto const& f) { return eve::average(e, f); } - , kyosu::convert(c0, eve::as()) - , kyosu::convert(c1, eve::as()) - ) - }; - } template KYOSU_FORCEINLINE constexpr @@ -344,4 +332,218 @@ namespace kyosu::_ return (c0*c1)*c2 - c0*(c1*c2); } } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return c0*c1+c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return c0*c1-c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return c0+c1*c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return -c0+c1*c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return -c0*c1+c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, C2 const & c2) noexcept + { + return -c0*c1-c2; + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of, Cs const & ...cs) noexcept + { + using r_t = kyosu::as_cayley_dickson_t; + return eve::horner(kyosu::convert(cs, eve::as())...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C x, kumi::tuple tup) noexcept + { + return kumi::apply( [&](auto... m) { return horner(x, m...); }, tup); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of, Cs const & ...cs) noexcept + { + using r_t = kyosu::as_cayley_dickson_t; + return eve::reverse_horner(kyosu::convert(cs, eve::as())...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C x, kumi::tuple tup) noexcept + { + return kumi::apply( [&](auto... m) { return reverse_horner(x, m...); }, tup); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of, C0 const & xx, Cs ...cs) noexcept + { + using r_t = kyosu::as_cayley_dickson_t; + constexpr size_t N = sizeof...(Cs); + if constexpr( N == 0 ) return r_t(0); + else if constexpr( N == 1 ) return (kyosu::convert(cs, eve::as()), ...); + else + { + r_t x = convert(xx, eve::as()); + auto dfma = /*d*/(fma); + r_t that(eve::zero(eve::as>())); + auto next = [&](auto that, auto arg) { return dfma(x, that, arg); }; + ((that = next(that, cs)), ...); + return that; + } + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C x, kumi::tuple tup) noexcept + { + return kumi::apply( [&](auto... m) { return right_horner(x, m...); }, tup); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of, C xx, Cs const & ...cs) noexcept + { + using r_t = kyosu::as_cayley_dickson_t; + auto x = convert(xx, eve::as()); + using t_t = kumi::result::generate_t; + t_t tup{convert(cs, eve::as())...}; + return /*d*/(right_reverse_horner)(x, tup); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C x, kumi::tuple tup) noexcept + { + return right_horner(x, kumi::reverse(tup)); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, Cs const &... zs) noexcept + { + if constexpr(sizeof...(zs) == 0) return 0.0f; + else return eve::max(kyosu::abs(zs)...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, Cs const &... zs) noexcept + { + if constexpr(sizeof...(zs) == 0) return 0.0f; + else return eve::min(kyosu::abs(zs)...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, Cs const &... zs) noexcept + { + if constexpr(sizeof...(zs) == 0) return 0.0f; + else return -eve::max(kyosu::abs(zs)...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, Cs const &... zs) noexcept + { + if constexpr(sizeof...(zs) == 0) return 0.0f; + else return -eve::min(kyosu::abs(zs)...); + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const& + , C0 const & c0 + , C1 const & c1 + , Cs const &... cs) noexcept + { + if constexpr(sizeof...(cs) == 0) + { + auto ac0 = kyosu::sqr_abs(c0); + auto ac1 = kyosu::sqr_abs(c1); + auto tmp = kyosu::if_else(eve::is_not_greater_equal(ac0, ac1), c1, c0); + return kyosu::if_else(eve::is_not_greater_equal(ac1, ac0), c0, tmp); + } + else + { + using r_t = kyosu::as_cayley_dickson_t; + r_t that(maxmag(c0, c1)); + ((that = maxmag(that, cs)), ...); + return that; + } + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const& + , C0 const & c0 + , C1 const & c1 + , Cs const &... cs) noexcept + { + if constexpr(sizeof...(cs) == 0) + { + auto ac0 = kyosu::sqr_abs(c0); + auto ac1 = kyosu::sqr_abs(c1); + auto tmp = kyosu::if_else(eve::is_not_greater_equal(ac1, ac0), c1, c0); + return kyosu::if_else(eve::is_not_greater_equal(ac0, ac1), c0, tmp); + } + else + { + using r_t = kyosu::as_cayley_dickson_t; + r_t that(minmag(c0, c1)); + ((that = minmag(that, cs)), ...); + return that; + } + } + + template + KYOSU_FORCEINLINE constexpr + auto dispatch(eve::tag_of const&, C0 const & c0, C1 const & c1, Cs const &... cs) noexcept + { + using r_t = kyosu::as_cayley_dickson_t; + if constexpr(sizeof...(cs) == 0) + { + using er_t = eve::element_type_t; + return r_t{kumi::map([](auto const& e, auto const& f) { return eve::average(e, f); } + , kyosu::convert(c0, eve::as()) + , kyosu::convert(c1, eve::as()) + ) + }; + } + else + { + return (c0+ (c1+ ... + cs)) / (sizeof...(cs) + 2); + } + } } diff --git a/include/kyosu/types/impl/math.hpp b/include/kyosu/types/impl/math.hpp index d519a7cb..5523f4ea 100644 --- a/include/kyosu/types/impl/math.hpp +++ b/include/kyosu/types/impl/math.hpp @@ -60,7 +60,10 @@ namespace kyosu::_ } else { - return dec(exp(z)); + auto p = pure(z); + auto az = abs(p); + auto c = expm1(complex(real(z), az)); + return real(c) + ipart(c)*sign(p); } } diff --git a/include/kyosu/types/octonion.hpp b/include/kyosu/types/octonion.hpp index abd290f8..18b8b6b0 100644 --- a/include/kyosu/types/octonion.hpp +++ b/include/kyosu/types/octonion.hpp @@ -15,9 +15,9 @@ namespace kyosu //! @addtogroup types //! @{ //! @typedef octonion_t - //! @brief Type alias for quaternion numbers + //! @brief Type alias for octonion numbers //! - //! Quaternion numbers are implemented as Caley-dickson numbers of dimension 4. + //! Octonion numbers are implemented as Caley-dickson numbers of dimension 8. //! //! @} //==================================================================================================================== diff --git a/test/doc/average.cpp b/test/doc/average.cpp index fde43861..bd66f0bd 100644 --- a/test/doc/average.cpp +++ b/test/doc/average.cpp @@ -42,8 +42,8 @@ int main() std::cout << wq0 << ", " << wq1 << " -> " << average(wq0, wq1) << "\n"; std::cout << "Mixed: "<< "\n"; - std::cout << kyosu::average(c0, q1) << std::endl; - std::cout << kyosu::average(e0, q1) << std::endl; + std::cout << kyosu::average(c0, q1, e0) << std::endl; + std::cout << kyosu::average(e0, q1, c1) << std::endl; std::cout << kyosu::average(c0, wq1) << std::endl; std::cout << kyosu::average(we0, q1) << std::endl; diff --git a/test/doc/fam.cpp b/test/doc/fam.cpp new file mode 100644 index 00000000..3002e660 --- /dev/null +++ b/test/doc/fam.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fam; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fam(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fam(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fam(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fam(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fam(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fam(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fam(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fam(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fam(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fam(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fam(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/fma.cpp b/test/doc/fma.cpp new file mode 100644 index 00000000..809e67ee --- /dev/null +++ b/test/doc/fma.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fma; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fma(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fma(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fma(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fma(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fma(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fma(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fma(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fma(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fma(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fma(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fma(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/fms.cpp b/test/doc/fms.cpp new file mode 100644 index 00000000..b76722d9 --- /dev/null +++ b/test/doc/fms.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fms; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fms(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fms(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fms(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fms(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fms(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fms(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fms(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fms(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fms(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fms(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fms(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/fnma.cpp b/test/doc/fnma.cpp new file mode 100644 index 00000000..81b27e47 --- /dev/null +++ b/test/doc/fnma.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fnma; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fnma(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fnma(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fnma(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fnma(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fnma(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fnma(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fnma(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fnma(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fnma(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fnma(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fnma(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/fnms.cpp b/test/doc/fnms.cpp new file mode 100644 index 00000000..ac1458b2 --- /dev/null +++ b/test/doc/fnms.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fnms; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fnms(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fnms(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fnms(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fnms(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fnms(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fnms(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fnms(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fnms(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fnms(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fnms(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fnms(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/from_angle_axis.cpp b/test/doc/from_angle_axis.cpp index 0613e52e..65595e1f 100644 --- a/test/doc/from_angle_axis.cpp +++ b/test/doc/from_angle_axis.cpp @@ -21,5 +21,7 @@ int main() std::cout << " ->theta = " << aa << std::endl; std::cout << " -> axis = (" << axx[0] << ", " << axx[1] << ", " << axx[2] << ")" << std::endl; + std::array azz{0., 0., 0.}; + std::cout << kyosu::from_angle_axis(theta, azz) << std::endl; return 0; } diff --git a/test/doc/fsm.cpp b/test/doc/fsm.cpp new file mode 100644 index 00000000..2d0da4df --- /dev/null +++ b/test/doc/fsm.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +int main() +{ + using kyosu::fsm; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + e_t e2(3); + std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fsm(e0, e1, e2) << "\n"; + std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fsm(e0, e0, e2) << "\n"; + we_t we0(e0); + we_t we1(e1); + we_t we2(e2, e0); + std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fsm(we0, we1, we2) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(1, 5); + c_t c1(5, 9); + c_t c2(2, -5); + std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fsm(c0, c1, e2) << "\n"; + std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fsm(c0, c0, e2) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(1, 5, 2, 3); + q_t q1(5, 9, 6, 7); + q_t q2(7, -3, 0, 1); + wq_t wq1(q1, q2); + std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fsm(q0, q1, q2) << "\n"; + std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fsm(q0, q0, q2) << "\n"; + + std::cout << "Mixed: "<< "\n"; + std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fsm(c0, q1, e2) << std::endl; + std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fsm(e0, q1, q2) << std::endl; + std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fsm(c0, we1, q2) << std::endl; + std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fsm(we0, q1, e2) << std::endl; + + return 0; +} diff --git a/test/doc/horner.cpp b/test/doc/horner.cpp new file mode 100644 index 00000000..721721f0 --- /dev/null +++ b/test/doc/horner.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +int main() +{ + + std::array a{1, 2, 3, 4, 5, 6, 7, 8, 11, 21, 31, 41, 51, 61, 71, 81}; + std::cout << "horner(a[0],a[1],a[2],a[3], a[4]) " << kyosu::horner(a[0],a[1],a[2],a[3], a[4]) << std::endl; + + auto x = kyosu::quaternion(a[0],a[1],a[2],a[3]); + auto q1= kyosu::quaternion(a[4],a[5],a[6],a[7]); + auto q2= kyosu::quaternion(a[8],a[9],a[10],a[11]); + auto q3= kyosu::quaternion(a[12],a[13],a[14],a[15]); + std::cout << "horner(x, q1, q2, q3) " << kyosu::horner(x, q1, q2, q3) << std::endl; + auto x1= kyosu::complex(a[1],a[6]); + auto c1= kyosu::complex(a[4],a[3]); + auto c2= kyosu::complex(a[8],a[9]); + auto c3= kyosu::complex(a[1],a[2]); + std::cout << "horner(x, q1, c2, a[2]) " << kyosu::horner(x, q1, c2, a[12]) << std::endl; + std::cout << "horner(x, c1, c2, c3) " << kyosu::horner(x, c1, c2, c3) << std::endl; + std::cout << "horner(x1, c1, c2, c3) " << kyosu::horner(x1, c1, c2, c3) << std::endl; + auto o1= kyosu::cayley_dickson(a[4],a[5],a[6],a[7], a[8],a[9],a[10],a[11]); + auto o2= kyosu::cayley_dickson(a[0],a[1],a[2],a[3], a[8],a[9],a[10],a[11]); + auto o3= kyosu::cayley_dickson(a[12],a[13],a[14],a[15],a[4],a[5],a[6],a[7]); + std::cout << "horner(x, o1, c2, a[2]) " << kyosu::horner(x, o1, c2, a[2]) << std::endl; + std::cout << "horner(x, o1, o2, o3) " << kyosu::horner(x, o1, o2, o3) << std::endl; +}; diff --git a/test/doc/maxabs.cpp b/test/doc/maxabs.cpp new file mode 100644 index 00000000..2cbfc9cd --- /dev/null +++ b/test/doc/maxabs.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::maxabs; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << maxabs(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << maxabs(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << maxabs(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << maxabs(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << maxabs(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << maxabs(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/maxmag.cpp b/test/doc/maxmag.cpp new file mode 100644 index 00000000..183b08b8 --- /dev/null +++ b/test/doc/maxmag.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::maxmag; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << maxmag(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << maxmag(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << maxmag(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << maxmag(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << maxmag(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << maxmag(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/minabs.cpp b/test/doc/minabs.cpp new file mode 100644 index 00000000..0aa0a511 --- /dev/null +++ b/test/doc/minabs.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::minabs; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << minabs(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << minabs(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << minabs(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << minabs(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << minabs(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << minabs(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/minmag.cpp b/test/doc/minmag.cpp new file mode 100644 index 00000000..bbf94821 --- /dev/null +++ b/test/doc/minmag.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::minmag; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << minmag(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << minmag(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << minmag(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << minmag(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << minmag(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << minmag(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/negmaxabs.cpp b/test/doc/negmaxabs.cpp new file mode 100644 index 00000000..46773b9f --- /dev/null +++ b/test/doc/negmaxabs.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::negmaxabs; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << negmaxabs(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << negmaxabs(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << negmaxabs(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << negmaxabs(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << negmaxabs(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << negmaxabs(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/negminabs.cpp b/test/doc/negminabs.cpp new file mode 100644 index 00000000..70d70e2b --- /dev/null +++ b/test/doc/negminabs.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +int main() +{ + using kyosu::negminabs; + using kyosu::complex_t; + using kyosu::quaternion_t; + using e_t = float; + using c_t = kyosu::complex_t; + using q_t = kyosu::quaternion_t; + using we_t = eve::wide>; + using wc_t = eve::wide, eve::fixed<2>>; + using wq_t = eve::wide, eve::fixed<2>>; + + std::cout << "Real: "<< "\n"; + e_t e0(1); + e_t e1(2); + std::cout << e0 << ", " << e1 << " -> " << negminabs(e0, e1) << "\n"; + we_t we0(e0); + we_t we1(e1); + std::cout << we0 << ", " << we1 << " -> " << negminabs(we0, we1) << "\n"; + + std::cout << "Complex: "<< "\n"; + c_t c0(5); + c_t c1(5, 9); + std::cout << c0 << ", " << c1 << " -> " << negminabs(c0, c1) << "\n"; + wc_t wc0(c0); + wc_t wc1(c1); + std::cout << wc0 << ", " << wc1 << " -> " << negminabs(wc0, wc1) << "\n"; + + std::cout << "Quaternion: "<< "\n"; + q_t q0(5, 2, 3); + q_t q1(5, 9, 6, 7); + std::cout << q0 << ", " << q1 << " -> " << negminabs(q0, q1) << "\n"; + wq_t wq0(q0); + wq_t wq1(q1); + std::cout << wq0 << ", " << wq1 << " -> " << negminabs(wq0, wq1) << "\n"; + + return 0; +} diff --git a/test/doc/reverse_horner.cpp b/test/doc/reverse_horner.cpp new file mode 100644 index 00000000..78a3f1cf --- /dev/null +++ b/test/doc/reverse_horner.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +int main() +{ + + std::array a{1, 2, 3, 4, 5, 6, 7, 8, 11, 21, 31, 41, 51, 61, 71, 81}; + std::cout << "reverse_horner(a[0],a[1],a[2],a[3], a[4]) " << kyosu::reverse_horner(a[0],a[1],a[2],a[3], a[4]) << std::endl; + + auto x = kyosu::quaternion(a[0],a[1],a[2],a[3]); + auto q1= kyosu::quaternion(a[4],a[5],a[6],a[7]); + auto q2= kyosu::quaternion(a[8],a[9],a[10],a[11]); + auto q3= kyosu::quaternion(a[12],a[13],a[14],a[15]); + std::cout << "reverse_horner(x, q1, q2, q3) " << kyosu::reverse_horner(x, q1, q2, q3) << std::endl; + auto x1= kyosu::complex(a[1],a[6]); + auto c1= kyosu::complex(a[4],a[3]); + auto c2= kyosu::complex(a[8],a[9]); + auto c3= kyosu::complex(a[1],a[2]); + std::cout << "reverse_horner(x, q1, c2, a[2]) " << kyosu::reverse_horner(x, q1, c2, a[12]) << std::endl; + std::cout << "reverse_horner(x, c1, c2, c3) " << kyosu::reverse_horner(x, c1, c2, c3) << std::endl; + std::cout << "reverse_horner(x1, c1, c2, c3) " << kyosu::reverse_horner(x1, c1, c2, c3) << std::endl; + auto o1= kyosu::cayley_dickson(a[4],a[5],a[6],a[7], a[8],a[9],a[10],a[11]); + auto o2= kyosu::cayley_dickson(a[0],a[1],a[2],a[3], a[8],a[9],a[10],a[11]); + auto o3= kyosu::cayley_dickson(a[12],a[13],a[14],a[15],a[4],a[5],a[6],a[7]); + std::cout << "reverse_horner(x, o1, o2, o3) " << kyosu::reverse_horner(x, o1, o2, o3) << std::endl; + std::cout << "reverse_horner(x, o1, c2, a[2]) " << kyosu::reverse_horner(x, o1, c2, a[12]) << std::endl; +}; diff --git a/test/doc/right_horner.cpp b/test/doc/right_horner.cpp new file mode 100644 index 00000000..afeeedcd --- /dev/null +++ b/test/doc/right_horner.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +int main() +{ + + std::array a{1, 2, 3, 4, 5, 6, 7, 8, 11, 21, 31, 41, 51, 61, 71, 81}; + std::cout << "right_horner(a[0],a[1],a[2],a[3], a[4]) " << kyosu::right_horner(a[0],a[1],a[2],a[3], a[4]) << std::endl; + + auto x = kyosu::quaternion(a[0],a[1],a[2],a[3]); + auto q1= kyosu::quaternion(a[4],a[5],a[6],a[7]); + auto q2= kyosu::quaternion(a[8],a[9],a[10],a[11]); + auto q3= kyosu::quaternion(a[12],a[13],a[14],a[15]); + std::cout << "right_horner(x, q1, q2, q3) " << kyosu::right_horner(x, q1, q2, q3) << std::endl; + auto x1= kyosu::complex(a[1],a[6]); + auto c1= kyosu::complex(a[4],a[3]); + auto c2= kyosu::complex(a[8],a[9]); + auto c3= kyosu::complex(a[1],a[2]); + std::cout << "right_horner(x1, q1, c2, a[2]) " << kyosu::right_horner(x1, q1, c2, a[12]) << std::endl; +// auto z = kyosu::right_horner(x1, c1, c2, c3); +// std::cout << z << std::endl; + std::cout << "right_horner(x, c1, c2, c3) " << kyosu::right_horner(x, c1, c2, c3) << std::endl; + std::cout << "right_horner(x1, c1, c2, c3) " << kyosu::right_horner(x1, c1, c2, c3) << std::endl; + auto o1= kyosu::cayley_dickson(a[4],a[5],a[6],a[7], a[8],a[9],a[10],a[11]); + auto o2= kyosu::cayley_dickson(a[0],a[1],a[2],a[3], a[8],a[9],a[10],a[11]); + auto o3= kyosu::cayley_dickson(a[12],a[13],a[14],a[15],a[4],a[5],a[6],a[7]); + std::cout << "right_horner(x, o1, o2, o3 ) " << kyosu::right_horner(x, o1, o2, o3 ) << std::endl; + std::cout << "right_horner(x, o1, c2, a[2]) " << kyosu::right_horner(x, o1, c2, a[12]) << std::endl; +}; diff --git a/test/doc/right_reverse_horner.cpp b/test/doc/right_reverse_horner.cpp new file mode 100644 index 00000000..ccd0079e --- /dev/null +++ b/test/doc/right_reverse_horner.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +int main() +{ + + std::array a{1, 2, 3, 4, 5, 6, 7, 8, 11, 21, 31, 41, 51, 61, 71, 81}; + std::cout << "right_reverse_horner(a[0],a[1],a[2],a[3], a[4]) " << kyosu::right_reverse_horner(a[0],a[1],a[2],a[3], a[4]) << std::endl; + + auto x = kyosu::quaternion(a[0],a[1],a[2],a[3]); + auto q1= kyosu::quaternion(a[4],a[5],a[6],a[7]); + auto q2= kyosu::quaternion(a[8],a[9],a[10],a[11]); + auto q3= kyosu::quaternion(a[12],a[13],a[14],a[15]); + std::cout << "right_reverse_horner(x, q1, q2, q3) " << kyosu::right_reverse_horner(x, q1, q2, q3) << std::endl; + auto x1= kyosu::complex(a[1],a[6]); + auto c1= kyosu::complex(a[4],a[3]); + auto c2= kyosu::complex(a[8],a[9]); + auto c3= kyosu::complex(a[1],a[2]); + std::cout << "right_reverse_horner(x, q1, c2, a[2]) " << kyosu::right_reverse_horner(x, q1, c2, a[12]) << std::endl; + std::cout << "right_reverse_horner(x, c1, c2, c3) " << kyosu::right_reverse_horner(x, c1, c2, c3) << std::endl; + std::cout << "right_reverse_horner(x1, c1, c2, c3) " << kyosu::right_reverse_horner(x1, c1, c2, c3) << std::endl; + auto o1= kyosu::cayley_dickson(a[4],a[5],a[6],a[7], a[8],a[9],a[10],a[11]); + auto o2= kyosu::cayley_dickson(a[0],a[1],a[2],a[3], a[8],a[9],a[10],a[11]); + auto o3= kyosu::cayley_dickson(a[12],a[13],a[14],a[15],a[4],a[5],a[6],a[7]); + std::cout << "right_reverse_horner(x, o1, o2, o3) " << kyosu::right_reverse_horner(x, o1, o2, o3) << std::endl; + std::cout << "right_reverse_horner(x, o1, c2, a[2]) " << kyosu::right_reverse_horner(x, o1, c2, a[12]) << std::endl; +}; diff --git a/test/unit/function/atanh.cpp b/test/unit/function/atanh.cpp index 34a8bc03..d396538f 100644 --- a/test/unit/function/atanh.cpp +++ b/test/unit/function/atanh.cpp @@ -28,5 +28,5 @@ TTS_CASE_WITH ( "Check kyosu::atanh over quaternion" auto lq = kyosu::atanh(q); TTS_RELATIVE_EQUAL(kyosu::tanh(lr), kyosu::complex(r), 1e-5); TTS_RELATIVE_EQUAL(kyosu::tanh(lc), c, 1e-3); - TTS_RELATIVE_EQUAL(kyosu::tanh(lq), q, 1e-3); + TTS_RELATIVE_EQUAL(kyosu::tanh(lq), q, 2e-2); }; diff --git a/test/unit/function/expm1.cpp b/test/unit/function/expm1.cpp index c4a77079..d650f3d2 100644 --- a/test/unit/function/expm1.cpp +++ b/test/unit/function/expm1.cpp @@ -28,4 +28,5 @@ TTS_CASE_WITH ( "Check kyosu::expm1 over quaternion" using ke_t = kyosu::quaternion_t; auto q = ke_t(r,i,j,k); TTS_RELATIVE_EQUAL(kyosu::expm1(q), kyosu::dec(kyosu::exp(q)), 1e-5); + TTS_RELATIVE_EQUAL(kyosu::expm1(kyosu::quaternion(T(0))), kyosu::quaternion(T(0)), 1e-5); }; diff --git a/test/unit/function/fam.cpp b/test/unit/function/fam.cpp new file mode 100644 index 00000000..b79116fc --- /dev/null +++ b/test/unit/function/fam.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fam over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fam(r0, r1, r2), eve::fam(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fam over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fam(c0, c1, c2), c0+c1*c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fam over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fam(q0, q1, q2), q0+q1*q2, 1e-7); +}; diff --git a/test/unit/function/fma.cpp b/test/unit/function/fma.cpp new file mode 100644 index 00000000..a83c6535 --- /dev/null +++ b/test/unit/function/fma.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fma over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fma(r0, r1, r2), eve::fma(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fma over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fma(c0, c1, c2), c0*c1+c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fma over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fma(q0, q1, q2), q0*q1+q2, 1e-7); +}; diff --git a/test/unit/function/fms.cpp b/test/unit/function/fms.cpp new file mode 100644 index 00000000..f332e889 --- /dev/null +++ b/test/unit/function/fms.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fms over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fms(r0, r1, r2), eve::fms(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fms over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fms(c0, c1, c2), c0*c1-c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fms over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fms(q0, q1, q2), q0*q1-q2, 1e-7); +}; diff --git a/test/unit/function/fnma.cpp b/test/unit/function/fnma.cpp new file mode 100644 index 00000000..85fe1e91 --- /dev/null +++ b/test/unit/function/fnma.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fnma over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fnma(r0, r1, r2), eve::fnma(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fnma over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fnma(c0, c1, c2), -c0*c1+c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fnma over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fnma(q0, q1, q2), -q0*q1+q2, 1e-7); +}; diff --git a/test/unit/function/fnms.cpp b/test/unit/function/fnms.cpp new file mode 100644 index 00000000..0cebe757 --- /dev/null +++ b/test/unit/function/fnms.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fnms over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fnms(r0, r1, r2), eve::fnms(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fnms over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fnms(c0, c1, c2), -c0*c1-c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fnms over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fnms(q0, q1, q2), -q0*q1-q2, 1e-7); +}; diff --git a/test/unit/function/fsm.cpp b/test/unit/function/fsm.cpp new file mode 100644 index 00000000..ee4ab17e --- /dev/null +++ b/test/unit/function/fsm.cpp @@ -0,0 +1,57 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::fsm over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1, auto r2) +{ + TTS_EQUAL(kyosu::fsm(r0, r1, r2), eve::fsm(r0, r1, r2)); +}; + +TTS_CASE_WITH ( "Check kyosu::fsm over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + TTS_RELATIVE_EQUAL(kyosu::fsm(c0, c1, c2), -c0+c1*c2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::fsm over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + TTS_RELATIVE_EQUAL(kyosu::fsm(q0, q1, q2), -q0+q1*q2, 1e-7); +}; diff --git a/test/unit/function/horner.cpp b/test/unit/function/horner.cpp new file mode 100644 index 00000000..1dc94816 --- /dev/null +++ b/test/unit/function/horner.cpp @@ -0,0 +1,72 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::horner over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(0, 1) + ) + ) +(auto r0, auto r1, auto r2, auto x) +{ + kumi::tuple a{r0, r1, r2}; + TTS_RELATIVE_EQUAL(kyosu::horner(x, r0, r1, r2), (r0*x+r1)*x+r2, 1e-7); + TTS_RELATIVE_EQUAL(kyosu::horner(x, a) , (r0*x+r1)*x+r2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::horner over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2, auto x0, auto x1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + auto x = kyosu::complex(x0, x1); + TTS_RELATIVE_EQUAL(kyosu::horner(x, c0, c1, c2), (c0*x+c1)*x+c2, 1e-7); + kumi::tuple c{c0, c1, c2}; + TTS_RELATIVE_EQUAL(kyosu::horner(x, c) , (c0*x+c1)*x+c2, 1e-7); + +}; + +TTS_CASE_WITH ( "Check kyosu::horner over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(0, 1), tts::randoms(0, 1) + , tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2 + , T x0, T x1, T x2, T x3 ) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + auto x = type(x0,x1,x2,x3); + TTS_RELATIVE_EQUAL(kyosu::horner(x, q0, q1, q2), (q0*x+q1)*x+q2, 1e-7); + kumi::tuple a{q0, q1, q2}; + TTS_RELATIVE_EQUAL(kyosu::horner(x, a) , (q0*x+q1)*x+q2, 1e-7); + +}; diff --git a/test/unit/function/maxabs.cpp b/test/unit/function/maxabs.cpp new file mode 100644 index 00000000..eeaba992 --- /dev/null +++ b/test/unit/function/maxabs.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::maxabs over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::maxabs(r0, r1), eve::maxabs(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::maxabs over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::maxabs(c0, c1), eve::maxabs(kyosu::abs(c0), kyosu::abs(c1)), 2e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::maxabs over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::maxabs(q0, q1), eve::max(kyosu::abs(q0), kyosu::abs(q1)), 1e-5); +}; diff --git a/test/unit/function/maxmag.cpp b/test/unit/function/maxmag.cpp new file mode 100644 index 00000000..79753236 --- /dev/null +++ b/test/unit/function/maxmag.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::maxmag over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::maxmag(r0, r1), eve::maxmag(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::maxmag over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::maxmag(c0, c1), kyosu::if_else(kyosu::abs(c0) >= kyosu::abs(c1), c0, c1), 1e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::maxmag over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::maxmag(q0, q1), kyosu::if_else(kyosu::abs(q0) >= kyosu::abs(q1), q0, q1), 1e-5); +}; diff --git a/test/unit/function/minabs.cpp b/test/unit/function/minabs.cpp new file mode 100644 index 00000000..eee55136 --- /dev/null +++ b/test/unit/function/minabs.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::minabs over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::minabs(r0, r1), eve::minabs(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::minabs over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::minabs(c0, c1), eve::minabs(kyosu::abs(c0), kyosu::abs(c1)), 2e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::minabs over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::minabs(q0, q1), eve::min(kyosu::abs(q0), kyosu::abs(q1)), 1e-5); +}; diff --git a/test/unit/function/minmag.cpp b/test/unit/function/minmag.cpp new file mode 100644 index 00000000..26c20d4b --- /dev/null +++ b/test/unit/function/minmag.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::minmag over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::minmag(r0, r1), eve::minmag(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::minmag over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::minmag(c0, c1), kyosu::if_else(kyosu::abs(c0) <= kyosu::abs(c1), c0, c1), 1e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::minmag over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::minmag(q0, q1), kyosu::if_else(kyosu::abs(q0) <= kyosu::abs(q1), q0, q1), 1e-5); +}; diff --git a/test/unit/function/negmaxabs.cpp b/test/unit/function/negmaxabs.cpp new file mode 100644 index 00000000..068f117f --- /dev/null +++ b/test/unit/function/negmaxabs.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::negmaxabs over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::negmaxabs(r0, r1), eve::negmaxabs(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::negmaxabs over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::negmaxabs(c0, c1), -eve::max(kyosu::abs(c0), kyosu::abs(c1)), 2e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::negmaxabs over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::negmaxabs(q0, q1), -eve::max(kyosu::abs(q0), kyosu::abs(q1)), 1e-5); +}; diff --git a/test/unit/function/negminabs.cpp b/test/unit/function/negminabs.cpp new file mode 100644 index 00000000..d19ff3f3 --- /dev/null +++ b/test/unit/function/negminabs.cpp @@ -0,0 +1,49 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::negminabs over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ) + ) +(auto r0, auto r1) +{ + TTS_EQUAL(kyosu::negminabs(r0, r1), eve::negminabs(r0, r1)); +}; + +TTS_CASE_WITH ( "Check kyosu::negminabs over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(auto r0, auto i0, auto r1, auto i1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + TTS_RELATIVE_EQUAL(kyosu::negminabs(c0, c1), eve::negminabs(kyosu::abs(c0), kyosu::abs(c1)), 2e-5); +}; + +TTS_CASE_WITH ( "Check kyosu::negminabs over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + ) + ) +(T r0, T i0, T j0, T k0, T r1, T i1, T j1, T k1) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + TTS_RELATIVE_EQUAL(kyosu::negminabs(q0, q1), -eve::min(kyosu::abs(q0), kyosu::abs(q1)), 1e-5); +}; diff --git a/test/unit/function/reverse_horner.cpp b/test/unit/function/reverse_horner.cpp new file mode 100644 index 00000000..0437697f --- /dev/null +++ b/test/unit/function/reverse_horner.cpp @@ -0,0 +1,72 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::reverse_horner over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(0, 1) + ) + ) +(auto r0, auto r1, auto r2, auto x) +{ + kumi::tuple a{r2, r1, r0}; + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, r2, r1, r0), (r0*x+r1)*x+r2, 1e-7); + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, a) , (r0*x+r1)*x+r2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::reverse_horner over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2, auto x0, auto x1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + auto x = kyosu::complex(x0, x1); + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, c2, c1, c0), (c0*x+c1)*x+c2, 1e-7); + kumi::tuple c{c2, c1, c0}; + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, c) , (c0*x+c1)*x+c2, 1e-7); + +}; + +TTS_CASE_WITH ( "Check kyosu::reverse_horner over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(0, 1), tts::randoms(0, 1) + , tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2 + , T x0, T x1, T x2, T x3 ) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + auto x = type(x0,x1,x2,x3); + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, q2, q1, q0), (q0*x+q1)*x+q2, 1e-7); + kumi::tuple a{q2, q1, q0}; + TTS_RELATIVE_EQUAL(kyosu::reverse_horner(x, a) , (q0*x+q1)*x+q2, 1e-7); + +}; diff --git a/test/unit/function/right_horner.cpp b/test/unit/function/right_horner.cpp new file mode 100644 index 00000000..d5b9f60e --- /dev/null +++ b/test/unit/function/right_horner.cpp @@ -0,0 +1,72 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::right_horner over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(0, 1) + ) + ) +(auto r0, auto r1, auto r2, auto x) +{ + kumi::tuple a{r0, r1, r2}; + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, r0, r1, r2), x*(x*r0+r1)+r2, 1e-7); + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, a) , x*(x*r0+r1)+r2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::right_horner over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2, auto x0, auto x1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + auto x = kyosu::complex(x0, x1); + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, c0, c1, c2), x*(x*c0+c1)+c2, 1e-7); + kumi::tuple c{c0, c1, c2}; + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, c) , x*(x*c0+c1)+c2, 1e-7); + +}; + +TTS_CASE_WITH ( "Check kyosu::right_horner over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(0, 1), tts::randoms(0, 1) + , tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2 + , T x0, T x1, T x2, T x3 ) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + auto x = type(x0,x1,x2,x3); + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, q0, q1, q2), x*(x*q0+q1)+q2, 1e-7); + kumi::tuple a{q0, q1, q2}; + TTS_RELATIVE_EQUAL(kyosu::right_horner(x, a) , x*(x*q0+q1)+q2, 1e-7); + +}; diff --git a/test/unit/function/right_reverse_horner.cpp b/test/unit/function/right_reverse_horner.cpp new file mode 100644 index 00000000..6e8b7500 --- /dev/null +++ b/test/unit/function/right_reverse_horner.cpp @@ -0,0 +1,71 @@ +//====================================================================================================================== +/* + Kyosu - Complex Without Complexes + Copyright : KYOSU Contributors & Maintainers + SPDX-License-Identifier: BSL-1.0 +*/ +//====================================================================================================================== +#include +#include + +TTS_CASE_WITH ( "Check kyosu::right_reverse_horner over real" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(-10,10) + ,tts::randoms(0, 1) + ) + ) +(auto r0, auto r1, auto r2, auto x) +{ + kumi::tuple a{r2, r1, r0}; + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, r2, r1, r0), x*(x*r0+r1)+r2, 1e-7); + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, a) , x*(x*r0+r1)+r2, 1e-7); +}; + +TTS_CASE_WITH ( "Check kyosu::right_reverse_horner over complex" + , kyosu::real_types + , tts::generate(tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(-10,10), tts::randoms(-10,10) + ,tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(auto r0, auto i0, auto r1, auto i1, auto r2, auto i2, auto x0, auto x1) +{ + auto c0 = kyosu::complex(r0,i0); + auto c1 = kyosu::complex(r1,i1); + auto c2 = kyosu::complex(r2,i2); + auto x = kyosu::complex(x0, x1); + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, c2, c1, c0), x*(x*c0+c1)+c2, 1e-7); + kumi::tuple c{c2, c1, c0}; + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, c) , x*(x*c0+c1)+c2, 1e-7); + }; + +TTS_CASE_WITH ( "Check kyosu::right_reverse_horner over quaternion" + , kyosu::real_types + , tts::generate ( tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(-10,10), tts::randoms(-10,10) + , tts::randoms(0, 1), tts::randoms(0, 1) + , tts::randoms(0, 1), tts::randoms(0, 1) + ) + ) +(T r0, T i0, T j0, T k0 + , T r1, T i1, T j1, T k1 + , T r2, T i2, T j2, T k2 + , T x0, T x1, T x2, T x3 ) +{ + using type = kyosu::quaternion_t; + auto q0 = type(r0,i0,j0,k0); + auto q1 = type(r1,i1,j1,k1); + auto q2 = type(r2,i2,j2,k2); + auto x = type(x0,x1,x2,x3); + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, q2, q1, q0), x*(x*q0+q1)+q2, 1e-7); + kumi::tuple a{q2, q1, q0}; + TTS_RELATIVE_EQUAL(kyosu::right_reverse_horner(x, a) , x*(x*q0+q1)+q2, 1e-7); + +};