-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
700 additions
and
26 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
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,76 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
#include <kyosu/details/invoke.hpp> | ||
#include <eve/module/math.hpp> | ||
|
||
namespace kyosu::tags | ||
{ | ||
struct callable_exp : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_exp; | ||
|
||
KYOSU_DEFERS_CALLABLE(exp_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::exp(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_exp(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var exp | ||
//! @brief Computes the exponential of the argument. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr T exp(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr T exp(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the exponential of the argument. | ||
//! | ||
//! For real inputs the call reduces to identity. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/exp.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_exp exp = {}; | ||
} |
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_not_real : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_is_not_real; | ||
|
||
KYOSU_DEFERS_CALLABLE(is_not_real_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::false_(eve::as(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_not_real(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var is_not_real | ||
//! @brief test if the parameter is not_real. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr auto is_not_real(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr auto is_not_real(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns elementwise true is any of the non real parts of the argument is not zero. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/is_not_real.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_is_not_real is_not_real = {}; | ||
} |
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_real : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_is_real; | ||
|
||
KYOSU_DEFERS_CALLABLE(is_real_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::true_(eve::as(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_real(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var is_real | ||
//! @brief test if the parameter is real. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr auto is_real(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr auto is_real(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns elementwise true is all the non real parts of the argument are zero. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/is_real.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_is_real is_real = {}; | ||
} |
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,83 @@ | ||
//====================================================================================================================== | ||
/* | ||
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_pure | ||
{ | ||
using callable_tag_type = callable_pure; | ||
|
||
KYOSU_DEFERS_CALLABLE(pure_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::zero(as(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> | ||
KYOSU_FORCEINLINE auto operator()(T& target) const noexcept -> decltype(eve::tag_invoke(*this, target)) | ||
{ | ||
return eve::tag_invoke(*this, target); | ||
} | ||
|
||
template<typename... T> | ||
eve::unsupported_call<callable_pure(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var imag | ||
//! @brief Extracts the imaginary part of a value. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr auto& pure(T& z) noexcept; | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr auto pure(T const& z) noexcept; | ||
//! template<eve::ordered_value T> constexpr T pure(T const& z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Original value. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the imaginary part of its argument. For real inputs, the call returns 0. It is an alias of `imag`. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/imag.cpp} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_pure pure = {}; | ||
|
||
//====================================================================================================================== | ||
//! @} | ||
//====================================================================================================================== | ||
} |
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.