Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,17 @@
/* INTIO.H - Interface for reading and writing integers one byte at a time. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
int intio_read (FILE *); /* Read an integer */
void intio_write (FILE *, int); /* Write an integer */
@@ -0,0 +1,549 @@
// Copyright John Maddock 2007.
// Copyright Paul A. Bristow 2007
// Use, modification and distribution are subject to the
// 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_SF_DETAIL_INV_T_HPP
#define BOOST_MATH_SF_DETAIL_INV_T_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/math/special_functions/cbrt.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/trunc.hpp>
namespace boost{ namespace math{ namespace detail{
//
// The main method used is due to Hill:
//
// G. W. Hill, Algorithm 396, Student's t-Quantiles,
// Communications of the ACM, 13(10): 619-620, Oct., 1970.
//
template <class T, class Policy>
T inverse_students_t_hill(T ndf, T u, const Policy& pol)
{
BOOST_MATH_STD_USING
BOOST_ASSERT(u <= 0.5);
T a, b, c, d, q, x, y;
if (ndf > 1e20f)
return -boost::math::erfc_inv(2 * u, pol) * constants::root_two<T>();
a = 1 / (ndf - 0.5f);
b = 48 / (a * a);
c = ((20700 * a / b - 98) * a - 16) * a + 96.36f;
d = ((94.5f / (b + c) - 3) / b + 1) * sqrt(a * constants::pi<T>() / 2) * ndf;
y = pow(d * 2 * u, 2 / ndf);
if (y > (0.05f + a))
{
//
// Asymptotic inverse expansion about normal:
//
x = -boost::math::erfc_inv(2 * u, pol) * constants::root_two<T>();
y = x * x;
if (ndf < 5)
c += 0.3f * (ndf - 4.5f) * (x + 0.6f);
c += (((0.05f * d * x - 5) * x - 7) * x - 2) * x + b;
y = (((((0.4f * y + 6.3f) * y + 36) * y + 94.5f) / c - y - 3) / b + 1) * x;
y = boost::math::expm1(a * y * y, pol);
}
else
{
y = static_cast<T>(((1 / (((ndf + 6) / (ndf * y) - 0.089f * d - 0.822f)
* (ndf + 2) * 3) + 0.5 / (ndf + 4)) * y - 1)
* (ndf + 1) / (ndf + 2) + 1 / y);
}
q = sqrt(ndf * y);
return -q;
}
//
// Tail and body series are due to Shaw:
//
// www.mth.kcl.ac.uk/~shaww/web_page/papers/Tdistribution06.pdf
//
// Shaw, W.T., 2006, "Sampling Student's T distribution - use of
// the inverse cumulative distribution function."
// Journal of Computational Finance, Vol 9 Issue 4, pp 37-73, Summer 2006
//
template <class T, class Policy>
T inverse_students_t_tail_series(T df, T v, const Policy& pol)
{
BOOST_MATH_STD_USING
// Tail series expansion, see section 6 of Shaw's paper.
// w is calculated using Eq 60:
T w = boost::math::tgamma_delta_ratio(df / 2, constants::half<T>(), pol)
* sqrt(df * constants::pi<T>()) * v;
// define some variables:
T np2 = df + 2;
T np4 = df + 4;
T np6 = df + 6;
//
// Calculate the coefficients d(k), these depend only on the
// number of degrees of freedom df, so at least in theory
// we could tabulate these for fixed df, see p15 of Shaw:
//
T d[7] = { 1, };
d[1] = -(df + 1) / (2 * np2);
np2 *= (df + 2);
d[2] = -df * (df + 1) * (df + 3) / (8 * np2 * np4);
np2 *= df + 2;
d[3] = -df * (df + 1) * (df + 5) * (((3 * df) + 7) * df -2) / (48 * np2 * np4 * np6);
np2 *= (df + 2);
np4 *= (df + 4);
d[4] = -df * (df + 1) * (df + 7) *
( (((((15 * df) + 154) * df + 465) * df + 286) * df - 336) * df + 64 )
/ (384 * np2 * np4 * np6 * (df + 8));
np2 *= (df + 2);
d[5] = -df * (df + 1) * (df + 3) * (df + 9)
* (((((((35 * df + 452) * df + 1573) * df + 600) * df - 2020) * df) + 928) * df -128)
/ (1280 * np2 * np4 * np6 * (df + 8) * (df + 10));
np2 *= (df + 2);
np4 *= (df + 4);
np6 *= (df + 6);
d[6] = -df * (df + 1) * (df + 11)
* ((((((((((((945 * df) + 31506) * df + 425858) * df + 2980236) * df + 11266745) * df + 20675018) * df + 7747124) * df - 22574632) * df - 8565600) * df + 18108416) * df - 7099392) * df + 884736)
/ (46080 * np2 * np4 * np6 * (df + 8) * (df + 10) * (df +12));
//
// Now bring everthing together to provide the result,
// this is Eq 62 of Shaw:
//
T rn = sqrt(df);
T div = pow(rn * w, 1 / df);
T power = div * div;
T result = tools::evaluate_polynomial<7, T, T>(d, power);
result *= rn;
result /= div;
return -result;
}
template <class T, class Policy>
T inverse_students_t_body_series(T df, T u, const Policy& pol)
{
BOOST_MATH_STD_USING
//
// Body series for small N:
//
// Start with Eq 56 of Shaw:
//
T v = boost::math::tgamma_delta_ratio(df / 2, constants::half<T>(), pol)
* sqrt(df * constants::pi<T>()) * (u - constants::half<T>());
//
// Workspace for the polynomial coefficients:
//
T c[11] = { 0, 1, };
//
// Figure out what the coefficients are, note these depend
// only on the degrees of freedom (Eq 57 of Shaw):
//
T in = 1 / df;
c[2] = static_cast<T>(0.16666666666666666667 + 0.16666666666666666667 * in);
c[3] = static_cast<T>((0.0083333333333333333333 * in
+ 0.066666666666666666667) * in
+ 0.058333333333333333333);
c[4] = static_cast<T>(((0.00019841269841269841270 * in
+ 0.0017857142857142857143) * in
+ 0.026785714285714285714) * in
+ 0.025198412698412698413);
c[5] = static_cast<T>((((2.7557319223985890653e-6 * in
+ 0.00037477954144620811287) * in
- 0.0011078042328042328042) * in
+ 0.010559964726631393298) * in
+ 0.012039792768959435626);
c[6] = static_cast<T>(((((2.5052108385441718775e-8 * in
- 0.000062705427288760622094) * in
+ 0.00059458674042007375341) * in
- 0.0016095979637646304313) * in
+ 0.0061039211560044893378) * in
+ 0.0038370059724226390893);
c[7] = static_cast<T>((((((1.6059043836821614599e-10 * in
+ 0.000015401265401265401265) * in
- 0.00016376804137220803887) * in
+ 0.00069084207973096861986) * in
- 0.0012579159844784844785) * in
+ 0.0010898206731540064873) * in
+ 0.0032177478835464946576);
c[8] = static_cast<T>(((((((7.6471637318198164759e-13 * in
- 3.9851014346715404916e-6) * in
+ 0.000049255746366361445727) * in
- 0.00024947258047043099953) * in
+ 0.00064513046951456342991) * in
- 0.00076245135440323932387) * in
+ 0.000033530976880017885309) * in
+ 0.0017438262298340009980);
c[9] = static_cast<T>((((((((2.8114572543455207632e-15 * in
+ 1.0914179173496789432e-6) * in
- 0.000015303004486655377567) * in
+ 0.000090867107935219902229) * in
- 0.00029133414466938067350) * in
+ 0.00051406605788341121363) * in
- 0.00036307660358786885787) * in
- 0.00031101086326318780412) * in
+ 0.00096472747321388644237);
c[10] = static_cast<T>(((((((((8.2206352466243297170e-18 * in
- 3.1239569599829868045e-7) * in
+ 4.8903045291975346210e-6) * in
- 0.000033202652391372058698) * in
+ 0.00012645437628698076975) * in
- 0.00028690924218514613987) * in
+ 0.00035764655430568632777) * in
- 0.00010230378073700412687) * in
- 0.00036942667800009661203) * in
+ 0.00054229262813129686486);
//
// The result is then a polynomial in v (see Eq 56 of Shaw):
//
return tools::evaluate_odd_polynomial<11, T, T>(c, v);
}
template <class T, class Policy>
T inverse_students_t(T df, T u, T v, const Policy& pol, bool* pexact = 0)
{
//
// df = number of degrees of freedom.
// u = probablity.
// v = 1 - u.
// l = lanczos type to use.
//
BOOST_MATH_STD_USING
bool invert = false;
T result = 0;
if(pexact)
*pexact = false;
if(u > v)
{
// function is symmetric, invert it:
std::swap(u, v);
invert = true;
}
if((floor(df) == df) && (df < 20))
{
//
// we have integer degrees of freedom, try for the special
// cases first:
//
T tolerance = ldexp(1.0f, (2 * policies::digits<T, Policy>()) / 3);
switch(itrunc(df, Policy()))
{
case 1:
{
//
// df = 1 is the same as the Cauchy distribution, see
// Shaw Eq 35:
//
if(u == 0.5)
result = 0;
else
result = -cos(constants::pi<T>() * u) / sin(constants::pi<T>() * u);
if(pexact)
*pexact = true;
break;
}
case 2:
{
//
// df = 2 has an exact result, see Shaw Eq 36:
//
result =(2 * u - 1) / sqrt(2 * u * v);
if(pexact)
*pexact = true;
break;
}
case 4:
{
//
// df = 4 has an exact result, see Shaw Eq 38 & 39:
//
T alpha = 4 * u * v;
T root_alpha = sqrt(alpha);
T r = 4 * cos(acos(root_alpha) / 3) / root_alpha;
T x = sqrt(r - 4);
result = u - 0.5f < 0 ? (T)-x : x;
if(pexact)
*pexact = true;
break;
}
case 6:
{
//
// We get numeric overflow in this area:
//
if(u < 1e-150)
return (invert ? -1 : 1) * inverse_students_t_hill(df, u, pol);
//
// Newton-Raphson iteration of a polynomial case,
// choice of seed value is taken from Shaw's online
// supplement:
//
T a = 4 * (u - u * u);//1 - 4 * (u - 0.5f) * (u - 0.5f);
T b = boost::math::cbrt(a);
static const T c = static_cast<T>(0.85498797333834849467655443627193);
T p = 6 * (1 + c * (1 / b - 1));
T p0;
do{
T p2 = p * p;
T p4 = p2 * p2;
T p5 = p * p4;
p0 = p;
// next term is given by Eq 41:
p = 2 * (8 * a * p5 - 270 * p2 + 2187) / (5 * (4 * a * p4 - 216 * p - 243));
}while(fabs((p - p0) / p) > tolerance);
//
// Use Eq 45 to extract the result:
//
p = sqrt(p - df);
result = (u - 0.5f) < 0 ? (T)-p : p;
break;
}
#if 0
//
// These are Shaw's "exact" but iterative solutions
// for even df, the numerical accuracy of these is
// rather less than Hill's method, so these are disabled
// for now, which is a shame because they are reasonably
// quick to evaluate...
//
case 8:
{
//
// Newton-Raphson iteration of a polynomial case,
// choice of seed value is taken from Shaw's online
// supplement:
//
static const T c8 = 0.85994765706259820318168359251872L;
T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f);
T b = pow(a, T(1) / 4);
T p = 8 * (1 + c8 * (1 / b - 1));
T p0 = p;
do{
T p5 = p * p;
p5 *= p5 * p;
p0 = p;
// Next term is given by Eq 42:
p = 2 * (3 * p + (640 * (160 + p * (24 + p * (p + 4)))) / (-5120 + p * (-2048 - 960 * p + a * p5))) / 7;
}while(fabs((p - p0) / p) > tolerance);
//
// Use Eq 45 to extract the result:
//
p = sqrt(p - df);
result = (u - 0.5f) < 0 ? -p : p;
break;
}
case 10:
{
//
// Newton-Raphson iteration of a polynomial case,
// choice of seed value is taken from Shaw's online
// supplement:
//
static const T c10 = 0.86781292867813396759105692122285L;
T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f);
T b = pow(a, T(1) / 5);
T p = 10 * (1 + c10 * (1 / b - 1));
T p0;
do{
T p6 = p * p;
p6 *= p6 * p6;
p0 = p;
// Next term given by Eq 43:
p = (8 * p) / 9 + (218750 * (21875 + 4 * p * (625 + p * (75 + 2 * p * (5 + p))))) /
(9 * (-68359375 + 8 * p * (-2343750 + p * (-546875 - 175000 * p + 8 * a * p6))));
}while(fabs((p - p0) / p) > tolerance);
//
// Use Eq 45 to extract the result:
//
p = sqrt(p - df);
result = (u - 0.5f) < 0 ? -p : p;
break;
}
#endif
default:
goto calculate_real;
}
}
else
{
calculate_real:
if(df > 0x10000000)
{
result = -boost::math::erfc_inv(2 * u, pol) * constants::root_two<T>();
if((pexact) && (df >= 1e20))
*pexact = true;
}
else if(df < 3)
{
//
// Use a roughly linear scheme to choose between Shaw's
// tail series and body series:
//
T crossover = 0.2742f - df * 0.0242143f;
if(u > crossover)
{
result = boost::math::detail::inverse_students_t_body_series(df, u, pol);
}
else
{
result = boost::math::detail::inverse_students_t_tail_series(df, u, pol);
}
}
else
{
//
// Use Hill's method except in the exteme tails
// where we use Shaw's tail series.
// The crossover point is roughly exponential in -df:
//
T crossover = ldexp(1.0f, iround(T(df / -0.654f), typename policies::normalise<Policy, policies::rounding_error<policies::ignore_error> >::type()));
if(u > crossover)
{
result = boost::math::detail::inverse_students_t_hill(df, u, pol);
}
else
{
result = boost::math::detail::inverse_students_t_tail_series(df, u, pol);
}
}
}
return invert ? (T)-result : result;
}
template <class T, class Policy>
inline T find_ibeta_inv_from_t_dist(T a, T p, T /*q*/, T* py, const Policy& pol)
{
T u = p / 2;
T v = 1 - u;
T df = a * 2;
T t = boost::math::detail::inverse_students_t(df, u, v, pol);
*py = t * t / (df + t * t);
return df / (df + t * t);
}
template <class T, class Policy>
inline T fast_students_t_quantile_imp(T df, T p, const Policy& pol, const mpl::false_*)
{
BOOST_MATH_STD_USING
//
// Need to use inverse incomplete beta to get
// required precision so not so fast:
//
T probability = (p > 0.5) ? 1 - p : p;
T t, x, y(0);
x = ibeta_inv(df / 2, T(0.5), 2 * probability, &y, pol);
if(df * y > tools::max_value<T>() * x)
t = policies::raise_overflow_error<T>("boost::math::students_t_quantile<%1%>(%1%,%1%)", 0, pol);
else
t = sqrt(df * y / x);
//
// Figure out sign based on the size of p:
//
if(p < 0.5)
t = -t;
return t;
}
template <class T, class Policy>
T fast_students_t_quantile_imp(T df, T p, const Policy& pol, const mpl::true_*)
{
BOOST_MATH_STD_USING
bool invert = false;
if((df < 2) && (floor(df) != df))
return boost::math::detail::fast_students_t_quantile_imp(df, p, pol, static_cast<mpl::false_*>(0));
if(p > 0.5)
{
p = 1 - p;
invert = true;
}
//
// Get an estimate of the result:
//
bool exact;
T t = inverse_students_t(df, p, T(1-p), pol, &exact);
if((t == 0) || exact)
return invert ? -t : t; // can't do better!
//
// Change variables to inverse incomplete beta:
//
T t2 = t * t;
T xb = df / (df + t2);
T y = t2 / (df + t2);
T a = df / 2;
//
// t can be so large that x underflows,
// just return our estimate in that case:
//
if(xb == 0)
return t;
//
// Get incomplete beta and it's derivative:
//
T f1;
T f0 = xb < y ? ibeta_imp(a, constants::half<T>(), xb, pol, false, true, &f1)
: ibeta_imp(constants::half<T>(), a, y, pol, true, true, &f1);
// Get cdf from incomplete beta result:
T p0 = f0 / 2 - p;
// Get pdf from derivative:
T p1 = f1 * sqrt(y * xb * xb * xb / df);
//
// Second derivative divided by p1:
//
// yacas gives:
//
// In> PrettyForm(Simplify(D(t) (1 + t^2/v) ^ (-(v+1)/2)))
//
// | | v + 1 | |
// | -| ----- + 1 | |
// | | 2 | |
// -| | 2 | |
// | | t | |
// | | -- + 1 | |
// | ( v + 1 ) * | v | * t |
// ---------------------------------------------
// v
//
// Which after some manipulation is:
//
// -p1 * t * (df + 1) / (t^2 + df)
//
T p2 = t * (df + 1) / (t * t + df);
// Halley step:
t = fabs(t);
t += p0 / (p1 + p0 * p2 / 2);
return !invert ? -t : t;
}
template <class T, class Policy>
inline T fast_students_t_quantile(T df, T p, const Policy& pol)
{
typedef typename policies::evaluation<T, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
typedef mpl::bool_<
(std::numeric_limits<T>::digits <= 53)
&&
(std::numeric_limits<T>::is_specialized)
&&
(std::numeric_limits<T>::radix == 2)
> tag_type;
return policies::checked_narrowing_cast<T, forwarding_policy>(fast_students_t_quantile_imp(static_cast<value_type>(df), static_cast<value_type>(p), pol, static_cast<tag_type*>(0)), "boost::math::students_t_quantile<%1%>(%1%,%1%,%1%)");
}
}}} // namespaces
#endif // BOOST_MATH_SF_DETAIL_INV_T_HPP
@@ -0,0 +1,336 @@
subroutine imopen(plotfile)
character*(*) plotfile
common/imcom/ lu,npage
lu=80
open(lu,file=plotfile,status='unknown')
write(lu,1000)
1000 format('%!PS-Adobe-2.0'/ &
'/rightshow { dup stringwidth pop neg 0 rmoveto show } def'/ &
'/centershow { dup stringwidth pop neg 2 div ', &
'0 rmoveto show } def'/ &
'/lt { lineto } def'/'%%Page: 1 1')
npage=1
return
end subroutine imopen
subroutine impalette(palette)
character*(*) palette
integer r(0:8),g(0:8),b(0:8)
integer rr,gg,bb
common/imcom/ lu,npage
common/imcom2/rr(0:255),gg(0:255),bb(0:255)
if(palette.eq.'afmhot') then
do i=0,255
j=255-i
rr(i)=min(255,2*j)
gg(i)=max(0,min(255,2*j-128))
bb(i)=max(0,min(255,2*j-256))
enddo
else if(palette.eq.'hot') then
do i=0,255
j=255-i
rr(i)=min(255,3*j)
gg(i)=max(0,min(255,3*j-256))
bb(i)=max(0,min(255,3*j-512))
enddo
else
open(11,file="Palettes/"//palette,status="old")
do j=0,8
read(11,*) r(j),g(j),b(j)
enddo
close(11)
do i=0,255
j0=i/32
j1=j0+1
k=i-32*j0
rr(i)=r(j0) + int((k*(r(j1)-r(j0)))/31 + 0.5)
gg(i)=g(j0) + int((k*(g(j1)-g(j0)))/31 + 0.5)
bb(i)=b(j0) + int((k*(b(j1)-b(j0)))/31 + 0.5)
enddo
endif
return
end subroutine impalette
subroutine imclose
common/imcom/ lu,npage
write(lu,1000)
1000 format('showpage'/'%%Trailer')
close(lu)
return
end subroutine imclose
subroutine imnewpage
common/imcom/ lu,npage
npage=npage+1
write(lu,1000) npage,npage
1000 format('showpage'/'%%Page:',2i4)
return
end subroutine imnewpage
subroutine imxline(x,y,dx)
! Draw a line from (x,y) to (x+dx,y) integer r,g,b
common/imcom/ lu,npage
write(lu,1000) 72.0*x,72.0*y,72.0*dx
1000 format('newpath',2f7.1,' moveto',f7.1,' 0 rlineto stroke')
return
end subroutine imxline
subroutine imyline(x,y,dy)
! Draw a line from (x,y) to (x,y+dy)
common/imcom/ lu,npage
write(lu,1000) 72.0*x,72.0*y,72.0*dy
1000 format('newpath',2f7.1,' moveto 0',f7.1,' rlineto stroke')
return
end subroutine imyline
subroutine imwidth(width)
common/imcom/ lu,npage
write(lu,1000) width
1000 format(f7.1,' setlinewidth')
return
end subroutine imwidth
subroutine imfont(fontname,npoints)
character*(*) fontname
common/imcom/ lu,npage
write(lu,1000) fontname,npoints
1000 format('/',a,' findfont',i4,' scalefont setfont')
return
end subroutine imfont
subroutine imstring(string,x,y,just,ndeg)
character*(*) string
common/imcom/ lu,npage
write(lu,1000) 72.0*x,72.0*y,ndeg,string
1000 format(2f7.1,' moveto',i4,' rotate'/'(',a,')')
if(just.eq.1) write(lu,*) 'rightshow'
if(just.eq.2) write(lu,*) 'centershow'
if(just.eq.3) write(lu,*) 'show'
write(lu,1010) -ndeg
1010 format(i4,' rotate'/)
return
end subroutine imstring
subroutine imr4mat(z,IP,JP,imax,jmax,zz1,zz2,x,y,dx,dy,nbox)
real z(IP,JP)
integer idat(2048)
common/imcom/ lu,npage
z1=zz1
z2=zz2
if(z1.eq.0.0 .and. z2.eq.0.0) then
z1=z(1,1)
z2=z1
do i=1,imax
do j=1,jmax
z1=min(z(i,j),z1)
z2=max(z(i,j),z2)
enddo
enddo
endif
scale=255.99/(z2-z1)
write(lu,1002) 72.0*x,72.0*y,72.0*dx,72.0*dy
1002 format(2f7.1,' translate',2f7.1,' scale')
write(lu,*) imax,jmax,8,' [',imax,0,0,jmax,0,0,']'
write(lu,*) '{<'
do j=1,jmax
do i=1,imax
idat(i)=scale*(z(i,j)-z1)
idat(i)=max(idat(i),0)
idat(i)=min(idat(i),255)
idat(i)=255-idat(i)
enddo
write(lu,1004) (idat(i),i=1,imax)
1004 format(30z2.2)
enddo
write(lu,*) '>} image'
write(lu,1006) 1.0/(72.0*dx),1.0/(72.0*dy),-72.0*x,-72.0*y
1006 format(2f9.6,' scale',2f7.1,' translate')
if(nbox.ne.0) then
write(lu,1010) 72.0*x,72.0*y,72.0*dx,72.0*dy,-72*dx
1010 format('newpath',2f7.1,' moveto',f7.1,' 0 rlineto 0', &
f7.1,' rlineto',f7.1,' 0 rlineto closepath stroke')
endif
return
end subroutine imr4mat
subroutine imr4mat_color(z,IP,JP,imax,jmax,zz1,zz2,x,y,dx,dy,nbox)
real z(IP,JP)
integer idat(2048,3)
integer rr,gg,bb
common/imcom/ lu,npage
common/imcom2/rr(0:255),gg(0:255),bb(0:255)
z1=zz1
z2=zz2
if(z1.eq.0.0 .and. z2.eq.0.0) then
z1=z(1,1)
z2=z1
do i=1,imax
do j=1,jmax
z1=min(z(i,j),z1)
z2=max(z(i,j),z2)
enddo
enddo
endif
scale=255.99/(z2-z1)
write(lu,1002) 72.0*x,72.0*y,72.0*dx,72.0*dy
1002 format(2f7.1,' translate',2f7.1,' scale')
write(lu,1003) imax,jmax,8,imax,0,0,jmax,0,0
1003 format(3i5,' [',6i4,']')
write(lu,1004) imax
1004 format('{currentfile 3',i4,' mul string readhexstring pop} bind'/ &
'false 3 colorimage')
do j=1,jmax
do i=1,imax
n=scale*(z(i,j)-z1)
n=max(n,0)
n=min(n,255)
idat(i,1)=rr(n)
idat(i,2)=gg(n)
idat(i,3)=bb(n)
enddo
write(lu,1005) (idat(i,1),idat(i,2),idat(i,3),i=1,imax)
1005 format(30z2.2)
enddo
write(lu,1006) 1.0/(72.0*dx),1.0/(72.0*dy),-72.0*x,-72.0*y
1006 format(2f9.6,' scale',2f7.1,' translate')
if(nbox.ne.0) then
write(lu,1010) 72.0*x,72.0*y,72.0*dx,72.0*dy,-72*dx
1010 format('newpath',2f7.1,' moveto',f7.1,' 0 rlineto 0', &
f7.1,' rlineto',f7.1,' 0 rlineto closepath stroke')
endif
return
end subroutine imr4mat_color
subroutine imr4pro(p,imax,yy1,yy2,x,y,dx,dy,nbox)
real p(imax)
common/imcom/ lu,npage
y1=yy1
y2=yy2
if(y1.eq.0.0 .and. y2.eq.0.0) then
y1=p(1)
y2=y1
do i=1,imax
y1=min(p(i),y1)
y2=max(p(i),y2)
enddo
endif
xscale=72.0*dx/imax
xoff=72.0*x
yscale=72.0*dy
if(y1.ne.y2) yscale=yscale/(y2-y1)
yoff=72.0*y
write(lu,*) '1.416 setmiterlimit'
write(lu,1002) xoff+0.5*xscale,yoff+yscale*(p(1)-y1)
1002 format('newpath',2f7.1,' moveto')
do i=2,imax
write(lu,1004) xoff+(i-0.5)*xscale,yoff+yscale*(p(i)-y1)
1004 format(2f6.1,' lt')
enddo
write(lu,*) 'stroke'
if(nbox.ne.0) then
write(lu,1010) xoff,yoff,72.0*dx,72.0*dy,-72*dx
1010 format('newpath',2f7.1,' moveto',f7.1,' 0 rlineto 0', &
f7.1,' rlineto',f7.1,' 0 rlineto closepath stroke')
endif
return
end subroutine imr4pro
subroutine imline(x1,y1,x2,y2)
common/imcom/ lu,npage
write(lu,1000) 72*x1,72*y1,72*x2,72*y2
1000 format('newpath',2f7.1,' moveto',2f7.1,' lineto stroke')
return
end subroutine imline
subroutine imcircle(x,y,radius,shade)
common/imcom/ lu,npage
write(lu,1000) shade
1000 format(f7.1,' setgray')
write(lu,1002) 72*x,72*y,72*radius
1002 format('newpath',3f7.1,' 0 360 arc fill')
write(lu,1000) 0.0
write(lu,1004) 72*x,72*y,72*radius
1004 format('newpath',3f7.1,' 0 360 arc stroke')
return
end subroutine imcircle
subroutine imtriangle(x,y,rr,shade)
common/imcom/ lu,npage
write(lu,1000) shade
1000 format(f7.1,' setgray')
write(lu,1002) 72*x,72*(y+rr)
1002 format('newpath',2f7.1,' moveto ')
write(lu,1004) 72*(x-rr),72*(y-rr)
1004 format(2f7.1,' lineto ')
write(lu,1004) 72*(x+rr),72*(y-rr)
write(lu,*) 'closepath fill 0 setgray'
write(lu,1002) 72*x,72*(y+rr)
write(lu,1004) 72*(x-rr),72*(y-rr)
write(lu,1004) 72*(x+rr),72*(y-rr)
write(lu,*) 'closepath stroke'
return
end subroutine imtriangle
subroutine imr4prov(p,jmax,xx1,xx2,x,y,dx,dy,nbox)
real p(jmax)
common/imcom/ lu,npage
x1=xx1
x2=xx2
if(x1.eq.0.0 .and. x2.eq.0.0) then
x1=p(1)
x2=x1
do j=1,jmax
x1=min(p(j),x1)
x2=max(p(j),x2)
enddo
endif
xscale=72.0*dx
xoff=72.0*x
if(x1.ne.x2) xscale=xscale/(x2-x1)
yscale=72.0*dy/jmax
yoff=72.0*y
write(lu,*) '1.416 setmiterlimit'
write(lu,1002) xoff+xscale*(x2-p(1)),yoff+0.5*yscale
1002 format('newpath',2f7.1,' moveto')
do j=2,jmax
write(lu,1004) xoff+xscale*(x2-p(j)),yoff+(j-0.5)*yscale
1004 format(2f6.1,' lt')
enddo
write(lu,*) 'stroke'
if(nbox.ne.0) then
write(lu,1010) xoff,yoff,72.0*dx,72.0*dy,-72*dx
1010 format('newpath',2f7.1,' moveto',f7.1,' 0 rlineto 0', &
f7.1,' rlineto',f7.1,' 0 rlineto closepath stroke')
endif
return
end subroutine imr4prov
@@ -0,0 +1,37 @@
// Copyright David Abrahams 2002.
// Distributed under the 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 PYOBJECT_TYPE_DWA2002720_HPP
# define PYOBJECT_TYPE_DWA2002720_HPP
# include <boost/python/cast.hpp>
namespace boost { namespace python { namespace converter {
BOOST_PYTHON_DECL PyObject* checked_downcast_impl(PyObject*, PyTypeObject*);
// Used as a base class for specializations which need to provide
// Python type checking capability.
template <class Object, PyTypeObject* pytype>
struct pyobject_type
{
static bool check(PyObject* x)
{
return ::PyObject_IsInstance(x, (PyObject*)pytype);
}
static Object* checked_downcast(PyObject* x)
{
return python::downcast<Object>(
(checked_downcast_impl)(x, pytype)
);
}
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
static PyTypeObject const* get_pytype() { return pytype; }
#endif
};
}}} // namespace boost::python::converter
#endif // PYOBJECT_TYPE_DWA2002720_HPP
@@ -0,0 +1,68 @@
#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// boost/smart_ptr/bad_weak_ptr.hpp
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <exception>
#ifdef __BORLANDC__
# pragma warn -8026 // Functions with excep. spec. are not expanded inline
#endif
namespace boost
{
// The standard library that comes with Borland C++ 5.5.1, 5.6.4
// defines std::exception and its members as having C calling
// convention (-pc). When the definition of bad_weak_ptr
// is compiled with -ps, the compiler issues an error.
// Hence, the temporary #pragma option -pc below.
#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
# pragma option push -pc
#endif
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wweak-vtables"
#endif
class bad_weak_ptr: public std::exception
{
public:
virtual char const * what() const throw()
{
return "tr1::bad_weak_ptr";
}
};
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
# pragma option pop
#endif
} // namespace boost
#ifdef __BORLANDC__
# pragma warn .8026 // Functions with excep. spec. are not expanded inline
#endif
#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
@@ -0,0 +1,77 @@
///////////////////////////////////////////////////////////////////////////////
// memfun_funop.hpp
// Contains overloads of memfun::operator().
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
template<typename A0>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0);
}
template<typename A0 , typename A1>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1);
}
template<typename A0 , typename A1 , typename A2>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2);
}
template<typename A0 , typename A1 , typename A2 , typename A3>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4 , a5);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4 , a5 , a6);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
}
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
BOOST_FORCEINLINE
result_type operator()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8 , A9 const &a9) const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
}
@@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2009-2013.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
// This code was modified from the code posted by Alexandre Courpron in his
// article "Interface Detection" in The Code Project:
// http://www.codeproject.com/KB/architecture/Detector.aspx
///////////////////////////////////////////////////////////////////////////////
// Copyright 2007 Alexandre Courpron
//
// Permission to use, copy, modify, redistribute and sell this software,
// provided that this copyright notice appears on all copies of the software.
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
#define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost {
namespace intrusive {
namespace function_detector {
typedef char NotFoundType;
struct StaticFunctionType { NotFoundType x [2]; };
struct NonStaticFunctionType { NotFoundType x [3]; };
enum
{ NotFound = 0,
StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
};
} //namespace boost {
} //namespace intrusive {
} //namespace function_detector {
#define BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
namespace boost { \
namespace intrusive { \
namespace function_detector { \
template < class T, \
class NonStaticType, \
class NonStaticConstType, \
class StaticType > \
class DetectMember_##InstantiationKey_##Identifier { \
template < NonStaticType > \
struct TestNonStaticNonConst ; \
\
template < NonStaticConstType > \
struct TestNonStaticConst ; \
\
template < StaticType > \
struct TestStatic ; \
\
template <class U > \
static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
\
template <class U > \
static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
\
template <class U> \
static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
\
template <class U> \
static NotFoundType Test( ... ); \
public : \
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
};\
}}} //namespace boost::intrusive::function_detector {
#define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
ReturnType (Class::*)Params,\
ReturnType (Class::*)Params const,\
ReturnType (*)Params \
>::check
#endif //@ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
@@ -0,0 +1,124 @@
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval.hpp>
#else
#if !BOOST_PHOENIX_IS_ITERATING
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/function_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp")
#endif
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
#define PHOENIX_GET_ARG(z, n, data) \
typedef \
typename boost::add_reference< \
typename boost::add_const< \
typename boost::result_of< \
boost::phoenix::evaluator( \
BOOST_PP_CAT(A, n) \
, Context \
) \
>::type \
>::type \
>::type \
BOOST_PP_CAT(a, n);
#define PHOENIX_EVAL_ARG(z, n, data) \
help_rvalue_deduction(boost::phoenix::eval(BOOST_PP_CAT(a, n), ctx))
#define M0(z, n, data) \
typename proto::detail::uncvref<BOOST_PP_CAT(a, n)>::type
#define BOOST_PHOENIX_ITERATION_PARAMS \
(3, (1, BOOST_PP_DEC(BOOST_PHOENIX_ACTOR_LIMIT), \
<boost/phoenix/core/detail/cpp03/function_eval.hpp>))
#include BOOST_PHOENIX_ITERATE()
#undef PHOENIX_GET_ARG
#undef PHOENIX_EVAL_ARG
#undef M0
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#else
template <
typename This
, typename F
, BOOST_PHOENIX_typename_A
, typename Context
>
struct result<This(F, BOOST_PHOENIX_A, Context)>
{
typedef typename
remove_reference<
typename boost::result_of<evaluator(F, Context)>::type
>::type
fn;
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, PHOENIX_GET_ARG, _)
typedef typename
boost::result_of<fn(BOOST_PHOENIX_a)>::type
type;
/*
typedef typename
mpl::eval_if_c<
has_phx2_result<
fn
, BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, M0, _)
>::value
, boost::result_of<
fn(
BOOST_PHOENIX_a
)
>
, phx2_result<
fn
, BOOST_PHOENIX_a
>
>::type
type;
*/
};
template <typename F, BOOST_PHOENIX_typename_A, typename Context>
typename result<
function_eval(
F const &
, BOOST_PHOENIX_A_ref
, Context const &
)
>::type
operator()(F const & f, BOOST_PHOENIX_A_ref_a, Context const & ctx) const
{
return boost::phoenix::eval(f, ctx)(BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, PHOENIX_EVAL_ARG, _));
}
template <typename F, BOOST_PHOENIX_typename_A, typename Context>
typename result<
function_eval(
F &
, BOOST_PHOENIX_A_ref
, Context const &
)
>::type
operator()(F & f, BOOST_PHOENIX_A_ref_a, Context const & ctx) const
{
return boost::phoenix::eval(f, ctx)(BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, PHOENIX_EVAL_ARG, _));
}
#endif
#endif
@@ -0,0 +1,50 @@
/*=============================================================================
Copyright (c) 2014 Kohei Takahashi
Distributed under the 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 FUSION_MAKE_TUPLE_14122014_0048
#define FUSION_MAKE_TUPLE_14122014_0048
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/tuple/tuple_fwd.hpp>
///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version
///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# include <boost/fusion/tuple/detail/make_tuple.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/tuple/tuple.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion
{
template <typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline tuple<typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...>
make_tuple(T&&... arg)
{
typedef tuple<typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...> result_type;
return result_type(std::forward<T>(arg)...);
}
}}
#endif
#endif
@@ -0,0 +1,66 @@
// (C) Copyright John Maddock 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This file is machine generated, do not edit by hand
// Polynomial evaluation using Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[1] * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,130 @@
//
// bind/mem_fn_vw.hpp - void return helper wrappers
//
// Do not include this header directly
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
//
template<class R, class T> struct BOOST_MEM_FN_NAME(mf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, R (BOOST_MEM_FN_CC T::*) ()>
{
typedef R (BOOST_MEM_FN_CC T::*F) ();
explicit BOOST_MEM_FN_NAME(mf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, F>(f) {}
};
template<class R, class T> struct BOOST_MEM_FN_NAME(cmf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, R (BOOST_MEM_FN_CC T::*) () const>
{
typedef R (BOOST_MEM_FN_CC T::*F) () const;
explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, F>(f) {}
};
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(mf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1);
explicit BOOST_MEM_FN_NAME(mf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, F>(f) {}
};
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(cmf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1) const;
explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, F>(f) {}
};
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(mf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2);
explicit BOOST_MEM_FN_NAME(mf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, F>(f) {}
};
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(cmf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const;
explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(mf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3);
explicit BOOST_MEM_FN_NAME(mf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(cmf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const;
explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(mf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4);
explicit BOOST_MEM_FN_NAME(mf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(cmf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const;
explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(mf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5);
explicit BOOST_MEM_FN_NAME(mf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(cmf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const;
explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(mf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6);
explicit BOOST_MEM_FN_NAME(mf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(cmf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const;
explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(mf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7);
explicit BOOST_MEM_FN_NAME(mf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(cmf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const;
explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(mf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8)>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8);
explicit BOOST_MEM_FN_NAME(mf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
};
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(cmf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8) const>
{
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const;
explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
};
@@ -0,0 +1,53 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2009 Helge Bahmann
* Copyright (c) 2012 Tim Blechmann
* Copyright (c) 2013 - 2014 Andrey Semashev
*/
/*!
* \file atomic/detail/bitwise_cast.hpp
*
* This header defines \c bitwise_cast used to convert between storage and value types
*/
#ifndef BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
#include <boost/atomic/detail/config.hpp>
#if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
#include <cstring>
#endif
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace atomics {
namespace detail {
template< typename To, typename From >
BOOST_FORCEINLINE To bitwise_cast(From const& from) BOOST_NOEXCEPT
{
struct
{
To to;
}
value = {};
BOOST_ATOMIC_DETAIL_MEMCPY
(
&reinterpret_cast< char& >(value.to),
&reinterpret_cast< const char& >(from),
(sizeof(From) < sizeof(To) ? sizeof(From) : sizeof(To))
);
return value.to;
}
} // namespace detail
} // namespace atomics
} // namespace boost
#endif // BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
@@ -0,0 +1,82 @@
#ifndef BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED
#define BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2003-2007
// Copyright David Abrahams 2003-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/long.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/prior.hpp>
#include <boost/mpl/set/aux_/set0.hpp>
#include <boost/mpl/aux_/type_wrapper.hpp>
#include <boost/mpl/aux_/config/arrays.hpp>
namespace boost { namespace mpl {
template< typename T, typename Base >
struct s_item
: Base
{
typedef s_item<T,Base> item_;
typedef void_ last_masked_;
typedef T item_type_;
typedef typename Base::item_ base;
typedef s_item type;
typedef typename next< typename Base::size >::type size;
typedef typename next< typename Base::order >::type order;
#if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
#else
typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
#endif
BOOST_MPL_AUX_SET_OVERLOAD( order_tag_, ORDER_BY_KEY, s_item, aux::type_wrapper<T>* );
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_item, aux::type_wrapper<T>* );
};
template< typename T, typename Base >
struct s_mask
: Base
{
typedef s_mask<T,Base> item_;
typedef T last_masked_;
typedef void_ item_type_;
typedef typename Base::item_ base;
typedef typename prior< typename Base::size >::type size;
typedef s_mask type;
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper<T>* );
};
template< typename T, typename Base >
struct s_unmask
: Base
{
typedef s_unmask<T,Base> item_;
typedef void_ last_masked_;
typedef T item_type_;
typedef typename Base::item_ base;
typedef typename next< typename Base::size >::type size;
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper<T>* );
};
}}
#endif // BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED
@@ -0,0 +1,14 @@
=== Calibrating Your Radio
[ ... TBD ... ]
=== Reference Spectrum
WSJT-X provides a tool that can be used to determine the detailed
shape of your receiver's passband. Disconnect your antenna or tune to
a quiet frequency with no signals. With WSJT-X running in one of the
slow modes, select *Measure reference spectrum* from the *File* menu.
Wait for about a minute and then hit the *Stop* button. A file named
`refspec.dat` should appear in your log directory.
[ ... more to come ...]
@@ -0,0 +1,17 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_ENUM_PARAMS_HPP
# define BOOST_PREPROCESSOR_ENUM_PARAMS_HPP
#
# include <boost/preprocessor/repetition/enum_params.hpp>
#
# endif
@@ -0,0 +1,41 @@
#ifndef CANDIDATE_KEY_FILTER_HPP_
#define CANDIDATE_KEY_FILTER_HPP_
#include <QSortFilterProxyModel>
#include <QModelIndex>
#include "pimpl_h.hpp"
class QAbstractItemModel;
class CandidateKeyFilter final
: public QSortFilterProxyModel
{
public:
explicit CandidateKeyFilter (QAbstractItemModel * referenced_model
, int referenced_key_column
, QObject * parent = nullptr
, int referenced_key_role = Qt::EditRole);
explicit CandidateKeyFilter (QAbstractItemModel * referenced_model
, QAbstractItemModel const * referencing_model
, int referenced_key_column
, int referencing_key_column
, QObject * parent = nullptr
, int referenced_key_role = Qt::EditRole
, int referencing_key_role = Qt::EditRole);
~CandidateKeyFilter ();
// this key is not to be filtered, usually because we want to allow
// it since we are editing the row that contains it this it is valid
// even though it is in use
void set_active_key (QModelIndex const& index = QModelIndex {});
protected:
bool filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const override;
private:
class impl;
pimpl<impl> m_;
};
#endif
@@ -0,0 +1,56 @@
subroutine genft8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
! Encode an FT8 message, producing array itone().
use crc
use packjt
include 'ft8_params.f90'
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
logical bcontest
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11)
integer itone(NN)
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
write(cbits,1000) i4Msg6BitWords,32*i3bit
1000 format(12b6.6,b8.8)
read(cbits,1001) i1Msg8BitBytes(1:10)
1001 format(10b8)
i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),128+64+32)
i1Msg8BitBytes(11)=0
icrc12=crc12(c_loc(i1Msg8BitBytes),11)
! For reference, here's how to check the CRC
! i1Msg8BitBytes(10)=icrc12/256
! i1Msg8BitBytes(11)=iand (icrc12,255)
! checksumok = crc12_check(c_loc (i1Msg8BitBytes), 11)
! if( checksumok ) write(*,*) 'Good checksum'
write(cbits,1003) i4Msg6BitWords,i3bit,icrc12
1003 format(12b6.6,b3.3,b12.12)
read(cbits,1004) msgbits
1004 format(87i1)
call encode174(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1:7)=icos7
itone(36+1:36+7)=icos7
itone(NN-6:NN)=icos7
k=7
do j=1,ND
i=3*j -2
k=k+1
if(j.eq.30) k=k+7
itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
enddo
return
end subroutine genft8
@@ -0,0 +1,33 @@
/*=============================================================================
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SINGLE_VIEW_SIZE_IMPL_JUL_07_2011_1348PM)
#define FUSION_SINGLE_VIEW_SIZE_IMPL_JUL_07_2011_1348PM
namespace boost { namespace fusion
{
struct single_view_tag;
namespace extension
{
template <typename Tag>
struct size_impl;
template <>
struct size_impl<single_view_tag>
{
template <typename Sequence>
struct apply
{
typedef mpl::int_<1> type;
};
};
}
}}
#endif
@@ -0,0 +1,809 @@
// Copyright John Maddock 2008.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Wrapper that works with mpfr_class defined in gmpfrxx.h
// See http://math.berkeley.edu/~wilken/code/gmpfrxx/
// Also requires the gmp and mpfr libraries.
//
#ifndef BOOST_MATH_E_FLOAT_BINDINGS_HPP
#define BOOST_MATH_E_FLOAT_BINDINGS_HPP
#include <boost/config.hpp>
#include <e_float/e_float.h>
#include <functions/functions.h>
#include <boost/math/tools/precision.hpp>
#include <boost/math/tools/real_cast.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/math/distributions/fwd.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/bindings/detail/big_digamma.hpp>
#include <boost/math/bindings/detail/big_lanczos.hpp>
#include <boost/lexical_cast.hpp>
namespace boost{ namespace math{ namespace ef{
class e_float
{
public:
// Constructors:
e_float() {}
e_float(const ::e_float& c) : m_value(c){}
e_float(char c)
{
m_value = ::e_float(c);
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
e_float(wchar_t c)
{
m_value = ::e_float(c);
}
#endif
e_float(unsigned char c)
{
m_value = ::e_float(c);
}
e_float(signed char c)
{
m_value = ::e_float(c);
}
e_float(unsigned short c)
{
m_value = ::e_float(c);
}
e_float(short c)
{
m_value = ::e_float(c);
}
e_float(unsigned int c)
{
m_value = ::e_float(c);
}
e_float(int c)
{
m_value = ::e_float(c);
}
e_float(unsigned long c)
{
m_value = ::e_float((UINT64)c);
}
e_float(long c)
{
m_value = ::e_float((INT64)c);
}
#ifdef BOOST_HAS_LONG_LONG
e_float(boost::ulong_long_type c)
{
m_value = ::e_float(c);
}
e_float(boost::long_long_type c)
{
m_value = ::e_float(c);
}
#endif
e_float(float c)
{
assign_large_real(c);
}
e_float(double c)
{
assign_large_real(c);
}
e_float(long double c)
{
assign_large_real(c);
}
// Assignment:
e_float& operator=(char c) { m_value = ::e_float(c); return *this; }
e_float& operator=(unsigned char c) { m_value = ::e_float(c); return *this; }
e_float& operator=(signed char c) { m_value = ::e_float(c); return *this; }
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
e_float& operator=(wchar_t c) { m_value = ::e_float(c); return *this; }
#endif
e_float& operator=(short c) { m_value = ::e_float(c); return *this; }
e_float& operator=(unsigned short c) { m_value = ::e_float(c); return *this; }
e_float& operator=(int c) { m_value = ::e_float(c); return *this; }
e_float& operator=(unsigned int c) { m_value = ::e_float(c); return *this; }
e_float& operator=(long c) { m_value = ::e_float((INT64)c); return *this; }
e_float& operator=(unsigned long c) { m_value = ::e_float((UINT64)c); return *this; }
#ifdef BOOST_HAS_LONG_LONG
e_float& operator=(boost::long_long_type c) { m_value = ::e_float(c); return *this; }
e_float& operator=(boost::ulong_long_type c) { m_value = ::e_float(c); return *this; }
#endif
e_float& operator=(float c) { assign_large_real(c); return *this; }
e_float& operator=(double c) { assign_large_real(c); return *this; }
e_float& operator=(long double c) { assign_large_real(c); return *this; }
// Access:
::e_float& value(){ return m_value; }
::e_float const& value()const{ return m_value; }
// Member arithmetic:
e_float& operator+=(const e_float& other)
{ m_value += other.value(); return *this; }
e_float& operator-=(const e_float& other)
{ m_value -= other.value(); return *this; }
e_float& operator*=(const e_float& other)
{ m_value *= other.value(); return *this; }
e_float& operator/=(const e_float& other)
{ m_value /= other.value(); return *this; }
e_float operator-()const
{ return -m_value; }
e_float const& operator+()const
{ return *this; }
private:
::e_float m_value;
template <class V>
void assign_large_real(const V& a)
{
using std::frexp;
using std::ldexp;
using std::floor;
if (a == 0) {
m_value = ::ef::zero();
return;
}
if (a == 1) {
m_value = ::ef::one();
return;
}
if ((boost::math::isinf)(a))
{
m_value = a > 0 ? m_value.my_value_inf() : -m_value.my_value_inf();
return;
}
if((boost::math::isnan)(a))
{
m_value = m_value.my_value_nan();
return;
}
int e;
long double f, term;
::e_float t;
m_value = ::ef::zero();
f = frexp(a, &e);
::e_float shift = ::ef::pow2(30);
while(f)
{
// extract 30 bits from f:
f = ldexp(f, 30);
term = floor(f);
e -= 30;
m_value *= shift;
m_value += ::e_float(static_cast<INT64>(term));
f -= term;
}
m_value *= ::ef::pow2(e);
}
};
// Non-member arithmetic:
inline e_float operator+(const e_float& a, const e_float& b)
{
e_float result(a);
result += b;
return result;
}
inline e_float operator-(const e_float& a, const e_float& b)
{
e_float result(a);
result -= b;
return result;
}
inline e_float operator*(const e_float& a, const e_float& b)
{
e_float result(a);
result *= b;
return result;
}
inline e_float operator/(const e_float& a, const e_float& b)
{
e_float result(a);
result /= b;
return result;
}
// Comparison:
inline bool operator == (const e_float& a, const e_float& b)
{ return a.value() == b.value() ? true : false; }
inline bool operator != (const e_float& a, const e_float& b)
{ return a.value() != b.value() ? true : false;}
inline bool operator < (const e_float& a, const e_float& b)
{ return a.value() < b.value() ? true : false; }
inline bool operator <= (const e_float& a, const e_float& b)
{ return a.value() <= b.value() ? true : false; }
inline bool operator > (const e_float& a, const e_float& b)
{ return a.value() > b.value() ? true : false; }
inline bool operator >= (const e_float& a, const e_float& b)
{ return a.value() >= b.value() ? true : false; }
std::istream& operator >> (std::istream& is, e_float& f)
{
return is >> f.value();
}
std::ostream& operator << (std::ostream& os, const e_float& f)
{
return os << f.value();
}
inline e_float fabs(const e_float& v)
{
return ::ef::fabs(v.value());
}
inline e_float abs(const e_float& v)
{
return ::ef::fabs(v.value());
}
inline e_float floor(const e_float& v)
{
return ::ef::floor(v.value());
}
inline e_float ceil(const e_float& v)
{
return ::ef::ceil(v.value());
}
inline e_float pow(const e_float& v, const e_float& w)
{
return ::ef::pow(v.value(), w.value());
}
inline e_float pow(const e_float& v, int i)
{
return ::ef::pow(v.value(), ::e_float(i));
}
inline e_float exp(const e_float& v)
{
return ::ef::exp(v.value());
}
inline e_float log(const e_float& v)
{
return ::ef::log(v.value());
}
inline e_float sqrt(const e_float& v)
{
return ::ef::sqrt(v.value());
}
inline e_float sin(const e_float& v)
{
return ::ef::sin(v.value());
}
inline e_float cos(const e_float& v)
{
return ::ef::cos(v.value());
}
inline e_float tan(const e_float& v)
{
return ::ef::tan(v.value());
}
inline e_float acos(const e_float& v)
{
return ::ef::acos(v.value());
}
inline e_float asin(const e_float& v)
{
return ::ef::asin(v.value());
}
inline e_float atan(const e_float& v)
{
return ::ef::atan(v.value());
}
inline e_float atan2(const e_float& v, const e_float& u)
{
return ::ef::atan2(v.value(), u.value());
}
inline e_float ldexp(const e_float& v, int e)
{
return v.value() * ::ef::pow2(e);
}
inline e_float frexp(const e_float& v, int* expon)
{
double d;
INT64 i;
v.value().extract_parts(d, i);
*expon = static_cast<int>(i);
return v.value() * ::ef::pow2(-i);
}
inline e_float sinh (const e_float& x)
{
return ::ef::sinh(x.value());
}
inline e_float cosh (const e_float& x)
{
return ::ef::cosh(x.value());
}
inline e_float tanh (const e_float& x)
{
return ::ef::tanh(x.value());
}
inline e_float asinh (const e_float& x)
{
return ::ef::asinh(x.value());
}
inline e_float acosh (const e_float& x)
{
return ::ef::acosh(x.value());
}
inline e_float atanh (const e_float& x)
{
return ::ef::atanh(x.value());
}
e_float fmod(const e_float& v1, const e_float& v2)
{
e_float n;
if(v1 < 0)
n = ceil(v1 / v2);
else
n = floor(v1 / v2);
return v1 - n * v2;
}
} namespace detail{
template <>
inline int fpclassify_imp< boost::math::ef::e_float> BOOST_NO_MACRO_EXPAND(boost::math::ef::e_float x, const generic_tag<true>&)
{
if(x.value().isnan())
return FP_NAN;
if(x.value().isinf())
return FP_INFINITE;
if(x == 0)
return FP_ZERO;
return FP_NORMAL;
}
} namespace ef{
template <class Policy>
inline int itrunc(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::trunc(v, pol);
if(fabs(r) > (std::numeric_limits<int>::max)())
return static_cast<int>(policies::raise_rounding_error("boost::math::itrunc<%1%>(%1%)", 0, 0, v, pol));
return static_cast<int>(r.value().extract_int64());
}
template <class Policy>
inline long ltrunc(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::trunc(v, pol);
if(fabs(r) > (std::numeric_limits<long>::max)())
return static_cast<long>(policies::raise_rounding_error("boost::math::ltrunc<%1%>(%1%)", 0, 0L, v, pol));
return static_cast<long>(r.value().extract_int64());
}
#ifdef BOOST_HAS_LONG_LONG
template <class Policy>
inline boost::long_long_type lltrunc(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::trunc(v, pol);
if(fabs(r) > (std::numeric_limits<boost::long_long_type>::max)())
return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::lltrunc<%1%>(%1%)", 0, v, 0LL, pol).value().extract_int64());
return static_cast<boost::long_long_type>(r.value().extract_int64());
}
#endif
template <class Policy>
inline int iround(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::round(v, pol);
if(fabs(r) > (std::numeric_limits<int>::max)())
return static_cast<int>(policies::raise_rounding_error("boost::math::iround<%1%>(%1%)", 0, v, 0, pol).value().extract_int64());
return static_cast<int>(r.value().extract_int64());
}
template <class Policy>
inline long lround(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::round(v, pol);
if(fabs(r) > (std::numeric_limits<long>::max)())
return static_cast<long int>(policies::raise_rounding_error("boost::math::lround<%1%>(%1%)", 0, v, 0L, pol).value().extract_int64());
return static_cast<long int>(r.value().extract_int64());
}
#ifdef BOOST_HAS_LONG_LONG
template <class Policy>
inline boost::long_long_type llround(const e_float& v, const Policy& pol)
{
BOOST_MATH_STD_USING
e_float r = boost::math::round(v, pol);
if(fabs(r) > (std::numeric_limits<boost::long_long_type>::max)())
return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::llround<%1%>(%1%)", 0, v, 0LL, pol).value().extract_int64());
return static_cast<boost::long_long_type>(r.value().extract_int64());
}
#endif
}}}
namespace std{
template<>
class numeric_limits< ::boost::math::ef::e_float> : public numeric_limits< ::e_float>
{
public:
static const ::boost::math::ef::e_float (min) (void)
{
return (numeric_limits< ::e_float>::min)();
}
static const ::boost::math::ef::e_float (max) (void)
{
return (numeric_limits< ::e_float>::max)();
}
static const ::boost::math::ef::e_float epsilon (void)
{
return (numeric_limits< ::e_float>::epsilon)();
}
static const ::boost::math::ef::e_float round_error(void)
{
return (numeric_limits< ::e_float>::round_error)();
}
static const ::boost::math::ef::e_float infinity (void)
{
return (numeric_limits< ::e_float>::infinity)();
}
static const ::boost::math::ef::e_float quiet_NaN (void)
{
return (numeric_limits< ::e_float>::quiet_NaN)();
}
//
// e_float's supplied digits member is wrong
// - it should be same the same as digits 10
// - given that radix is 10.
//
static const int digits = digits10;
};
} // namespace std
namespace boost{ namespace math{
namespace policies{
template <class Policy>
struct precision< ::boost::math::ef::e_float, Policy>
{
typedef typename Policy::precision_type precision_type;
typedef digits2<((::std::numeric_limits< ::boost::math::ef::e_float>::digits10 + 1) * 1000L) / 301L> digits_2;
typedef typename mpl::if_c<
((digits_2::value <= precision_type::value)
|| (Policy::precision_type::value <= 0)),
// Default case, full precision for RealType:
digits_2,
// User customised precision:
precision_type
>::type type;
};
}
namespace tools{
template <>
inline int digits< ::boost::math::ef::e_float>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC( ::boost::math::ef::e_float))
{
return ((::std::numeric_limits< ::boost::math::ef::e_float>::digits10 + 1) * 1000L) / 301L;
}
template <>
inline ::boost::math::ef::e_float root_epsilon< ::boost::math::ef::e_float>()
{
return detail::root_epsilon_imp(static_cast< ::boost::math::ef::e_float const*>(0), mpl::int_<0>());
}
template <>
inline ::boost::math::ef::e_float forth_root_epsilon< ::boost::math::ef::e_float>()
{
return detail::forth_root_epsilon_imp(static_cast< ::boost::math::ef::e_float const*>(0), mpl::int_<0>());
}
}
namespace lanczos{
template<class Policy>
struct lanczos<boost::math::ef::e_float, Policy>
{
typedef typename mpl::if_c<
std::numeric_limits< ::e_float>::digits10 < 22,
lanczos13UDT,
typename mpl::if_c<
std::numeric_limits< ::e_float>::digits10 < 36,
lanczos22UDT,
typename mpl::if_c<
std::numeric_limits< ::e_float>::digits10 < 50,
lanczos31UDT,
typename mpl::if_c<
std::numeric_limits< ::e_float>::digits10 < 110,
lanczos61UDT,
undefined_lanczos
>::type
>::type
>::type
>::type type;
};
} // namespace lanczos
template <class Policy>
inline boost::math::ef::e_float skewness(const extreme_value_distribution<boost::math::ef::e_float, Policy>& /*dist*/)
{
//
// This is 12 * sqrt(6) * zeta(3) / pi^3:
// See http://mathworld.wolfram.com/ExtremeValueDistribution.html
//
return boost::lexical_cast<boost::math::ef::e_float>("1.1395470994046486574927930193898461120875997958366");
}
template <class Policy>
inline boost::math::ef::e_float skewness(const rayleigh_distribution<boost::math::ef::e_float, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
return boost::lexical_cast<boost::math::ef::e_float>("0.63111065781893713819189935154422777984404221106391");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 2 * root_pi<RealType>() * pi_minus_three<RealType>() / pow23_four_minus_pi<RealType>();
}
template <class Policy>
inline boost::math::ef::e_float kurtosis(const rayleigh_distribution<boost::math::ef::e_float, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
return boost::lexical_cast<boost::math::ef::e_float>("3.2450893006876380628486604106197544154170667057995");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 3 - (6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
}
template <class Policy>
inline boost::math::ef::e_float kurtosis_excess(const rayleigh_distribution<boost::math::ef::e_float, Policy>& /*dist*/)
{
//using namespace boost::math::constants;
// Computed using NTL at 150 bit, about 50 decimal digits.
return boost::lexical_cast<boost::math::ef::e_float>("0.2450893006876380628486604106197544154170667057995");
// return -(6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
} // kurtosis
namespace detail{
//
// Version of Digamma accurate to ~100 decimal digits.
//
template <class Policy>
boost::math::ef::e_float digamma_imp(boost::math::ef::e_float x, const mpl::int_<0>* , const Policy& pol)
{
//
// This handles reflection of negative arguments, and all our
// eboost::math::ef::e_floator handling, then forwards to the T-specific approximation.
//
BOOST_MATH_STD_USING // ADL of std functions.
boost::math::ef::e_float result = 0;
//
// Check for negative arguments and use reflection:
//
if(x < 0)
{
// Reflect:
x = 1 - x;
// Argument reduction for tan:
boost::math::ef::e_float remainder = x - floor(x);
// Shift to negative if > 0.5:
if(remainder > 0.5)
{
remainder -= 1;
}
//
// check for evaluation at a negative pole:
//
if(remainder == 0)
{
return policies::raise_pole_error<boost::math::ef::e_float>("boost::math::digamma<%1%>(%1%)", 0, (1-x), pol);
}
result = constants::pi<boost::math::ef::e_float>() / tan(constants::pi<boost::math::ef::e_float>() * remainder);
}
result += big_digamma(x);
return result;
}
boost::math::ef::e_float bessel_i0(boost::math::ef::e_float x)
{
static const boost::math::ef::e_float P1[] = {
boost::lexical_cast<boost::math::ef::e_float>("-2.2335582639474375249e+15"),
boost::lexical_cast<boost::math::ef::e_float>("-5.5050369673018427753e+14"),
boost::lexical_cast<boost::math::ef::e_float>("-3.2940087627407749166e+13"),
boost::lexical_cast<boost::math::ef::e_float>("-8.4925101247114157499e+11"),
boost::lexical_cast<boost::math::ef::e_float>("-1.1912746104985237192e+10"),
boost::lexical_cast<boost::math::ef::e_float>("-1.0313066708737980747e+08"),
boost::lexical_cast<boost::math::ef::e_float>("-5.9545626019847898221e+05"),
boost::lexical_cast<boost::math::ef::e_float>("-2.4125195876041896775e+03"),
boost::lexical_cast<boost::math::ef::e_float>("-7.0935347449210549190e+00"),
boost::lexical_cast<boost::math::ef::e_float>("-1.5453977791786851041e-02"),
boost::lexical_cast<boost::math::ef::e_float>("-2.5172644670688975051e-05"),
boost::lexical_cast<boost::math::ef::e_float>("-3.0517226450451067446e-08"),
boost::lexical_cast<boost::math::ef::e_float>("-2.6843448573468483278e-11"),
boost::lexical_cast<boost::math::ef::e_float>("-1.5982226675653184646e-14"),
boost::lexical_cast<boost::math::ef::e_float>("-5.2487866627945699800e-18"),
};
static const boost::math::ef::e_float Q1[] = {
boost::lexical_cast<boost::math::ef::e_float>("-2.2335582639474375245e+15"),
boost::lexical_cast<boost::math::ef::e_float>("7.8858692566751002988e+12"),
boost::lexical_cast<boost::math::ef::e_float>("-1.2207067397808979846e+10"),
boost::lexical_cast<boost::math::ef::e_float>("1.0377081058062166144e+07"),
boost::lexical_cast<boost::math::ef::e_float>("-4.8527560179962773045e+03"),
boost::lexical_cast<boost::math::ef::e_float>("1.0"),
};
static const boost::math::ef::e_float P2[] = {
boost::lexical_cast<boost::math::ef::e_float>("-2.2210262233306573296e-04"),
boost::lexical_cast<boost::math::ef::e_float>("1.3067392038106924055e-02"),
boost::lexical_cast<boost::math::ef::e_float>("-4.4700805721174453923e-01"),
boost::lexical_cast<boost::math::ef::e_float>("5.5674518371240761397e+00"),
boost::lexical_cast<boost::math::ef::e_float>("-2.3517945679239481621e+01"),
boost::lexical_cast<boost::math::ef::e_float>("3.1611322818701131207e+01"),
boost::lexical_cast<boost::math::ef::e_float>("-9.6090021968656180000e+00"),
};
static const boost::math::ef::e_float Q2[] = {
boost::lexical_cast<boost::math::ef::e_float>("-5.5194330231005480228e-04"),
boost::lexical_cast<boost::math::ef::e_float>("3.2547697594819615062e-02"),
boost::lexical_cast<boost::math::ef::e_float>("-1.1151759188741312645e+00"),
boost::lexical_cast<boost::math::ef::e_float>("1.3982595353892851542e+01"),
boost::lexical_cast<boost::math::ef::e_float>("-6.0228002066743340583e+01"),
boost::lexical_cast<boost::math::ef::e_float>("8.5539563258012929600e+01"),
boost::lexical_cast<boost::math::ef::e_float>("-3.1446690275135491500e+01"),
boost::lexical_cast<boost::math::ef::e_float>("1.0"),
};
boost::math::ef::e_float value, factor, r;
BOOST_MATH_STD_USING
using namespace boost::math::tools;
if (x < 0)
{
x = -x; // even function
}
if (x == 0)
{
return static_cast<boost::math::ef::e_float>(1);
}
if (x <= 15) // x in (0, 15]
{
boost::math::ef::e_float y = x * x;
value = evaluate_polynomial(P1, y) / evaluate_polynomial(Q1, y);
}
else // x in (15, \infty)
{
boost::math::ef::e_float y = 1 / x - boost::math::ef::e_float(1) / 15;
r = evaluate_polynomial(P2, y) / evaluate_polynomial(Q2, y);
factor = exp(x) / sqrt(x);
value = factor * r;
}
return value;
}
boost::math::ef::e_float bessel_i1(boost::math::ef::e_float x)
{
static const boost::math::ef::e_float P1[] = {
lexical_cast<boost::math::ef::e_float>("-1.4577180278143463643e+15"),
lexical_cast<boost::math::ef::e_float>("-1.7732037840791591320e+14"),
lexical_cast<boost::math::ef::e_float>("-6.9876779648010090070e+12"),
lexical_cast<boost::math::ef::e_float>("-1.3357437682275493024e+11"),
lexical_cast<boost::math::ef::e_float>("-1.4828267606612366099e+09"),
lexical_cast<boost::math::ef::e_float>("-1.0588550724769347106e+07"),
lexical_cast<boost::math::ef::e_float>("-5.1894091982308017540e+04"),
lexical_cast<boost::math::ef::e_float>("-1.8225946631657315931e+02"),
lexical_cast<boost::math::ef::e_float>("-4.7207090827310162436e-01"),
lexical_cast<boost::math::ef::e_float>("-9.1746443287817501309e-04"),
lexical_cast<boost::math::ef::e_float>("-1.3466829827635152875e-06"),
lexical_cast<boost::math::ef::e_float>("-1.4831904935994647675e-09"),
lexical_cast<boost::math::ef::e_float>("-1.1928788903603238754e-12"),
lexical_cast<boost::math::ef::e_float>("-6.5245515583151902910e-16"),
lexical_cast<boost::math::ef::e_float>("-1.9705291802535139930e-19"),
};
static const boost::math::ef::e_float Q1[] = {
lexical_cast<boost::math::ef::e_float>("-2.9154360556286927285e+15"),
lexical_cast<boost::math::ef::e_float>("9.7887501377547640438e+12"),
lexical_cast<boost::math::ef::e_float>("-1.4386907088588283434e+10"),
lexical_cast<boost::math::ef::e_float>("1.1594225856856884006e+07"),
lexical_cast<boost::math::ef::e_float>("-5.1326864679904189920e+03"),
lexical_cast<boost::math::ef::e_float>("1.0"),
};
static const boost::math::ef::e_float P2[] = {
lexical_cast<boost::math::ef::e_float>("1.4582087408985668208e-05"),
lexical_cast<boost::math::ef::e_float>("-8.9359825138577646443e-04"),
lexical_cast<boost::math::ef::e_float>("2.9204895411257790122e-02"),
lexical_cast<boost::math::ef::e_float>("-3.4198728018058047439e-01"),
lexical_cast<boost::math::ef::e_float>("1.3960118277609544334e+00"),
lexical_cast<boost::math::ef::e_float>("-1.9746376087200685843e+00"),
lexical_cast<boost::math::ef::e_float>("8.5591872901933459000e-01"),
lexical_cast<boost::math::ef::e_float>("-6.0437159056137599999e-02"),
};
static const boost::math::ef::e_float Q2[] = {
lexical_cast<boost::math::ef::e_float>("3.7510433111922824643e-05"),
lexical_cast<boost::math::ef::e_float>("-2.2835624489492512649e-03"),
lexical_cast<boost::math::ef::e_float>("7.4212010813186530069e-02"),
lexical_cast<boost::math::ef::e_float>("-8.5017476463217924408e-01"),
lexical_cast<boost::math::ef::e_float>("3.2593714889036996297e+00"),
lexical_cast<boost::math::ef::e_float>("-3.8806586721556593450e+00"),
lexical_cast<boost::math::ef::e_float>("1.0"),
};
boost::math::ef::e_float value, factor, r, w;
BOOST_MATH_STD_USING
using namespace boost::math::tools;
w = abs(x);
if (x == 0)
{
return static_cast<boost::math::ef::e_float>(0);
}
if (w <= 15) // w in (0, 15]
{
boost::math::ef::e_float y = x * x;
r = evaluate_polynomial(P1, y) / evaluate_polynomial(Q1, y);
factor = w;
value = factor * r;
}
else // w in (15, \infty)
{
boost::math::ef::e_float y = 1 / w - boost::math::ef::e_float(1) / 15;
r = evaluate_polynomial(P2, y) / evaluate_polynomial(Q2, y);
factor = exp(w) / sqrt(w);
value = factor * r;
}
if (x < 0)
{
value *= -value; // odd function
}
return value;
}
} // namespace detail
}}
#endif // BOOST_MATH_E_FLOAT_BINDINGS_HPP
@@ -0,0 +1,65 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_NEXT_05042005_1101)
#define FUSION_NEXT_05042005_1101
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/tag_of.hpp>
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct boost_array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
namespace extension
{
template <typename Tag>
struct next_impl
{
template <typename Iterator>
struct apply {};
};
template <>
struct next_impl<iterator_facade_tag>
{
template <typename Iterator>
struct apply : Iterator::template next<Iterator> {};
};
template <>
struct next_impl<boost_array_iterator_tag>;
template <>
struct next_impl<mpl_iterator_tag>;
template <>
struct next_impl<std_pair_iterator_tag>;
}
namespace result_of
{
template <typename Iterator>
struct next
: extension::next_impl<typename detail::tag_of<Iterator>::type>::
template apply<Iterator>
{};
}
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::next<Iterator>::type const
next(Iterator const& i)
{
return result_of::next<Iterator>::call(i);
}
}}
#endif
@@ -0,0 +1,297 @@
// Copyright (c) 2000-2011 Joerg Walter, Mathias Koch, David Bellot
//
// Distributed under the 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_UBLAS_EXCEPTION_
#define _BOOST_UBLAS_EXCEPTION_
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
#include <stdexcept>
#else
#include <cstdlib>
#endif
#ifndef BOOST_UBLAS_NO_STD_CERR
#include <iostream>
#endif
#include <boost/numeric/ublas/detail/config.hpp>
namespace boost { namespace numeric { namespace ublas {
/** \brief Exception raised when a division by zero occurs
*/
struct divide_by_zero
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::runtime_error
{
explicit divide_by_zero (const char *s = "divide by zero") :
std::runtime_error (s) {}
void raise () {
throw *this;
}
#else
{
divide_by_zero ()
{}
explicit divide_by_zero (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
/** \brief Expception raised when some interal errors occurs like computations errors, zeros values where you should not have zeros, etc...
*/
struct internal_logic
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::logic_error {
explicit internal_logic (const char *s = "internal logic") :
std::logic_error (s) {}
void raise () {
throw *this;
}
#else
{
internal_logic ()
{}
explicit internal_logic (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
struct external_logic
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::logic_error {
explicit external_logic (const char *s = "external logic") :
std::logic_error (s) {}
// virtual const char *what () const throw () {
// return "exception: external logic";
// }
void raise () {
throw *this;
}
#else
{
external_logic ()
{}
explicit external_logic (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
struct bad_argument
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::invalid_argument {
explicit bad_argument (const char *s = "bad argument") :
std::invalid_argument (s) {}
void raise () {
throw *this;
}
#else
{
bad_argument ()
{}
explicit bad_argument (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
/**
*/
struct bad_size
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::domain_error {
explicit bad_size (const char *s = "bad size") :
std::domain_error (s) {}
void raise () {
throw *this;
}
#else
{
bad_size ()
{}
explicit bad_size (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
struct bad_index
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::out_of_range {
explicit bad_index (const char *s = "bad index") :
std::out_of_range (s) {}
void raise () {
throw *this;
}
#else
{
bad_index ()
{}
explicit bad_index (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
struct singular
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::runtime_error {
explicit singular (const char *s = "singular") :
std::runtime_error (s) {}
void raise () {
throw *this;
}
#else
{
singular ()
{}
explicit singular (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
struct non_real
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
// Inherit from standard exceptions as requested during review.
: public std::domain_error {
explicit non_real (const char *s = "exception: non real") :
std::domain_error (s) {}
void raise () {
throw *this;
}
#else
{
non_real ()
{}
explicit non_real (const char *)
{}
void raise () {
std::abort ();
}
#endif
};
#if BOOST_UBLAS_CHECK_ENABLE
// Macros are equivilent to
// template<class E>
// BOOST_UBLAS_INLINE
// void check (bool expression, const E &e) {
// if (! expression)
// e.raise ();
// }
// template<class E>
// BOOST_UBLAS_INLINE
// void check_ex (bool expression, const char *file, int line, const E &e) {
// if (! expression)
// e.raise ();
// }
#ifndef BOOST_UBLAS_NO_STD_CERR
#define BOOST_UBLAS_CHECK_FALSE(e) \
std::cerr << "Check failed in file " << __FILE__ << " at line " << __LINE__ << ":" << std::endl; \
e.raise ();
#define BOOST_UBLAS_CHECK(expression, e) \
if (! (expression)) { \
std::cerr << "Check failed in file " << __FILE__ << " at line " << __LINE__ << ":" << std::endl; \
std::cerr << #expression << std::endl; \
e.raise (); \
}
#define BOOST_UBLAS_CHECK_EX(expression, file, line, e) \
if (! (expression)) { \
std::cerr << "Check failed in file " << (file) << " at line " << (line) << ":" << std::endl; \
std::cerr << #expression << std::endl; \
e.raise (); \
}
#else
#define BOOST_UBLAS_CHECK_FALSE(e) \
e.raise ();
#define BOOST_UBLAS_CHECK(expression, e) \
if (! (expression)) { \
e.raise (); \
}
#define BOOST_UBLAS_CHECK_EX(expression, file, line, e) \
if (! (expression)) { \
e.raise (); \
}
#endif
#else
// Macros are equivilent to
// template<class E>
// BOOST_UBLAS_INLINE
// void check (bool expression, const E &e) {}
// template<class E>
// BOOST_UBLAS_INLINE
// void check_ex (bool expression, const char *file, int line, const E &e) {}
#define BOOST_UBLAS_CHECK_FALSE(e)
#define BOOST_UBLAS_CHECK(expression, e)
#define BOOST_UBLAS_CHECK_EX(expression, file, line, e)
#endif
#ifndef BOOST_UBLAS_USE_FAST_SAME
// Macro is equivilent to
// template<class T>
// BOOST_UBLAS_INLINE
// const T &same_impl (const T &size1, const T &size2) {
// BOOST_UBLAS_CHECK (size1 == size2, bad_argument ());
// return (std::min) (size1, size2);
// }
// #define BOOST_UBLAS_SAME(size1, size2) same_impl ((size1), (size2))
// need two types here because different containers can have
// different size_types (especially sparse types)
template<class T1, class T2>
BOOST_UBLAS_INLINE
// Kresimir Fresl and Dan Muller reported problems with COMO.
// We better change the signature instead of libcomo ;-)
// const T &same_impl_ex (const T &size1, const T &size2, const char *file, int line) {
T1 same_impl_ex (const T1 &size1, const T2 &size2, const char *file, int line) {
BOOST_UBLAS_CHECK_EX (size1 == size2, file, line, bad_argument ());
return (size1 < size2)?(size1):(size2);
}
template<class T>
BOOST_UBLAS_INLINE
T same_impl_ex (const T &size1, const T &size2, const char *file, int line) {
BOOST_UBLAS_CHECK_EX (size1 == size2, file, line, bad_argument ());
return (std::min) (size1, size2);
}
#define BOOST_UBLAS_SAME(size1, size2) same_impl_ex ((size1), (size2), __FILE__, __LINE__)
#else
// Macros are equivilent to
// template<class T>
// BOOST_UBLAS_INLINE
// const T &same_impl (const T &size1, const T &size2) {
// return size1;
// }
// #define BOOST_UBLAS_SAME(size1, size2) same_impl ((size1), (size2))
#define BOOST_UBLAS_SAME(size1, size2) (size1)
#endif
}}}
#endif
@@ -0,0 +1,38 @@
// Boost.Assign library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/assign/
//
#ifndef BOOST_ASSIGN_STD_LIST_HPP
#define BOOST_ASSIGN_STD_LIST_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/assign/list_inserter.hpp>
#include <boost/config.hpp>
#include <list>
namespace boost
{
namespace assign
{
template< class V, class A, class V2 >
inline list_inserter< assign_detail::call_push_back< std::list<V,A> >, V >
operator+=( std::list<V,A>& c, V2 v )
{
return push_back( c )( v );
}
}
}
#endif
@@ -0,0 +1,104 @@
// Boost Lambda Library - is_instance_of.hpp ---------------------
// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see www.boost.org
// ---------------------------------------------------------------
#ifndef BOOST_LAMBDA_IS_INSTANCE_OF
#define BOOST_LAMBDA_IS_INSTANCE_OF
#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
#include "boost/type_traits/conversion_traits.hpp" // for is_convertible
#include "boost/preprocessor/enum_shifted_params.hpp"
#include "boost/preprocessor/repeat_2nd.hpp"
// is_instance_of --------------------------------
//
// is_instance_of_n<A, B>::value is true, if type A is
// an instantiation of a template B, or A derives from an instantiation
// of template B
//
// n is the number of template arguments for B
//
// Example:
// is_instance_of_2<std::istream, basic_stream>::value == true
// The original implementation was somewhat different, with different versions
// for different compilers. However, there was still a problem
// with gcc.3.0.2 and 3.0.3 compilers, which didn't think regard
// is_instance_of_N<...>::value was a constant.
// John Maddock suggested the way around this problem by building
// is_instance_of templates using boost::is_convertible.
// Now we only have one version of is_instance_of templates, which delagate
// all the nasty compiler tricks to is_convertible.
#define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class
#define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N
#define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N
#define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME)
#define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME)
#define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME)
namespace boost {
namespace lambda {
#define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \
\
namespace detail { \
\
template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \
struct BOOST_PP_CAT(conversion_tester_,INDEX) { \
template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \
BOOST_PP_CAT(conversion_tester_,INDEX) \
(const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \
}; \
\
} /* end detail */ \
\
template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \
struct BOOST_PP_CAT(is_instance_of_,INDEX) \
{ \
private: \
typedef ::boost::is_convertible< \
From, \
BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \
> helper_type; \
\
public: \
BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \
};
#define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) )
// Generate the traits for 1-4 argument templates
BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO)
#undef BOOST_LAMBDA_HELPER
#undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE
#undef BOOST_LAMBDA_CLASS
#undef BOOST_LAMBDA_ARG
#undef BOOST_LAMBDA_CLASS_ARG
#undef BOOST_LAMBDA_CLASS_LIST
#undef BOOST_LAMBDA_ARG_LIST
#undef BOOST_LAMBDA_CLASS_ARG_LIST
} // lambda
} // boost
#endif
@@ -0,0 +1,82 @@
#ifndef POSIX_TIME_DURATION_HPP___
#define POSIX_TIME_DURATION_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
* $Date$
*/
#include "boost/date_time/posix_time/posix_time_config.hpp"
namespace boost {
namespace posix_time {
//! Allows expression of durations as an hour count
/*! \ingroup time_basics
*/
class hours : public time_duration
{
public:
explicit hours(long h) :
time_duration(static_cast<hour_type>(h),0,0)
{}
};
//! Allows expression of durations as a minute count
/*! \ingroup time_basics
*/
class minutes : public time_duration
{
public:
explicit minutes(long m) :
time_duration(0,static_cast<min_type>(m),0)
{}
};
//! Allows expression of durations as a seconds count
/*! \ingroup time_basics
*/
class seconds : public time_duration
{
public:
explicit seconds(long s) :
time_duration(0,0,static_cast<sec_type>(s))
{}
};
//! Allows expression of durations as milli seconds
/*! \ingroup time_basics
*/
typedef date_time::subsecond_duration<time_duration,1000> millisec;
typedef date_time::subsecond_duration<time_duration,1000> milliseconds;
//! Allows expression of durations as micro seconds
/*! \ingroup time_basics
*/
typedef date_time::subsecond_duration<time_duration,1000000> microsec;
typedef date_time::subsecond_duration<time_duration,1000000> microseconds;
//This is probably not needed anymore...
#if defined(BOOST_DATE_TIME_HAS_NANOSECONDS)
//! Allows expression of durations as nano seconds
/*! \ingroup time_basics
*/
typedef date_time::subsecond_duration<time_duration,1000000000> nanosec;
typedef date_time::subsecond_duration<time_duration,1000000000> nanoseconds;
#endif
} }//namespace posix_time
#endif