-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cayley/extend complex #34
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//====================================================================================================================== | ||
/* | ||
Kyosu - Complex Without Complexes | ||
Copyright : KYOSU Contributors & Maintainers | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//====================================================================================================================== | ||
#pragma once | ||
|
||
auto cayley_extend(auto f, auto z, auto... rs) | ||
{ | ||
auto p = kyosu::pure(z); | ||
auto az = kyosu::abs(p); | ||
auto c = f(kyosu::complex(kyosu::real(z), az), rs...); | ||
return kyosu::real(c) + kyosu::ipart(c)*kyosu::sign(p); | ||
} | ||
|
||
auto cayley_extend_rev(auto f, auto z1, auto z2) | ||
{ | ||
auto p = kyosu::pure(z2); | ||
auto az2 = kyosu::abs(p); | ||
auto c = f(z1, kyosu::complex(kyosu::real(z2), az2)); | ||
return kyosu::real(c) + kyosu::ipart(c)*kyosu::sign(p); | ||
} | ||
|
||
auto cayley_extend2(auto f, auto z, auto... rs) | ||
{ | ||
auto p = kyosu::pure(z); | ||
auto az = kyosu::abs(p); | ||
auto [c1, c2] = f(kyosu::complex(kyosu::real(z), az), rs...); | ||
auto s = kyosu::sign(p); | ||
return kumi::tuple{ kyosu::real(c1) + kyosu::ipart(c1)*s | ||
, kyosu::real(c2) + kyosu::ipart(c2)*s}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,12 +61,12 @@ namespace kyosu | |
//! | ||
//! **Parameters** | ||
//! | ||
//! * `x`,`y` : Values to process. Can be a mix of complex and real floating values and complex values. | ||
//! * `x`,`y` : Values to process. Can be a mix of cayley_dicson and real floating values. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
//! | ||
//! **Return value** | ||
//! | ||
//! 1. If x and y are real typed values returns \f$\displaystyle \mathbf{B}(x,y) = \int_0^1 t^{x-1}(1-t)^{y-1}\mbox{d}t\f$ | ||
//! 2. if x or y is complex the value \f$\displaystyle \mathbf{B}(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\f$ is returned. | ||
//! 2. \f$\displaystyle \mathbf{B}(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\f$ is returned. | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,8 +56,7 @@ namespace kyosu | |
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<unsigned_scalar_value K, eve::ordered_value T> constexpr auto deta(K k, T z) noexcept; //1 | ||
//! template<unsigned_scalar_value K, kyosu::concepts::complex T> constexpr auto deta(K k, T z) noexcept; //2 | ||
//! constexpr auto deta(unsigned_scalar_value k, auto z) noexcept; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. constexpr auto deta(unsigned_scalar_value àuto k, auto z) noexcept;` I guess ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good guess |
||
//! } | ||
//! @endcode | ||
//! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,14 +52,13 @@ namespace kyosu | |
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<kyosu::concepts::complex T> constexpr T digamma(T z) noexcept; | ||
//! template<eve::floating_ordered_value T> constexpr T digamma(T z) noexcept; | ||
//! constexpr auto digamma(T z) noexcept; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is T ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. auto |
||
//! } | ||
//! @endcode | ||
//! | ||
//! **Parameters** | ||
//! | ||
//! * `z` : real or complex value to process. | ||
//! * `z` : value to process. | ||
//! | ||
//! **Return value** | ||
//! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ namespace kyosu | |
//! @var erf | ||
//! @brief Computes the error function: \f$ \displaystyle | ||
//! \mbox{erf}(x)=\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\f$ or | ||
//! its analytic continuation in the complex plane | ||
//! its extension to complex and general cayley-dickson values | ||
//! | ||
//! **Defined in Header** | ||
//! | ||
|
@@ -57,8 +57,7 @@ namespace kyosu | |
//! @code | ||
//! namespace kyosu | ||
//! { | ||
//! template<eve::ordered_value T> constexpr auto erf(T z) noexcept; //1 | ||
//! template<kyosu::concepts::complex T> constexpr auto erf(T z) noexcept; //2 | ||
//! constexpr auto erf(auto z) noexcept; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks liek you mangled a bunch of those definitions, can you recheck the doc texts ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
//! } | ||
//! @endcode | ||
//! | ||
|
@@ -68,9 +67,9 @@ namespace kyosu | |
//! | ||
//! **Return value** | ||
//! | ||
//! 1. a real input z returns eve::erf(z). | ||
//! * a real input z returns eve::erf(z), a real typed value. | ||
//! | ||
//! 2. The value of the error function in the complex plane is returned | ||
//! * The value of the error function is returned | ||
//! | ||
//! @groupheader{Example} | ||
//! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
care to explain what if of them do ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pb with sincos etc.-> cayley_extend2
pb with deta(k,z) etc. -> cayley_extend_rev
cayley_extend works for all other