Skip to content

Commit

Permalink
Merge pull request #6 from kthohr/v1.7.0
Browse files Browse the repository at this point in the history
Version 1.7.0
  • Loading branch information
kthohr authored Nov 2, 2018
2 parents 7d5d717 + 32ebef2 commit 590264c
Show file tree
Hide file tree
Showing 57 changed files with 747 additions and 272 deletions.
2 changes: 2 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ build_script:
- .\erf.test
- .\erf_inv.test
- .\factorial.test
- .\gcd.test
- .\incomplete_beta.test
- .\incomplete_beta_inv.test
- .\incomplete_gamma.test
- .\incomplete_gamma_inv.test
- .\lcm.test
- .\lgamma.test
- .\log.test
- .\other.test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ GCE-Math functions are written as C++ templates with `constexpr` specifiers, the
template<typename T>
constexpr
return_t<T>
erf(const T x);
erf(const T x) noexcept;
```
where a set of internal templated ```constexpr``` functions will implement a continued fraction expansion to return a value of type ```return_t<T>```. This output type ('```return_t<T>```') is generally determined by the input type, e.g., ```int```, ```float```, ```double```, ```long double```, etc. When ```T``` is an intergral type, the output will be upgraded to ```return_t<T> = double```, otherwise ```return_t<T> = T```. For types not covered by ```std::is_integral```, recasts should be used.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/algorithms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Algorithms
===============

.. _gcd-function-reference:
.. doxygenfunction:: gcd(const T, const T)
.. doxygenfunction:: gcd(const T1, const T2)
:project: gcem

.. _lcm-function-reference:
.. doxygenfunction:: lcm(const T, const T)
.. doxygenfunction:: lcm(const T1, const T2)
:project: gcem
6 changes: 3 additions & 3 deletions docs/source/api/basic_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Basic functions
:project: gcem

.. _max-function-reference:
.. doxygenfunction:: max(const T, const T)
.. doxygenfunction:: max(const T1, const T2)
:project: gcem

.. _min-function-reference:
.. doxygenfunction:: min(const T, const T)
.. doxygenfunction:: min(const T1, const T2)
:project: gcem

.. _pow-function-reference:
.. doxygenfunction:: pow(const Ta, const Tb)
.. doxygenfunction:: pow(const T1, const T2)
:project: gcem

.. _sgn-function-reference:
Expand Down
16 changes: 8 additions & 8 deletions docs/source/api/special_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Special functions
===============

.. _binomial-func-ref:
.. doxygenfunction:: binomial_coef(const pT, const pT)
.. doxygenfunction:: binomial_coef(const T1, const T2)
:project: gcem

.. _beta-function-reference:
.. doxygenfunction:: beta(const T, const T)
.. doxygenfunction:: beta(const T1, const T2)
:project: gcem

.. _lbeta-func-ref:
.. doxygenfunction:: lbeta(const T, const T)
.. doxygenfunction:: lbeta(const T1, const T2)
:project: gcem

.. _tgamma-func-ref:
Expand All @@ -28,7 +28,7 @@ Special functions
:project: gcem

.. _lmgamma-func-ref:
.. doxygenfunction:: lmgamma(const pT, const eT)
.. doxygenfunction:: lmgamma(const T1, const T2)
:project: gcem

Incomplete integral functions
Expand All @@ -39,11 +39,11 @@ Incomplete integral functions
:project: gcem

.. _ib-func-ref:
.. doxygenfunction:: incomplete_beta(const pT, const pT, const eT)
.. doxygenfunction:: incomplete_beta(const T1, const T2, const T3)
:project: gcem

.. _ig-func-ref:
.. doxygenfunction:: incomplete_gamma(const pT, const eT)
.. doxygenfunction:: incomplete_gamma(const T1, const T2)
:project: gcem

Inverse incomplete integral functions
Expand All @@ -54,9 +54,9 @@ Inverse incomplete integral functions
:project: gcem

.. _iib-ref:
.. doxygenfunction:: incomplete_beta_inv(const pT, const pT, const eT)
.. doxygenfunction:: incomplete_beta_inv(const T1, const T2, const T3)
:project: gcem

.. _iig-ref:
.. doxygenfunction:: incomplete_gamma_inv(const pT, const eT)
.. doxygenfunction:: incomplete_gamma_inv(const T1, const T2)
:project: gcem
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GCE-Math functions are written as C++ templates with ``constexpr`` specifiers, t
template<typename T>
constexpr
return_t<T>
erf(const T x);
erf(const T x) noexcept;
where a set of internal templated ``constexpr`` functions will implement a continued fraction expansion to return a value of type ``return_t<T>``. This output type ('``return_t<T>``') is generally determined by the input type, e.g., ``int``, ``float``, ``double``, ``long double``, etc. When ``T`` is an intergral type, the output will be upgraded to ``return_t<T> = double``, otherwise ``return_t<T> = T``. For types not covered by ``std::is_integral``, recasts should be used.

Expand Down
1 change: 1 addition & 0 deletions include/gcem_incl/abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
abs(const T x)
noexcept
{
return( x < T(0) ? - x : x );
}
Expand Down
5 changes: 4 additions & 1 deletion include/gcem_incl/acos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
acos_compute(const T x)
noexcept
{
return( // only defined on [-1,1]
abs(x) > T(1) ? \
Expand All @@ -49,6 +50,7 @@ template<typename T>
constexpr
T
acos_check(const T x)
noexcept
{
return( x > T(0) ? \
// if
Expand All @@ -70,8 +72,9 @@ template<typename T>
constexpr
return_t<T>
acos(const T x)
noexcept
{
return internal::acos_check<return_t<T>>(x);
return internal::acos_check( static_cast<return_t<T>>(x) );
}

#endif
4 changes: 3 additions & 1 deletion include/gcem_incl/acosh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
acosh_compute(const T x)
noexcept
{
return( // function defined for x >= 1
x < T(1) ? \
Expand All @@ -56,8 +57,9 @@ template<typename T>
constexpr
return_t<T>
acosh(const T x)
noexcept
{
return internal::acosh_compute<return_t<T>>(x);
return internal::acosh_compute( static_cast<return_t<T>>(x) );
}

#endif
5 changes: 4 additions & 1 deletion include/gcem_incl/asin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
asin_compute(const T x)
noexcept
{
return( // only defined on [-1,1]
x > T(1) ? \
Expand All @@ -49,6 +50,7 @@ template<typename T>
constexpr
T
asin_check(const T x)
noexcept
{
return( x < T(0) ? - asin_compute(-x) : asin_compute(x) );
}
Expand All @@ -66,8 +68,9 @@ template<typename T>
constexpr
return_t<T>
asin(const T x)
noexcept
{
return internal::asin_check<return_t<T>>(x);
return internal::asin_check( static_cast<return_t<T>>(x) );
}

#endif
4 changes: 3 additions & 1 deletion include/gcem_incl/asinh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
asinh_compute(const T x)
noexcept
{
return( // indistinguishable from zero
GCLIM<T>::epsilon() > abs(x) ? \
Expand All @@ -53,8 +54,9 @@ template<typename T>
constexpr
return_t<T>
asinh(const T x)
noexcept
{
return internal::asinh_compute<return_t<T>>(x);
return internal::asinh_compute( static_cast<return_t<T>>(x) );
}


Expand Down
10 changes: 9 additions & 1 deletion include/gcem_incl/atan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ template<typename T>
constexpr
T
atan_series_order_calc(const T x, const T x_pow, const uint_t order)
noexcept
{
return( T(1)/( T((order-1)*4 - 1) * x_pow ) \
- T(1)/( T((order-1)*4 + 1) * x_pow*x) );
Expand All @@ -47,6 +48,7 @@ template<typename T>
constexpr
T
atan_series_order(const T x, const T x_pow, const uint_t order, const uint_t max_order)
noexcept
{
return( order == 1 ? \
GCEM_HALF_PI - T(1)/x + atan_series_order(x*x,pow(x,3),order+1,max_order) :
Expand All @@ -62,6 +64,7 @@ template<typename T>
constexpr
T
atan_series_main(const T x)
noexcept
{
return( x < T(3) ? atan_series_order(x,x,1U,10U) : // O(1/x^39)
x < T(4) ? atan_series_order(x,x,1U,9U) : // O(1/x^35)
Expand All @@ -80,6 +83,7 @@ template<typename T>
constexpr
T
atan_cf_recur(const T xx, const uint_t depth, const uint_t max_depth)
noexcept
{
return( depth < max_depth ? \
// if
Expand All @@ -92,6 +96,7 @@ template<typename T>
constexpr
T
atan_cf_main(const T x)
noexcept
{
return( x < T(0.5) ? x/atan_cf_recur(x*x,1U, 15U ) :
x < T(1) ? x/atan_cf_recur(x*x,1U, 25U ) :
Expand All @@ -106,6 +111,7 @@ template<typename T>
constexpr
T
atan_begin(const T x)
noexcept
{
return( x > T(2.5) ? atan_series_main(x) : atan_cf_main(x) );
}
Expand All @@ -114,6 +120,7 @@ template<typename T>
constexpr
T
atan_check(const T x)
noexcept
{
return( // indistinguishable from zero
GCLIM<T>::epsilon() > abs(x) ? \
Expand All @@ -137,8 +144,9 @@ template<typename T>
constexpr
return_t<T>
atan(const T x)
noexcept
{
return internal::atan_check<return_t<T>>(x);
return internal::atan_check( static_cast<return_t<T>>(x) );
}

#endif
5 changes: 4 additions & 1 deletion include/gcem_incl/atanh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template<typename T>
constexpr
T
atanh_compute(const T x)
noexcept
{
return( log( (T(1) + x)/(T(1) - x) ) / T(2) );
}
Expand All @@ -40,6 +41,7 @@ template<typename T>
constexpr
T
atanh_check(const T x)
noexcept
{
return( // function is defined for |x| < 1
T(1) < abs(x) ? \
Expand All @@ -66,8 +68,9 @@ template<typename T>
constexpr
return_t<T>
atanh(const T x)
noexcept
{
return internal::atanh_check<return_t<T>>(x);
return internal::atanh_check( static_cast<return_t<T>>(x) );
}

#endif
9 changes: 5 additions & 4 deletions include/gcem_incl/beta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
* where \f$ \Gamma \f$ denotes the gamma function.
*/

template<typename T>
template<typename T1, typename T2>
constexpr
return_t<T>
beta(const T a, const T b)
common_return_type_t<T1,T2>
beta(const T1 a, const T2 b)
noexcept
{
return exp( lbeta<return_t<T>>(a,b) );
return exp( lbeta(a,b) );
}

#endif
Loading

0 comments on commit 590264c

Please sign in to comment.