-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cayley/complex only is_imag + updated average dist reldist
- Loading branch information
Showing
14 changed files
with
481 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
//====================================================================================================================== | ||
//! @defgroup functions cayley Functions | ||
//! @brief Functions performing computations over all cayley-dicson types, complex, quaternions and octonions... | ||
//====================================================================================================================== | ||
#include <kyosu/cayley/abs.hpp> | ||
#include <kyosu/cayley/ceil.hpp> | ||
#include <kyosu/cayley/conj.hpp> | ||
#include <kyosu/cayley/cos.hpp> | ||
#include <kyosu/cayley/cosh.hpp> | ||
#include <kyosu/cayley/cot.hpp> | ||
#include <kyosu/cayley/coth.hpp> | ||
#include <kyosu/cayley/convert.hpp> | ||
#include <kyosu/cayley/csc.hpp> | ||
#include <kyosu/cayley/csch.hpp> | ||
#include <kyosu/cayley/dec.hpp> | ||
#include <kyosu/cayley/dist.hpp> | ||
#include <kyosu/cayley/exp.hpp> | ||
#include <kyosu/cayley/exp2.hpp> | ||
#include <kyosu/cayley/exp10.hpp> | ||
#include <kyosu/cayley/expm1.hpp> | ||
#include <kyosu/cayley/expmx2.hpp> | ||
#include <kyosu/cayley/expx2.hpp> | ||
#include <kyosu/cayley/exp_i.hpp> | ||
#include <kyosu/cayley/exp_ipi.hpp> | ||
#include <kyosu/cayley/floor.hpp> | ||
#include <kyosu/cayley/frac.hpp> | ||
#include <kyosu/cayley/if_else.hpp> | ||
#include <kyosu/cayley/inc.hpp> | ||
#include <kyosu/cayley/ipart.hpp> | ||
#include <kyosu/cayley/is_denormal.hpp> | ||
#include <kyosu/cayley/is_equal.hpp> | ||
#include <kyosu/cayley/is_eqz.hpp> | ||
#include <kyosu/cayley/is_finite.hpp> | ||
#include <kyosu/cayley/is_infinite.hpp> | ||
#include <kyosu/cayley/is_nan.hpp> | ||
#include <kyosu/cayley/is_nez.hpp> | ||
#include <kyosu/cayley/is_not_denormal.hpp> | ||
#include <kyosu/cayley/is_not_equal.hpp> | ||
#include <kyosu/cayley/is_not_finite.hpp> | ||
#include <kyosu/cayley/is_not_infinite.hpp> | ||
#include <kyosu/cayley/is_not_nan.hpp> | ||
#include <kyosu/cayley/is_not_real.hpp> | ||
#include <kyosu/cayley/is_real.hpp> | ||
#include <kyosu/cayley/jpart.hpp> | ||
#include <kyosu/cayley/kpart.hpp> | ||
#include <kyosu/cayley/lerp.hpp> | ||
#include <kyosu/cayley/log.hpp> | ||
#include <kyosu/cayley/log1p.hpp> | ||
#include <kyosu/cayley/log10.hpp> | ||
#include <kyosu/cayley/log2.hpp> | ||
#include <kyosu/cayley/minus.hpp> | ||
#include <kyosu/cayley/nearest.hpp> | ||
#include <kyosu/cayley/oneminus.hpp> | ||
#include <kyosu/cayley/pure.hpp> | ||
#include <kyosu/cayley/purepart.hpp> | ||
#include <kyosu/cayley/real.hpp> | ||
#include <kyosu/cayley/rec.hpp> | ||
#include <kyosu/cayley/reldist.hpp> | ||
#include <kyosu/cayley/sec.hpp> | ||
#include <kyosu/cayley/sech.hpp> | ||
#include <kyosu/cayley/sign.hpp> | ||
#include <kyosu/cayley/sin.hpp> | ||
#include <kyosu/cayley/sincos.hpp> | ||
#include <kyosu/cayley/sinh.hpp> | ||
#include <kyosu/cayley/sinhcosh.hpp> | ||
#include <kyosu/cayley/sqr_abs.hpp> | ||
#include <kyosu/cayley/sqr.hpp> | ||
#include <kyosu/cayley/sqrt.hpp> | ||
#include <kyosu/cayley/tan.hpp> | ||
#include <kyosu/cayley/tanh.hpp> | ||
#include <kyosu/cayley/trunc.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
#include <eve/module/core.hpp> | ||
|
||
namespace kyosu::_ | ||
{ | ||
template<kyosu::concepts::complex C> | ||
KYOSU_FORCEINLINE constexpr | ||
auto dispatch(eve::tag_of<kyosu::conj> const&, C const& c) noexcept | ||
{ | ||
return is_eqz(kyosu::real(c)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
#include <kyosu/details/invoke.hpp> | ||
|
||
namespace kyosu::tags | ||
{ | ||
struct callable_is_imag : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_is_imag; | ||
|
||
KYOSU_DEFERS_CALLABLE(is_imag_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::is_eqz(v); } | ||
|
||
template<typename T> | ||
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target)) | ||
{ | ||
return eve::tag_invoke(*this, target); | ||
} | ||
|
||
template<typename... T> | ||
eve::unsupported_call<callable_is_imag(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var is_imag | ||
//! @brief test if the parameter is imag. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::complex T> constexpr auto is_imag(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr auto is_imag(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns elementwise true the real part of the argument is zero. | ||
//! For Caley-Dickson types of dimension greater than 2 use is_pure. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/is_imag.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_is_imag is_imag = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
#include <kyosu/details/invoke.hpp> | ||
namespace kyosu::tags | ||
{ | ||
struct callable_average : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_average; | ||
|
||
KYOSU_DEFERS_CALLABLE(average_); | ||
|
||
static KYOSU_FORCEINLINE auto deferred_call(auto | ||
, eve::ordered_value auto const& v0 | ||
, eve::ordered_value auto const& v1) noexcept | ||
{ | ||
return eve::average(v0, v1); | ||
} | ||
|
||
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); | ||
} | ||
|
||
template<typename... T> | ||
eve::unsupported_call<callable_average(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var average | ||
//! @brief Computes the average of the two parameters. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T0, kyosu::concepts::cayley_dickson T1 > constexpr auto average(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, kyosu::concepts::cayley_dickson T1> > constexpr auto average(T0 z0, T1, z1) noexcept; | ||
//! template<kyosu::concepts::cayley_dickson T0, eve::ordered_value T1 > constexpr auto average(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, ordered_value T1> > constexpr auto average(T0 z0, T1, z1) noexcept; | ||
///! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z0, z1` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the average of the two arguments . | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/average.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_average average = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
#include <kyosu/details/invoke.hpp> | ||
|
||
namespace kyosu::tags | ||
{ | ||
struct callable_is_imag : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_is_imag; | ||
|
||
KYOSU_DEFERS_CALLABLE(is_imag_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::is_eqz(v); } | ||
|
||
template<typename T> | ||
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target)) | ||
{ | ||
return eve::tag_invoke(*this, target); | ||
} | ||
|
||
template<typename... T> | ||
eve::unsupported_call<callable_is_imag(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var is_imag | ||
//! @brief test if the complex parameter is pure imaginary. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr auto is_imag(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr auto is_imag(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the value of real(z) == 0. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/is_imag.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_is_imag is_imag = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.