Skip to content

Commit

Permalink
tests doc and corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Dec 27, 2024
1 parent 9452ac7 commit 48993ca
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 70 deletions.
13 changes: 5 additions & 8 deletions include/eve/module/elliptic/am.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ namespace eve
//! **Parameters**
//!
//! * `u`: argument.
//! * `m`: amplitude parameter (\f$0\le m\le 1).
//! * `alpha `: modular angle in radian.
//! * `tol': accuracy tolerance (by defaut [epsilon](@ref eve::epsilon).
//! * `k`: elliptic modulus (eccentricity) .
//! * `x`: amplitude parameter (\f$0\le m\le 1).
//! * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
//! * `l`: [Logical value](@ref eve::logical_value) masking the operation.
//!
Expand All @@ -90,9 +87,9 @@ namespace eve

//! @groupheader{External references}
//! * [C++ standard reference: am](https://en.cppreference.com/w/cpp/numeric/special_functions/am)
//! * [DLMF: Jacobi Amplitude](https://dlmf.nist.gov/22.16)
//! * [Wolfram MathWorld: Jacobi Amplitude](https://mathworld.wolfram.com/JacobiAmplitude.html)
//! * [Wikipedia: Jacobi elliptic functions](https://en.wikipedia.org/wiki/Jacobi_elliptic_functions)
//! * [DLMF: Jacobi zeta](https://dlmf.nist.gov/22.16)
//! * [Wolfram MathWorld: Jacobi Zeta Function](https://mathworld.wolfram.com/JacobiZetaFunction.html)
//! * [Boost: jacobi_zeta](https://beta.boost.org/doc/libs/1_84_0/libs/math/doc/html/math_toolkit/ellint/jacobi_zeta.html)
//!
//! @groupheader{Example}
//! @godbolt{doc/elliptic/am.cpp}
Expand Down Expand Up @@ -150,7 +147,7 @@ namespace eve
{
phi = average(phi, asin(c[n]*sin(phi)/a[n]) );
}
return phi;
return if_else(is_infinite(u) && is_eqz(k), u, phi);
};

T r;
Expand Down
28 changes: 6 additions & 22 deletions include/eve/module/elliptic/heuman_lambda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace eve
//! @addtogroup elliptic
//! @{
//! @var heuman_lambda
//! @brief `elementwise_callable` object computing the Jacobi's sn, cn and dn function simultaneously.
//! @brief `elementwise_callable` object computing the Heuman lambda function.
//!
//! @groupheader{Header file}
//!
Expand All @@ -53,11 +53,6 @@ namespace eve
//! // Regular overload
//! constexpr auto heuman_lambda(floating_value auto u, floating_value auto x) noexcept; // 1
//!
//! //Semantic modifiers
//! constexpr auto heuman_lambda[modular](floating_value auto u, floating_value auto alpha) noexcept; // 1
//! constexpr auto heuman_lambda[eccentric(floating_value auto u, floating_value auto k) noexcept; // 1
//! constexpr auto heuman_lambda[threshold = tol](floating_value auto u, floating_value auto x) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto heuman_lambda[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 2
//! constexpr auto heuman_lambda[logical_value autolm](/*any of the above overloads*/) noexcept; // 2
Expand All @@ -67,30 +62,19 @@ namespace eve
//! **Parameters**
//!
//! * `u`: argument.
//! * `m`: amplitude parameter (\f$0\le m\le 1).
//! * `alpha `: modular angle in radian.
//! * `tol': accuracy tolerance (by defaut [epsilon](@ref eve::epsilon).
//! * `k`: elliptic modulus (eccentricity) .
//! * `x`: amplitude parameter (\f$0\le m\le 1\f$).
//! * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
//! * `l`: [Logical value](@ref eve::logical_value) masking the operation.
//!
//! **Return value**
//!
//! 1. return a `kumi::tuple` containing `sn``cn` and `dn` values. Take care that the meaning of the second parameters
//! depends on the option used (see note below).
//! 1. return the Heuman lambda value
//! 2. [The operation is performed conditionally](@ref conditional)
//!
//! @note
//! * \f$\alpha\f$ is named the modular angle given in radian (modular option).
//! * \f$ k = \sin\alpha \f$ is named the elliptic modulus or eccentricity (eccentric option).
//! * \f$ m = k^2 = \sin^2\alpha\f$ is named the parameter (no option).
//! Each of the above three quantities is completely determined by any of the others (given that they are non-negative).
//! Thus, they can be used interchangeably (give the right option).

//! @groupheader{External references}
//! * [DLMF: Jacobian Elliptic](https://dlmf.nist.gov/22.2)
//! * [Wolfram MathWorld: Jacobi Elliptic Functions](https://mathworld.wolfram.com/JacobiEllipticFunctions.html)
//! * [Wikipedia: Jacobi elliptic functions](https://en.wikipedia.org/wiki/heuman_lambda_functions)
//! * [Wolfram MathWorld: Heuman lambda Function](https://mathworld.wolfram.com/HeumanLambdaFunction.html)
//! * [Wikipedia: Heuman Lambda functions](https://en.wikipedia.org/wiki/heuman_lambda_functions)
//! * [Boost: Heuman lambda](https://www.boost.org/doc/libs/1_73_0/libs/math/doc/html/math_toolkit/ellint/heuman_lambda.html)
//!
//! @groupheader{Example}
//! @godbolt{doc/elliptic/heuman_lambda.cpp}
Expand Down
12 changes: 1 addition & 11 deletions include/eve/module/elliptic/jacobi_elliptic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ namespace eve
//! **Parameters**
//!
//! * `u`: argument.
//! * `m`: amplitude parameter (\f$0\le m\le 1).
//! * `alpha `: modular angle in radian.
//! * `tol': accuracy tolerance (by defaut [epsilon](@ref eve::epsilon).
//! * `k`: elliptic modulus (eccentricity) .
//! * `m`: amplitude parameter (\f$0\le m\le 1\f$).
//! * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
//! * `l`: [Logical value](@ref eve::logical_value) masking the operation.
//!
Expand All @@ -78,13 +75,6 @@ namespace eve
//! depends on the option used (see note below).
//! 2. [The operation is performed conditionally](@ref conditional)
//!
//! @note
//! * \f$\alpha\f$ is named the modular angle given in radian (modular option).
//! * \f$ k = \sin\alpha \f$ is named the elliptic modulus or eccentricity (eccentric option).
//! * \f$ m = k^2 = \sin^2\alpha\f$ is named the parameter (no option).
//! Each of the above three quantities is completely determined by any of the others (given that they are non-negative).
//! Thus, they can be used interchangeably (give the right option).

//! @groupheader{External references}
//! * [DLMF: Jacobian Elliptic](https://dlmf.nist.gov/22.2)
//! * [Wolfram MathWorld: Jacobi Elliptic Functions](https://mathworld.wolfram.com/JacobiEllipticFunctions.html)
Expand Down
17 changes: 3 additions & 14 deletions include/eve/module/elliptic/jacobi_zeta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace eve
//! @addtogroup elliptic
//! @{
//! @var jacobi_zeta
//! @brief `elementwise_callable` object computing the Jacobi's sn, cn and dn function simultaneously.
//! @brief `elementwise_callable` object computing the Jacobi Zeta function.
//!
//! @groupheader{Header file}
//!
Expand All @@ -62,26 +62,15 @@ namespace eve
//! **Parameters**
//!
//! * `u`: argument.
//! * `m`: amplitude parameter (\f$0\le m\le 1).
//! * `alpha `: modular angle in radian.
//! * `tol': accuracy tolerance (by defaut [epsilon](@ref eve::epsilon).
//! * `k`: elliptic modulus (eccentricity) .
//! * `x`: amplitude parameter (\f$0\le x\le 1\f$).
//! * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
//! * `l`: [Logical value](@ref eve::logical_value) masking the operation.
//!
//! **Return value**
//!
//! 1. return a `kumi::tuple` containing `sn``cn` and `dn` values. Take care that the meaning of the second parameters
//! depends on the option used (see note below).
//! 1. return the jacobi zeta value.
//! 2. [The operation is performed conditionally](@ref conditional)
//!
//! @note
//! * \f$\alpha\f$ is named the modular angle given in radian (modular option).
//! * \f$ k = \sin\alpha \f$ is named the elliptic modulus or eccentricity (eccentric option).
//! * \f$ m = k^2 = \sin^2\alpha\f$ is named the parameter (no option).
//! Each of the above three quantities is completely determined by any of the others (given that they are non-negative).
//! Thus, they can be used interchangeably (give the right option).

//! @groupheader{External references}
//! * [DLMF: Jacobian Elliptic](https://dlmf.nist.gov/22.2)
//! * [Wolfram MathWorld: Jacobi Elliptic Functions](https://mathworld.wolfram.com/JacobiEllipticFunctions.html)
Expand Down
7 changes: 0 additions & 7 deletions test/doc/elliptic/heuman_lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// revision 1
#include <eve/module/elliptic.hpp>
#include <iostream>
#if __has_include(<boost/math/special_functions/heuman_lambda.hpp>)
#include <boost/math/special_functions/heuman_lambda.hpp>
#define EVE_HAS_BOOST
#endif

auto hl = [](auto x, auto y) -> decltype(x) { return boost::math::heuman_lambda(y, x); };

eve::wide wf{0.9, 0.2, 0.75, 0.5};
eve::wide wphi{0.8, 1.0e-30, 0.5, 0.1};
Expand All @@ -16,7 +10,6 @@ int main(){
std::cout << "<- wphi = " << wphi << "\n";

std::cout << "-> heuman_lambda(wphi, wf) = " << eve::heuman_lambda(wphi, wf) << "\n";
std::cout << "-> hl (wphi, wf) = " << eve::detail::map(hl, wphi, wf) << "\n";
std::cout << "-> heuman_lambda[ignore_last(2)](wphi,wf)= " << eve::heuman_lambda[eve::ignore_last(2)](wphi, wf) << "\n";
std::cout << "-> heuman_lambda[wf != 1.0](wphi,wf) = " << eve::heuman_lambda[wf != -1.0f](wphi, wf) << "\n";
std::cout << "-> heuman_lambda(pio_2[lower], wf) = " << eve::heuman_lambda(eve::pio_2[eve::lower](eve::as(wphi)), wf) << '\n';
Expand Down
7 changes: 0 additions & 7 deletions test/doc/elliptic/jacobi_zeta.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// revision 1
#include <eve/module/elliptic.hpp>
#include <iostream>
#if __has_include(<boost/math/special_functions/heuman_lambda.hpp>)
#include <boost/math/special_functions/jacobi_zeta.hpp>
#define EVE_HAS_BOOST
#endif

auto jz = [](auto x, auto y) -> decltype(x) { return boost::math::jacobi_zeta(y, x); };

eve::wide wf{1.0, 0.0, 0.75, 0.5};
eve::wide wphi{1.0, 1.0e-30, 0.5, 0.0};
Expand All @@ -16,7 +10,6 @@ int main(){
std::cout << "<- wphi = " << wphi << "\n";

std::cout << "-> jacobi_zeta(wphi, wf) = " << eve::jacobi_zeta(wphi, wf) << "\n";
std::cout << "-> jz (wphi, wf) = " << eve::detail::map(jz, wphi, wf) << "\n";
std::cout << "-> jacobi_zeta[ignore_last(2)](wphi,wf)= " << eve::jacobi_zeta[eve::ignore_last(2)](wphi, wf) << "\n";
std::cout << "-> jacobi_zeta[wf != 1.0](wphi,wf) = " << eve::jacobi_zeta[wf != -1.0f](wphi, wf) << "\n";
std::cout << "-> jacobi_zeta(pio_2[lower], wf) = " << eve::jacobi_zeta(eve::pio_2[eve::lower](eve::as(wphi)), wf) << '\n';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/module/elliptic/heuman_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <eve/module/elliptic.hpp>
#include <eve/module/math.hpp>

TTS_CASE_TPL ( "Check jacobi_elliptic over real"
TTS_CASE_TPL ( "Check heuman_lambda over real"
, eve::test::scalar::ieee_reals
)
<typename T>(tts::type<T>)
Expand Down

0 comments on commit 48993ca

Please sign in to comment.