Boost-Geometry-Utils
view release on metacpan or search on metacpan
119211931194119511961197119811991200120112021203120412051206120712081209121012111212src/boost/math/special_functions/expm1.hpp
src/boost/math/special_functions/factorials.hpp
src/boost/math/special_functions/fpclassify.hpp
src/boost/math/special_functions/gamma.hpp
src/boost/math/special_functions/hankel.hpp
src/boost/math/special_functions/hermite.hpp
src/boost/math/special_functions/hypot.hpp
src/boost/math/special_functions/jacobi_elliptic.hpp
src/boost/math/special_functions/laguerre.hpp
src/boost/math/special_functions/lanczos.hpp
src/boost/math/special_functions/legendre.hpp
src/boost/math/special_functions/log1p.hpp
src/boost/math/special_functions/math_fwd.hpp
src/boost/math/special_functions/modf.hpp
src/boost/math/special_functions/
next
.hpp
src/boost/math/special_functions/owens_t.hpp
src/boost/math/special_functions/pow.hpp
src/boost/math/special_functions/powm1.hpp
src/boost/math/special_functions/round.hpp
src/boost/math/special_functions/sign.hpp
src/boost/math/special_functions/sin_pi.hpp
src/boost/math/special_functions.hpp view on Meta::CPAN
333435363738394041424344454647484950515253#include <boost/math/special_functions/expint.hpp>
#include <boost/math/special_functions/expm1.hpp>
#include <boost/math/special_functions/factorials.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <boost/math/special_functions/hermite.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/math/special_functions/jacobi_elliptic.hpp>
#include <boost/math/special_functions/laguerre.hpp>
#include <boost/math/special_functions/lanczos.hpp>
#include <boost/math/special_functions/legendre.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/next.hpp>
#include <boost/math/special_functions/owens_t.hpp>
#include <boost/math/special_functions/powm1.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/sinc.hpp>
#include <boost/math/special_functions/sinhc.hpp>
#include <boost/math/special_functions/spherical_harmonic.hpp>
src/boost/math/special_functions/legendre.hpp view on Meta::CPAN
11121314151617181920212223242526272829303132333435363738394041424344#pragma once
#endif
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/factorials.hpp>
#include <boost/math/tools/config.hpp>
namespace boost{
namespace math{
// Recurrance relation
for
legendre P and Q polynomials:
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
return
((2 * l + 1) * result_type(x) * result_type(Pl) - l * result_type(Plm1)) / (l + 1);
}
namespace detail{
// Implement Legendre P and Q polynomials via recurrance:
template <class T, class Policy>
T legendre_imp(unsigned l, T x, const Policy& pol, bool second = false)
{
static const char* function =
"boost::math::legrendre_p<%1%>(unsigned, %1%)"
;
// Error handling:
if
((x < -1) || (x > 1))
return
policies::raise_domain_error<T>(
function,
"The Legendre Polynomial is defined for"
" -1 <= x <= 1, but got x = %1%."
, x, pol);
T p0, p1;
src/boost/math/special_functions/legendre.hpp view on Meta::CPAN
555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
p1 = x;
}
if
(l == 0)
return
p0;
unsigned n = 1;
while
(n < l)
{
std::swap(p0, p1);
p1 = boost::math::legendre_next(n, x, p0, p1);
++n;
}
return
p1;
}
} // namespace detail
template <class T, class Policy>
inline typename tools::promote_args<T>::type
legendre_p(
int
l, T x, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
static const char* function =
"boost::math::legendre_p<%1%>(unsigned, %1%)"
;
if
(l < 0)
return
policies::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(-l-1, static_cast<value_type>(x), pol, false), function);
return
policies::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(l, static_cast<value_type>(x), pol, false), function);
}
template <class T>
inline typename tools::promote_args<T>::type
legendre_p(
int
l, T x)
{
return
boost::math::legendre_p(l, x, policies::policy<>());
}
template <class T, class Policy>
inline typename tools::promote_args<T>::type
legendre_q(unsigned l, T x, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
return
policies::checked_narrowing_cast<result_type, Policy>(detail::legendre_imp(l, static_cast<value_type>(x), pol, true),
"boost::math::legendre_q<%1%>(unsigned, %1%)"
);
}
template <class T>
inline typename tools::promote_args<T>::type
legendre_q(unsigned l, T x)
{
return
boost::math::legendre_q(l, x, policies::policy<>());
}
// Recurrence
for
associated polynomials:
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
return
((2 * l + 1) * result_type(x) * result_type(Pl) - (l + m) * result_type(Plm1)) / (l + 1 - m);
}
namespace detail{
// Legendre P associated polynomial:
template <class T, class Policy>
T legendre_p_imp(
int
l,
int
m, T x, T sin_theta_power, const Policy& pol)
{
// Error handling:
if
((x < -1) || (x > 1))
return
policies::raise_domain_error<T>(
"boost::math::legendre_p<%1%>(int, int, %1%)"
,
"The associated Legendre Polynomial is defined for"
" -1 <= x <= 1, but got x = %1%."
, x, pol);
// Handle negative arguments first:
if
(l < 0)
return
legendre_p_imp(-l-1, m, x, sin_theta_power, pol);
if
(m < 0)
{
int
sign = (m&1) ? -1 : 1;
return
sign * boost::math::tgamma_ratio(static_cast<T>(l+m+1), static_cast<T>(l+1-m), pol) * legendre_p_imp(l, -m, x, sin_theta_power, pol);
}
// Special cases:
if
(m > l)
return
0;
if
(m == 0)
return
boost::math::legendre_p(l, x, pol);
T p0 = boost::math::double_factorial<T>(2 * m - 1, pol) * sin_theta_power;
if
(m&1)
p0 *= -1;
if
(m == l)
return
p0;
T p1 = x * (2 * m + 1) * p0;
int
n = m + 1;
while
(n < l)
{
std::swap(p0, p1);
p1 = boost::math::legendre_next(n, m, x, p0, p1);
++n;
}
return
p1;
}
template <class T, class Policy>
inline T legendre_p_imp(
int
l,
int
m, T x, const Policy& pol)
{
BOOST_MATH_STD_USING
return
legendre_p_imp(l, m, x, static_cast<T>(pow(1 - x
*x
, T(
abs
(m))/2)), pol);
}
}
template <class T, class Policy>
inline typename tools::promote_args<T>::type
legendre_p(
int
l,
int
m, T x, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
return
policies::checked_narrowing_cast<result_type, Policy>(detail::legendre_p_imp(l, m, static_cast<value_type>(x), pol),
"bost::math::legendre_p<%1%>(int, int, %1%)"
);
}
template <class T>
inline typename tools::promote_args<T>::type
legendre_p(
int
l,
int
m, T x)
{
return
boost::math::legendre_p(l, m, x, policies::policy<>());
}
} // namespace math
} // namespace boost
#endif // BOOST_MATH_SPECIAL_LEGENDRE_HPP
src/boost/math/special_functions/math_fwd.hpp view on Meta::CPAN
162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210typename tools::promote_args<RT>::type erf_inv(RT z, const Policy& pol);
template <class RT>// Error function complement inverse.
typename tools::promote_args<RT>::type erfc_inv(RT z);
template <class RT, class Policy>// Error function complement inverse.
typename tools::promote_args<RT>::type erfc_inv(RT z, const Policy& pol);
// Polynomials:
template <class T1, class T2, class T3>
typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1);
template <class T>
typename tools::promote_args<T>::type
legendre_p(
int
l, T x);
template <class T, class Policy>
typename tools::promote_args<T>::type
legendre_p(
int
l, T x, const Policy& pol);
template <class T>
typename tools::promote_args<T>::type
legendre_q(unsigned l, T x);
template <class T, class Policy>
typename tools::promote_args<T>::type
legendre_q(unsigned l, T x, const Policy& pol);
template <class T1, class T2, class T3>
typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1);
template <class T>
typename tools::promote_args<T>::type
legendre_p(
int
l,
int
m, T x);
template <class T, class Policy>
typename tools::promote_args<T>::type
legendre_p(
int
l,
int
m, T x, const Policy& pol);
template <class T1, class T2, class T3>
typename tools::promote_args<T1, T2, T3>::type
laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
template <class T1, class T2, class T3>
typename tools::promote_args<T1, T2, T3>::type
laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1);
template <class T>
src/boost/math/special_functions/math_fwd.hpp view on Meta::CPAN
928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962\
template <class RT>\
inline typename boost::math::tools::promote_args<RT>::type erfc(RT z){
return
::boost::math::erfc(z, Policy()); }\
\
template <class RT>\
inline typename boost::math::tools::promote_args<RT>::type erf_inv(RT z) {
return
::boost::math::erf_inv(z, Policy()); }\
\
template <class RT>\
inline typename boost::math::tools::promote_args<RT>::type erfc_inv(RT z){
return
::boost::math::erfc_inv(z, Policy()); }\
\
using boost::math::legendre_next;\
\
template <class T>\
inline typename boost::math::tools::promote_args<T>::type \
legendre_p(
int
l, T x){
return
::boost::math::legendre_p(l, x, Policy()); }\
\
template <class T>\
inline typename boost::math::tools::promote_args<T>::type \
legendre_q(unsigned l, T x){
return
::boost::math::legendre_q(l, x, Policy()); }\
\
using ::boost::math::legendre_next;\
\
template <class T>\
inline typename boost::math::tools::promote_args<T>::type \
legendre_p(
int
l,
int
m, T x){
return
::boost::math::legendre_p(l, m, x, Policy()); }\
\
using ::boost::math::laguerre_next;\
\
template <class T>\
inline typename boost::math::tools::promote_args<T>::type \
laguerre(unsigned n, T x){
return
::boost::math::laguerre(n, x, Policy()); }\
\
template <class T1, class T2>\
inline typename boost::math::laguerre_result<T1, T2>::type \
laguerre(unsigned n, T1 m, T2 x) {
return
::boost::math::laguerre(n, m, x, Policy()); }\
src/boost/math/special_functions/spherical_harmonic.hpp view on Meta::CPAN
456789101112131415161718192021222324// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_SPECIAL_SPHERICAL_HARMONIC_HPP
#define BOOST_MATH_SPECIAL_SPHERICAL_HARMONIC_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/math/special_functions/legendre.hpp>
#include <boost/math/tools/workaround.hpp>
#include <complex>
namespace boost{
namespace math{
namespace detail{
//
// Calculates the prefix term that's common to the real
src/boost/math/special_functions/spherical_harmonic.hpp view on Meta::CPAN
293031323334353637383940414243444546474849inline T spherical_harmonic_prefix(unsigned n, unsigned m, T theta, const Policy& pol)
{
BOOST_MATH_STD_USING
if
(m > n)
return
0;
T sin_theta =
sin
(theta);
T x =
cos
(theta);
T leg = detail::legendre_p_imp(n, m, x, static_cast<T>(pow(fabs(sin_theta), T(m))), pol);
T prefix = boost::math::tgamma_delta_ratio(static_cast<T>(n - m + 1), static_cast<T>(2 * m), pol);
prefix *= (2 * n + 1) / (4 * constants::pi<T>());
prefix =
sqrt
(prefix);
return
prefix * leg;
}
//
// Real Part:
//
template <class T, class Policy>
( run in 0.374 second using v1.01-cache-2.11-cpan-eab888a1d7d )