Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complex Airy functions #46

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/kyosu/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include <kyosu/functions/acospi.hpp>
#include <kyosu/functions/acot.hpp>
#include <kyosu/functions/acotpi.hpp>

#include <kyosu/functions/airy.hpp>
#include <kyosu/functions/airy_ai.hpp>
#include <kyosu/functions/airy_bi.hpp>

#include <kyosu/functions/atanpi.hpp>
#include <kyosu/functions/acoth.hpp>
#include <kyosu/functions/arg.hpp>
Expand Down
77 changes: 77 additions & 0 deletions include/kyosu/functions/airy.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright: KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/bessel.hpp>

namespace kyosu::tags
{
struct callable_airy: eve::elementwise
{
using callable_tag_type = callable_airy;

KYOSU_DEFERS_CALLABLE(airy_);

template<eve::floating_ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept
{
return eve::airy(v);
}

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const & target0) const noexcept
-> decltype(eve::tag_invoke(*this, target0))
{
return eve::tag_invoke(*this, target0);
}

template<typename... T>
eve::unsupported_call<callable_airy(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var airy
//! @brief Computes simultaneously the airy functions \f$Ai\f$ and \f$Bi\f$.
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<eve::floating_ordered_value T> constexpr auto airy(T z) noexcept;
//!
//! template<kyosu::concepts::cayley_dickson T> constexpr auto airy(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z`: Value to process.
//!
//! **Return value**
//!
//! * returns a kumi pair containing \f$\{Ai(z)\}f$ and \f$\{Bi(z)\}f$.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/airy.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_airy airy = {};
}
77 changes: 77 additions & 0 deletions include/kyosu/functions/airy_ai.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright: KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/bessel.hpp>

namespace kyosu::tags
{
struct callable_airy_ai: eve::elementwise
{
using callable_tag_type = callable_airy_ai;

KYOSU_DEFERS_CALLABLE(airy_ai_);

template<eve::floating_ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept
{
return eve::airy_ai(v);
}

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const & target0) const noexcept
-> decltype(eve::tag_invoke(*this, target0))
{
return eve::tag_invoke(*this, target0);
}

template<typename... T>
eve::unsupported_call<callable_airy_ai(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var airy_ai
//! @brief Computes the airy function \f$Ai\f$,
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<eve::floating_ordered_value T> constexpr auto airy_ai(T z) noexcept;
//!
//! template<kyosu::concepts::cayley_dickson T> constexpr auto airy_ai(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z`: Value to process.
//!
//! **Return value**
//!
//! * returns \f$\{Ai(z)\}f$.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/airy_ai.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_airy_ai airy_ai = {};
}
77 changes: 77 additions & 0 deletions include/kyosu/functions/airy_bi.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright: KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/bessel.hpp>

namespace kyosu::tags
{
struct callable_airy_bi: eve::elementwise
{
using callable_tag_type = callable_airy_bi;

KYOSU_DEFERS_CALLABLE(airy_bi_);

template<eve::floating_ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept
{
return eve::airy_bi(v);
}

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const & target0) const noexcept
-> decltype(eve::tag_invoke(*this, target0))
{
return eve::tag_invoke(*this, target0);
}

template<typename... T>
eve::unsupported_call<callable_airy_bi(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var airy_bi
//! @brief Computes the airy function \f$Bi\f$,
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<eve::floating_ordered_value T> constexpr auto airy_bi(T z) noexcept;
//!
//! template<kyosu::concepts::cayley_dickson T> constexpr auto airy_bi(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z`: Value to process.
//!
//! **Return value**
//!
//! * returns \f$\{Bi(z)\}f$.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/airy_bi.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_airy_bi airy_bi = {};
}
14 changes: 14 additions & 0 deletions include/kyosu/functions/cyl_bessel_y.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ namespace kyosu::tags
return fnu(nu, complex(v));
}

template<eve::floating_scalar_value N, eve::floating_ordered_value T, typename R>
static KYOSU_FORCEINLINE auto deferred_call(auto, N nu, T const& v, R& ys) noexcept
{
auto fnu = callable_cyl_bessel_y{};
return fnu(nu, complex(v), ys);
}

template<typename N, typename T>
KYOSU_FORCEINLINE auto operator()(N const & target0, T const& target1) const noexcept
-> decltype(eve::tag_invoke(*this, target0, target1))
{
return eve::tag_invoke(*this, target0, target1);
}

template<typename N, typename T, typename R>
KYOSU_FORCEINLINE auto operator()(N const & target0, T const& target1, R & out0) const noexcept
-> decltype(eve::tag_invoke(*this, target0, target1, out0))
{
return eve::tag_invoke(*this, target0, target1, out0);
}

template<typename... T>
eve::unsupported_call<callable_cyl_bessel_y(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
Expand Down
2 changes: 2 additions & 0 deletions include/kyosu/types/impl/bessel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@
#include <kyosu/types/impl/besselr/cb_jyr.hpp>
#include <kyosu/types/impl/besselr/cb_h.hpp>
#include <kyosu/types/impl/besselr/cb_ikr.hpp>
// airy functions
#include <kyosu/types/impl/besselr/airy.hpp>
Loading