-
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.
- Loading branch information
Showing
14 changed files
with
542 additions
and
54 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,79 @@ | ||
//====================================================================================================================== | ||
/* | ||
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_dist : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_dist; | ||
|
||
KYOSU_DEFERS_CALLABLE(dist_); | ||
|
||
static KYOSU_FORCEINLINE auto deferred_call(auto | ||
, eve::ordered_value auto const& v0 | ||
, eve::ordered_value auto const& v1) noexcept | ||
{ | ||
return eve::dist(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_dist(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var dist | ||
//! @brief Computes the distance between 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 dist(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, kyosu::concepts::cayley_dickson T1> > constexpr auto dist(T0 z0, T1, z1) noexcept; | ||
//! template<kyosu::concepts::cayley_dickson T0, eve::ordered_value T1 > constexpr auto dist(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, ordered_value T1> > constexpr auto dist(T0 z0, T1, z1) noexcept; | ||
///! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z0, z1` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the distance between the two arguments computed as the absolute value of the arguments difference. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/dist.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_dist dist = {}; | ||
} |
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,81 @@ | ||
//====================================================================================================================== | ||
/* | ||
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_reldist : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_reldist; | ||
|
||
KYOSU_DEFERS_CALLABLE(reldist_); | ||
|
||
|
||
static KYOSU_FORCEINLINE auto deferred_call(auto | ||
, eve::ordered_value auto const& v0 | ||
, eve::ordered_value auto const& v1) noexcept | ||
{ | ||
return eve::reldist(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_reldist(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var reldist | ||
//! @brief Computes the relative distance between 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 reldist(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, kyosu::concepts::cayley_dickson T1> > constexpr auto reldist(T0 z0, T1, z1) noexcept; | ||
//! template<kyosu::concepts::cayley_dickson T0, eve::ordered_value T1 > constexpr auto reldist(T0 z0, T1, z1) noexcept; | ||
//! template<eve::ordered_value T0, ordered_value T1> > constexpr auto reldist(T0 z0, T1, z1) noexcept; | ||
///! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z0, z1` : Value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the the relative distance computed as the absolute value of the arguments difference | ||
//! divided by the maximum of their absolute values and 1. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/reldist.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_reldist reldist = {}; | ||
} |
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_sqr : eve::elementwise | ||
{ | ||
using callable_tag_type = callable_sqr; | ||
|
||
KYOSU_DEFERS_CALLABLE(sqr_); | ||
|
||
template<eve::ordered_value T> | ||
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return v*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_sqr(T&&...)> operator()(T&&... x) const | ||
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete; | ||
}; | ||
} | ||
|
||
namespace kyosu | ||
{ | ||
//====================================================================================================================== | ||
//! @addtogroup functions | ||
//! @{ | ||
//! @var sqr | ||
//! @brief Computes the square value. | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
//! @code | ||
//! #include <kyosu/functions.hpp> | ||
//! @endcode | ||
//! | ||
//! @groupheader{Callable Signatures} | ||
//! | ||
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::cayley_dickson T> constexpr T sqr(T z) noexcept; | ||
//! template<eve::ordered_value T> constexpr T sqr(T z) noexcept; | ||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : Value to for which square is computed. | ||
//! | ||
//! **Return value** | ||
//! | ||
//! Returns the square of its argument. i.e. `z*z` in an optimized way. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
//! @godbolt{doc/sqr.cpp} | ||
//! @} | ||
//====================================================================================================================== | ||
inline constexpr tags::callable_sqr sqr = {}; | ||
} |
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
Oops, something went wrong.