|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80061 - in trunk: boost/math/distributions boost/math/special_functions libs/math/test
From: john_at_[hidden]
Date: 2012-08-16 11:27:41
Author: johnmaddock
Date: 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
New Revision: 80061
URL: http://svn.boost.org/trac/boost/changeset/80061
Log:
Fix bug in incomplete beta which causes an exception to be thrown in itrunc when one argument is very large.
Fix several similar issue in the non-central T which cause cancellation errors if we let the starting iteration be zero.
Remove dead code that results from above changes.
Minor fixes to table_type and test_next.cpp.
Added:
trunk/libs/math/test/nct_small_delta.ipp (contents, props changed)
Text files modified:
trunk/boost/math/distributions/non_central_beta.hpp | 11 ---
trunk/boost/math/distributions/non_central_t.hpp | 105 ++++++++++++---------------------------
trunk/boost/math/special_functions/beta.hpp | 2
trunk/libs/math/test/table_type.hpp | 13 ----
trunk/libs/math/test/test_nc_t.cpp | 17 +++++-
trunk/libs/math/test/test_next.cpp | 10 +++
6 files changed, 59 insertions(+), 99 deletions(-)
Modified: trunk/boost/math/distributions/non_central_beta.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_beta.hpp (original)
+++ trunk/boost/math/distributions/non_central_beta.hpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -51,17 +51,8 @@
int k = itrunc(l2);
if(k == 0)
k = 1;
- T pois;
- if(k == 0)
- {
// Starting Poisson weight:
- pois = exp(-l2);
- }
- else
- {
- // Starting Poisson weight:
- pois = gamma_p_derivative(T(k+1), l2, pol);
- }
+ T pois = gamma_p_derivative(T(k+1), l2, pol);
if(pois == 0)
return init_val;
// recurance term:
Modified: trunk/boost/math/distributions/non_central_t.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_t.hpp (original)
+++ trunk/boost/math/distributions/non_central_t.hpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -38,43 +38,26 @@
T d2 = delta * delta / 2;
//
// k is the starting point for iteration, and is the
- // maximum of the poisson weighting term:
+ // maximum of the poisson weighting term, we don't
+ // ever allow k == 0 as this can lead to catastrophic
+ // cancellation errors later (test case is v = 1621286869049072.3
+ // delta = 0.16212868690490723, x = 0.86987415482475994).
//
int k = itrunc(d2);
T pois;
- if(k < 15)
- {
- // Since we'll likely need 30-40 terms anyway, start from zero
- // since this simplifies the arithmetic, don't go too overboard though
- // as this is the *unstable* direction:
- k = 0;
- // Starting Poisson weight:
- pois = exp(-d2) * 2 / constants::root_pi<T>();
- pois *= delta / constants::root_two<T>();
- }
- else
- {
- // Starting Poisson weight:
- pois = gamma_p_derivative(T(k+1), d2, pol)
- * tgamma_delta_ratio(T(k + 1), T(0.5f))
- * delta / constants::root_two<T>();
- }
+ if(k == 0) k = 1;
+ // Starting Poisson weight:
+ pois = gamma_p_derivative(T(k+1), d2, pol)
+ * tgamma_delta_ratio(T(k + 1), T(0.5f))
+ * delta / constants::root_two<T>();
if(pois == 0)
return init_val;
T xterm, beta;
// Recurrance & starting beta terms:
- if(k == 0)
- {
- beta = -boost::math::powm1(y, n / 2, pol);
- xterm = beta > 0.5f ? T(pow(y, n / 2)) : T(1 - beta);
- }
- else
- {
- beta = x < y
- ? detail::ibeta_imp(T(k + 1), T(n / 2), x, pol, false, true, &xterm)
- : detail::ibeta_imp(T(n / 2), T(k + 1), y, pol, true, true, &xterm);
- xterm *= y / (n / 2 + k);
- }
+ beta = x < y
+ ? detail::ibeta_imp(T(k + 1), T(n / 2), x, pol, false, true, &xterm)
+ : detail::ibeta_imp(T(n / 2), T(k + 1), y, pol, true, true, &xterm);
+ xterm *= y / (n / 2 + k);
T poisf(pois), betaf(beta), xtermf(xterm);
T sum = init_val;
if((xterm == 0) && (beta == 0))
@@ -89,7 +72,8 @@
{
T term = beta * pois;
sum += term;
- if(fabs(term/sum) < errtol)
+ // Don't terminate on first term in case we "fixed" k above:
+ if((i != k) && fabs(term/sum) < errtol)
break;
pois *= (i + 0.5f) / d2;
beta += xterm;
@@ -128,23 +112,16 @@
T d2 = delta * delta / 2;
//
// k is the starting point for iteration, and is the
- // maximum of the poisson weighting term:
+ // maximum of the poisson weighting term, we don't allow
+ // k == 0 as this can cause catastrophic cancellation errors
+ // (test case is v = 561908036470413.25, delta = 0.056190803647041321,
+ // x = 1.6155232703966216):
//
int k = itrunc(d2);
- if(k < 30)
- {
- // We typically need around 40 terms so may as well start at 0
- // and gain faster computation of starting conditions:
- k = 0;
- }
+ if(k == 0) k = 1;
// Starting Poisson weight:
T pois;
- if(k == 0)
- {
- pois = exp(-d2) * 2 / constants::root_pi<T>();
- pois *= delta / constants::root_two<T>();
- }
- else if((k < (int)(max_factorial<T>::value)) && (d2 < tools::log_max_value<T>()) && (log(d2) * k < tools::log_max_value<T>()))
+ if((k < (int)(max_factorial<T>::value)) && (d2 < tools::log_max_value<T>()) && (log(d2) * k < tools::log_max_value<T>()))
{
//
// For small k we can optimise this calculation by using
@@ -205,7 +182,8 @@
}
sum += term;
- if(fabs(term/sum) < errtol)
+ // Don't terminate on first term in case we "fixed" the value of k above:
+ if((j != k) && fabs(term/sum) < errtol)
break;
if(count > max_iter)
{
@@ -370,31 +348,16 @@
//
int k = itrunc(d2);
T pois, xterm;
- if(k < 30)
- {
- //
- // Since we'll need at least 30-40 terms anyway, start from 0
- // since this simplifies the starting arithmetic:
- //
- k = 0;
- // Starting Poisson weight:
- pois = exp(-d2)
- * (2 / constants::root_pi<T>())
- * delta / constants::root_two<T>();
- // Starting beta term:
- xterm = pow(y, n / 2 - 1) * n / 2;
- }
- else
- {
- // Starting Poisson weight:
- pois = gamma_p_derivative(T(k+1), d2, pol)
- * tgamma_delta_ratio(T(k + 1), T(0.5f))
- * delta / constants::root_two<T>();
- // Starting beta term:
- xterm = x < y
- ? ibeta_derivative(T(k + 1), n / 2, x, pol)
- : ibeta_derivative(n / 2, T(k + 1), y, pol);
- }
+ if(k == 0)
+ k = 1;
+ // Starting Poisson weight:
+ pois = gamma_p_derivative(T(k+1), d2, pol)
+ * tgamma_delta_ratio(T(k + 1), T(0.5f))
+ * delta / constants::root_two<T>();
+ // Starting beta term:
+ xterm = x < y
+ ? ibeta_derivative(T(k + 1), n / 2, x, pol)
+ : ibeta_derivative(n / 2, T(k + 1), y, pol);
T poisf(pois), xtermf(xterm);
T sum = init_val;
if((pois == 0) || (xterm == 0))
@@ -409,7 +372,7 @@
{
T term = xterm * pois;
sum += term;
- if((fabs(term/sum) < errtol) || (term == 0))
+ if(((fabs(term/sum) < errtol) && (i != k)) || (term == 0))
break;
pois *= (i + 0.5f) / d2;
xterm *= (i) / (x * (n / 2 + i));
Modified: trunk/boost/math/special_functions/beta.hpp
==============================================================================
--- trunk/boost/math/special_functions/beta.hpp (original)
+++ trunk/boost/math/special_functions/beta.hpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -1115,7 +1115,7 @@
if(b < 40)
{
- if((floor(a) == a) && (floor(b) == b))
+ if((floor(a) == a) && (floor(b) == b) && (a < (std::numeric_limits<int>::max)() - 100))
{
// relate to the binomial distribution and use a finite sum:
T k = a - 1;
Added: trunk/libs/math/test/nct_small_delta.ipp
==============================================================================
--- (empty file)
+++ trunk/libs/math/test/nct_small_delta.ipp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,59 @@
+#ifndef SC_
+# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#endif
+ static const boost::array<boost::array<T, 5>, 52> nct_small_delta = {{
+ { SC_(528154.0625), SC_(0.5281540482737767661092220805585384368896484375e-10), SC_(-0.0438658893108367919921875), SC_(0.48250566102131993419090032097993141749629366237354), SC_(0.51749433897868006580909967902006858250370633762646) },
+ { SC_(528154.0625), SC_(0.5281540482737767661092220805585384368896484375e-10), SC_(0.944180071353912353515625), SC_(0.82746096542548677580028882735723708488758715357832), SC_(0.17253903457451322419971117264276291511241284642168) },
+ { SC_(660934.625), SC_(0.6609346403507743161753751337528228759765625e-10), SC_(-1.09356248378753662109375), SC_(0.13707365461620354384117941652933126383612908392123), SC_(0.86292634538379645615882058347066873616387091607877) },
+ { SC_(660934.625), SC_(0.6609346403507743161753751337528228759765625e-10), SC_(0.8943269252777099609375), SC_(0.81442633822735887388224244171117444649106453395369), SC_(0.18557366177264112611775755828882555350893546604631) },
+ { SC_(2218633.5), SC_(0.221863361016261251279502175748348236083984375e-9), SC_(0.900856673717498779296875), SC_(0.81616768606164643627773468420573729773227964864232), SC_(0.18383231393835356372226531579426270226772035135768) },
+ { SC_(2218633.5), SC_(0.221863361016261251279502175748348236083984375e-9), SC_(1.2173912525177001953125), SC_(0.88827224039054756935944165341219624193195834170515), SC_(0.11172775960945243064055834658780375806804165829485) },
+ { SC_(4272462.5), SC_(0.427246238388079291325993835926055908203125e-9), SC_(-0.608891189098358154296875), SC_(0.27129829842994003638790396047987351547260466368909), SC_(0.72870170157005996361209603952012648452739533631091) },
+ { SC_(4272462.5), SC_(0.427246238388079291325993835926055908203125e-9), SC_(1.00504648685455322265625), SC_(0.84256273846140526398141847027259437264491990536997), SC_(0.15743726153859473601858152972740562735508009463003) },
+ { SC_(5247940), SC_(0.524793986045324345468543469905853271484375e-9), SC_(-1.11901676654815673828125), SC_(0.13156651861218774164823859585016794860626893918254), SC_(0.86843348138781225835176140414983205139373106081746) },
+ { SC_(5247940), SC_(0.524793986045324345468543469905853271484375e-9), SC_(-1.0743181705474853515625), SC_(0.14134007648961033259203628094925336577210835950473), SC_(0.85865992351038966740796371905074663422789164049527) },
+ { SC_(18336510), SC_(0.1833651008809056293102912604808807373046875e-8), SC_(-1.48560678958892822265625), SC_(0.068691587407182335464773960988799828434588100829723), SC_(0.93130841259281766453522603901120017156541189917028) },
+ { SC_(18336510), SC_(0.1833651008809056293102912604808807373046875e-8), SC_(1.40664613246917724609375), SC_(0.92023381810537925932116820364336353453322062034513), SC_(0.079766181894620740678831796356636465466779379654875) },
+ { SC_(35639400), SC_(0.3563940254025510512292385101318359375e-8), SC_(-0.2346564829349517822265625), SC_(0.40723768241459441841438282814230236027330099372549), SC_(0.59276231758540558158561717185769763972669900627451) },
+ { SC_(35639400), SC_(0.3563940254025510512292385101318359375e-8), SC_(1.24018728733062744140625), SC_(0.89254693057186762829174224773340895165093032749745), SC_(0.10745306942813237170825775226659104834906967250255) },
+ { SC_(45487064), SC_(0.4548706300511184963397681713104248046875e-8), SC_(-1.162539005279541015625), SC_(0.12250829730838957792258003981798522875055846989729), SC_(0.87749170269161042207741996018201477124944153010271) },
+ { SC_(45487064), SC_(0.4548706300511184963397681713104248046875e-8), SC_(-0.8368303775787353515625), SC_(0.20134396068806204684905953847272082011338589718573), SC_(0.79865603931193795315094046152727917988661410281427) },
+ { SC_(121620224), SC_(0.12162022500206148833967745304107666015625e-7), SC_(0.39718806743621826171875), SC_(0.6543856047457196617262494109772647455321658941725), SC_(0.3456143952542803382737505890227352544678341058275) },
+ { SC_(121620224), SC_(0.12162022500206148833967745304107666015625e-7), SC_(1.24731695652008056640625), SC_(0.89385934536068351965787494087690986211211985166153), SC_(0.10614065463931648034212505912309013788788014833847) },
+ { SC_(194932064), SC_(0.1949320704852652852423489093780517578125e-7), SC_(-0.575359284877777099609375), SC_(0.28252416082756836234341731346566281326700494104297), SC_(0.71747583917243163765658268653433718673299505895703) },
+ { SC_(194932064), SC_(0.1949320704852652852423489093780517578125e-7), SC_(0.4194296896457672119140625), SC_(0.66254892777524155315670363767975247199405361778407), SC_(0.33745107222475844684329636232024752800594638221593) },
+ { SC_(327092512), SC_(0.327092521956728887744247913360595703125e-7), SC_(-1.2071979045867919921875), SC_(0.11367796276232027931825008133662930047269775407393), SC_(0.88632203723767972068174991866337069952730224592607) },
+ { SC_(327092512), SC_(0.327092521956728887744247913360595703125e-7), SC_(0.876802742481231689453125), SC_(0.80970309616765211535813735932417404262765601883988), SC_(0.19029690383234788464186264067582595737234398116012) },
+ { SC_(922215104), SC_(0.922215122045599855482578277587890625e-7), SC_(0.141965448856353759765625), SC_(0.55644631504480191279462370740448518366492417190403), SC_(0.44355368495519808720537629259551481633507582809597) },
+ { SC_(922215104), SC_(0.922215122045599855482578277587890625e-7), SC_(1.13559567928314208984375), SC_(0.87193707155023294863968629343839663906062875149397), SC_(0.12806292844976705136031370656160336093937124850603) },
+ { SC_(1524088576), SC_(0.15240885886669275350868701934814453125e-6), SC_(-0.664114892482757568359375), SC_(0.25330834087624892647434930428222142994198568419577), SC_(0.74669165912375107352565069571777857005801431580423) },
+ { SC_(1524088576), SC_(0.15240885886669275350868701934814453125e-6), SC_(1.37886774539947509765625), SC_(0.91603220911482167517950113163803628076090836350073), SC_(0.083967790885178324820498868361963719239091636499269) },
+ { SC_(2833322752), SC_(0.2833322696460527367889881134033203125e-6), SC_(-0.934321820735931396484375), SC_(0.1750688828424918771805411797628815067286394341076), SC_(0.8249311171575081228194588202371184932713605658924) },
+ { SC_(2833322752), SC_(0.2833322696460527367889881134033203125e-6), SC_(0.01152040623128414154052734375), SC_(0.50459576244612621592734255378527979154430257136497), SC_(0.49540423755387378407265744621472020845569742863503) },
+ { SC_(7376104448), SC_(0.737610434953239746391773223876953125e-6), SC_(0.14150333404541015625), SC_(0.55626354548618560623653714942035371801766096231359), SC_(0.44373645451381439376346285057964628198233903768641) },
+ { SC_(7376104448), SC_(0.737610434953239746391773223876953125e-6), SC_(0.46808087825775146484375), SC_(0.68013635973699279491605645205785045329423814366365), SC_(0.31986364026300720508394354794214954670576185633635) },
+ { SC_(19005597696), SC_(0.190055970961111597716808319091796875e-5), SC_(0.89516448974609375), SC_(0.81464991000540683634213811269861642939018294670759), SC_(0.18535008999459316365786188730138357060981705329241) },
+ { SC_(19005597696), SC_(0.190055970961111597716808319091796875e-5), SC_(1.48002254962921142578125), SC_(0.93056613193114394805618686943760965268036694876176), SC_(0.069433868068856051943813130562390347319633051238245) },
+ { SC_(37336477696), SC_(0.37336476452765055000782012939453125e-5), SC_(-1.39093267917633056640625), SC_(0.08212235488316398659317034137786838544688552825868), SC_(0.91787764511683601340682965862213161455311447174132) },
+ { SC_(37336477696), SC_(0.37336476452765055000782012939453125e-5), SC_(1.37445271015167236328125), SC_(0.91534882988245816934090108875322008488528628081311), SC_(0.084651170117541830659098911246779915114713719186888) },
+ { SC_(76158959616), SC_(0.7615895810886286199092864990234375e-5), SC_(-0.4133583009243011474609375), SC_(0.33966927100300125337615080987310920514534610032036), SC_(0.66033072899699874662384919012689079485465389967964) },
+ { SC_(76158959616), SC_(0.7615895810886286199092864990234375e-5), SC_(1.4921436309814453125), SC_(0.93216825396603974510969367870165246570825488483101), SC_(0.067831746033960254890306321298347534291745115168994) },
+ { SC_(149909094400), SC_(0.149909101310186088085174560546875e-4), SC_(1.0512597560882568359375), SC_(0.85342690591562485295243723515889796180107709178638), SC_(0.14657309408437514704756276484110203819892290821362) },
+ { SC_(149909094400), SC_(0.149909101310186088085174560546875e-4), SC_(1.39853727817535400390625), SC_(0.91902185764013358458014118954726949359893649842036), SC_(0.080978142359866415419858810452730506401063501579643) },
+ { SC_(300246401024), SC_(0.300246392725966870784759521484375e-4), SC_(-0.858747541904449462890625), SC_(0.19523162330012228777050408978728209345121805498577), SC_(0.80476837669987771222949591021271790654878194501423) },
+ { SC_(300246401024), SC_(0.300246392725966870784759521484375e-4), SC_(1.40856420993804931640625), SC_(0.92051352414116507572847602921599610498310359056324), SC_(0.079486475858834924271523970784003895016896409436761) },
+ { SC_(353275379712), SC_(0.3532753908075392246246337890625e-4), SC_(-1.0212171077728271484375), SC_(0.15356742764115001237771940686359565408937029456416), SC_(0.84643257235884998762228059313640434591062970543584) },
+ { SC_(353275379712), SC_(0.3532753908075392246246337890625e-4), SC_(1.30792331695556640625), SC_(0.90454434807153994552344182822189877220821074884107), SC_(0.09545565192846005447655817177810122779178925115893) },
+ { SC_(0.105336832e13), SC_(0.0001053368323482573032379150390625), SC_(0.554341971874237060546875), SC_(0.71029154537084727662513596094978928595259300760913), SC_(0.28970845462915272337486403905021071404740699239087) },
+ { SC_(0.105336832e13), SC_(0.0001053368323482573032379150390625), SC_(0.68778026103973388671875), SC_(0.75417124280258349801796658501621988164110540869668), SC_(0.24582875719741650198203341498378011835889459130332) },
+ { SC_(2405508317184), SC_(0.0002405508421361446380615234375), SC_(0.5517151355743408203125), SC_(0.70934580778979545712784947970550407070754829519999), SC_(0.29065419221020454287215052029449592929245170480001) },
+ { SC_(2405508317184), SC_(0.0002405508421361446380615234375), SC_(1.42728817462921142578125), SC_(0.92321691603357102065464321251307839682832539201822), SC_(0.076783083966428979345356787486921603171674607981778) },
+ { SC_(4836693114880), SC_(0.000483669340610504150390625), SC_(-0.2817919254302978515625), SC_(0.38886609876734874792671065039736370377189209526496), SC_(0.61113390123265125207328934960263629622810790473504) },
+ { SC_(4836693114880), SC_(0.000483669340610504150390625), SC_(1.46532154083251953125), SC_(0.92851742167955783637755823728448115497442142134004), SC_(0.071482578320442163622441762715518845025578578659958) },
+ { SC_(9556477345792), SC_(0.000955647788941860198974609375), SC_(0.804133951663970947265625), SC_(0.78906415810449876562078794471829514693427758064696), SC_(0.21093584189550123437921205528170485306572241935304) },
+ { SC_(9556477345792), SC_(0.000955647788941860198974609375), SC_(1.4024145603179931640625), SC_(0.91946155703754481352479238346787859905335082869119), SC_(0.080538442962455186475207616532121400946649171308807) },
+ { SC_(10838489432064), SC_(0.00108384899795055389404296875), SC_(-1.13749277591705322265625), SC_(0.12743989126870304346542317478912987226157104995751), SC_(0.87256010873129695653457682521087012773842895004249) },
+ { SC_(10838489432064), SC_(0.00108384899795055389404296875), SC_(0.75486361980438232421875), SC_(0.77450926357298223779984584559741400272890293481015), SC_(0.22549073642701776220015415440258599727109706518985) }
+ }};
+//#undef SC_
+
Modified: trunk/libs/math/test/table_type.hpp
==============================================================================
--- trunk/libs/math/test/table_type.hpp (original)
+++ trunk/libs/math/test/table_type.hpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -26,17 +26,4 @@
typedef long double type;
};
-namespace boost{ namespace multiprecision{
-
- template <class Backend, bool ExpressionTemplates>
- class mp_number;
-
-}}
-
-template <class Backend, bool ExpressionTemplates>
-struct table_type<boost::multiprecision::mp_number<Backend, ExpressionTemplates> >
-{
- typedef const char* type;
-};
-
#endif
Modified: trunk/libs/math/test/test_nc_t.cpp
==============================================================================
--- trunk/libs/math/test/test_nc_t.cpp (original)
+++ trunk/libs/math/test/test_nc_t.cpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -443,8 +443,9 @@
try{
value_type m = mode(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]));
value_type p = pdf(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]), m);
- BOOST_CHECK_EX(pdf(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]), m * (1 + sqrt(precision) * 100)) <= p, i);
- BOOST_CHECK_EX(pdf(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]), m * (1 - sqrt(precision)) * 100) <= p, i);
+ value_type delta = (std::max)(fabs(m * sqrt(precision) * 50), sqrt(precision) * 50);
+ BOOST_CHECK_EX(pdf(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]), m + delta) <= p, i);
+ BOOST_CHECK_EX(pdf(boost::math::non_central_t_distribution<value_type>(data[i][0], data[i][1]), m - delta) <= p, i);
}
catch(const boost::math::evaluation_error& ) {}
#if 0
@@ -452,7 +453,7 @@
// Sanity check degrees-of-freedom finder, don't bother at float
// precision though as there's not enough data in the probability
// values to get back to the correct degrees of freedom or
- // non-cenrality parameter:
+ // non-centrality parameter:
//
try{
if((data[i][3] < 0.99) && (data[i][3] != 0))
@@ -489,6 +490,16 @@
#include "nct.ipp"
do_test_nc_t<T>(nct, type_name, "Non Central T");
quantile_sanity_check<T>(nct, type_name, "Non Central T");
+ if(std::numeric_limits<T>::is_specialized)
+ {
+ //
+ // Don't run these tests for real_concept: they take too long and don't converge
+ // without numeric_limits and lanczos support:
+ //
+#include "nct_small_delta.ipp"
+ do_test_nc_t<T>(nct_small_delta, type_name, "Non Central T (large parameters)");
+ quantile_sanity_check<T>(nct_small_delta, type_name, "Non Central T (large parameters)");
+ }
}
int test_main(int, char* [])
Modified: trunk/libs/math/test/test_next.cpp
==============================================================================
--- trunk/libs/math/test/test_next.cpp (original)
+++ trunk/libs/math/test/test_next.cpp 2012-08-16 11:27:40 EDT (Thu, 16 Aug 2012)
@@ -15,7 +15,7 @@
#endif
#if !defined(_CRAYC) && !defined(__CUDACC__) && (!defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3)))
-#if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__)
+#if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) || defined(TEST_SSE2)
#include <float.h>
#include "xmmintrin.h"
#define TEST_SSE2
@@ -157,6 +157,14 @@
test_values(boost::math::concepts::real_concept(0), "real_concept");
#endif
#if defined(TEST_SSE2)
+
+#ifdef _MSC_VER
+# pragma message("Compiling SSE2 test code")
+#endif
+#ifdef __GNUC__
+# pragma message "Compiling SSE2 test code"
+#endif
+
#ifdef _WIN32
// These tests fail pretty badly on Linux x64, especially with Intel-12.1
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk