Skip to content

Commit c56f334

Browse files
committed
Merge branch 'develop'
2 parents 310fc00 + cf6cd75 commit c56f334

14 files changed

Lines changed: 236 additions & 67 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ jobs:
214214
run: config_info_travis
215215
working-directory: ../boost-root/libs/config/test
216216
- name: Test
217-
run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }}
217+
run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES debug-symbols=off ${{ matrix.suite }}
218218
working-directory: ../boost-root/libs/math/test
219219
windows_gcc:
220220
runs-on: windows-2019

include/boost/math/distributions/detail/common_error_handling.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ inline bool check_non_centrality(
185185
RealType* result,
186186
const Policy& pol)
187187
{
188-
if((ncp < 0) || !(boost::math::isfinite)(ncp))
189-
{ // Assume scale == 0 is NOT valid for any distribution.
188+
static const RealType upper_limit = static_cast<RealType>((std::numeric_limits<long long>::max)()) - boost::math::policies::get_max_root_iterations<Policy>();
189+
if((ncp < 0) || !(boost::math::isfinite)(ncp) || ncp > upper_limit)
190+
{
190191
*result = policies::raise_domain_error<RealType>(
191192
function,
192-
"Non centrality parameter is %1%, but must be > 0 !", ncp, pol);
193+
"Non centrality parameter is %1%, but must be > 0, and a countable value such that x+1 != x", ncp, pol);
193194
return false;
194195
}
195196
return true;

include/boost/math/distributions/non_central_beta.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ namespace boost
430430
static_cast<value_type>(p),
431431
&r,
432432
Policy()))
433-
return (RealType)r;
433+
return static_cast<RealType>(r);
434434
//
435435
// Special cases first:
436436
//
@@ -624,7 +624,7 @@ namespace boost
624624
static_cast<value_type>(x),
625625
&r,
626626
Policy()))
627-
return (RealType)r;
627+
return static_cast<RealType>(r);
628628

629629
if(l == 0)
630630
return pdf(boost::math::beta_distribution<RealType, Policy>(dist.alpha(), dist.beta()), x);
@@ -761,7 +761,7 @@ namespace boost
761761
l,
762762
&r,
763763
Policy()))
764-
return (RealType)r;
764+
return static_cast<RealType>(r);
765765
RealType c = a + b + l / 2;
766766
RealType mean = 1 - (b / c) * (1 + l / (2 * c * c));
767767
return detail::generic_find_mode_01(
@@ -872,7 +872,7 @@ namespace boost
872872
x,
873873
&r,
874874
Policy()))
875-
return (RealType)r;
875+
return static_cast<RealType>(r);
876876

877877
if(l == 0)
878878
return cdf(beta_distribution<RealType, Policy>(a, b), x);
@@ -909,7 +909,7 @@ namespace boost
909909
x,
910910
&r,
911911
Policy()))
912-
return (RealType)r;
912+
return static_cast<RealType>(r);
913913

914914
if(l == 0)
915915
return cdf(complement(beta_distribution<RealType, Policy>(a, b), x));

include/boost/math/distributions/non_central_chi_squared.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace boost
8888
// stable direction for the gamma function
8989
// recurrences:
9090
//
91-
int i;
91+
long long i;
9292
for(i = k; static_cast<std::uintmax_t>(i-k) < max_iter; ++i)
9393
{
9494
T term = poisf * gamf;
@@ -299,7 +299,7 @@ namespace boost
299299
if(pois == 0)
300300
return 0;
301301
T poisb = pois;
302-
for(int i = k; ; ++i)
302+
for(long long i = k; ; ++i)
303303
{
304304
sum += pois;
305305
if(pois / sum < errtol)
@@ -310,7 +310,7 @@ namespace boost
310310
"Series did not converge, closest value was %1%", sum, pol);
311311
pois *= l2 * x2 / ((i + 1) * (n2 + i));
312312
}
313-
for(int i = k - 1; i >= 0; --i)
313+
for(long long i = k - 1; i >= 0; --i)
314314
{
315315
poisb *= (i + 1) * (n2 + i) / (l2 * x2);
316316
sum += poisb;
@@ -428,7 +428,7 @@ namespace boost
428428
static_cast<value_type>(p),
429429
&r,
430430
Policy()))
431-
return (RealType)r;
431+
return static_cast<RealType>(r);
432432
//
433433
// Special cases get short-circuited first:
434434
//
@@ -519,7 +519,7 @@ namespace boost
519519
(value_type)x,
520520
&r,
521521
Policy()))
522-
return (RealType)r;
522+
return static_cast<RealType>(r);
523523

524524
if(l == 0)
525525
return pdf(boost::math::chi_squared_distribution<RealType, forwarding_policy>(dist.degrees_of_freedom()), x);
@@ -821,7 +821,7 @@ namespace boost
821821
l,
822822
&r,
823823
Policy()))
824-
return r;
824+
return static_cast<RealType>(r);
825825
return k + l;
826826
} // mean
827827

@@ -842,7 +842,7 @@ namespace boost
842842
l,
843843
&r,
844844
Policy()))
845-
return (RealType)r;
845+
return static_cast<RealType>(r);
846846
bool asymptotic_mode = k < l/4;
847847
RealType starting_point = asymptotic_mode ? k + l - RealType(3) : RealType(1) + k;
848848
return detail::generic_find_mode(dist, starting_point, function);
@@ -864,7 +864,7 @@ namespace boost
864864
l,
865865
&r,
866866
Policy()))
867-
return r;
867+
return static_cast<RealType>(r);
868868
return 2 * (2 * l + k);
869869
}
870870

@@ -887,7 +887,7 @@ namespace boost
887887
l,
888888
&r,
889889
Policy()))
890-
return r;
890+
return static_cast<RealType>(r);
891891
BOOST_MATH_STD_USING
892892
return pow(2 / (k + 2 * l), RealType(3)/2) * (k + 3 * l);
893893
}
@@ -908,7 +908,7 @@ namespace boost
908908
l,
909909
&r,
910910
Policy()))
911-
return r;
911+
return static_cast<RealType>(r);
912912
return 12 * (k + 4 * l) / ((k + 2 * l) * (k + 2 * l));
913913
} // kurtosis_excess
914914

@@ -946,7 +946,7 @@ namespace boost
946946
x,
947947
&r,
948948
Policy()))
949-
return r;
949+
return static_cast<RealType>(r);
950950

951951
return detail::non_central_chi_squared_cdf(x, k, l, false, Policy());
952952
} // cdf
@@ -975,7 +975,7 @@ namespace boost
975975
x,
976976
&r,
977977
Policy()))
978-
return r;
978+
return static_cast<RealType>(r);
979979

980980
return detail::non_central_chi_squared_cdf(x, k, l, true, Policy());
981981
} // ccdf

include/boost/math/distributions/non_central_f.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace boost
106106
l,
107107
&r,
108108
Policy()))
109-
return r;
109+
return r;
110110
if(v2 <= 2)
111111
return policies::raise_domain_error(
112112
function,
@@ -137,7 +137,7 @@ namespace boost
137137
l,
138138
&r,
139139
Policy()))
140-
return r;
140+
return r;
141141
RealType guess = m > 2 ? RealType(m * (n + l) / (n * (m - 2))) : RealType(1);
142142
return detail::generic_find_mode(
143143
dist,
@@ -166,7 +166,7 @@ namespace boost
166166
l,
167167
&r,
168168
Policy()))
169-
return r;
169+
return r;
170170
if(m <= 4)
171171
return policies::raise_domain_error(
172172
function,
@@ -203,7 +203,7 @@ namespace boost
203203
l,
204204
&r,
205205
Policy()))
206-
return r;
206+
return r;
207207
if(m <= 6)
208208
return policies::raise_domain_error(
209209
function,
@@ -240,7 +240,7 @@ namespace boost
240240
l,
241241
&r,
242242
Policy()))
243-
return r;
243+
return r;
244244
if(m <= 8)
245245
return policies::raise_domain_error(
246246
function,
@@ -309,7 +309,7 @@ namespace boost
309309
dist.non_centrality(),
310310
&r,
311311
Policy()))
312-
return r;
312+
return r;
313313

314314
if((x < 0) || !(boost::math::isfinite)(x))
315315
{
@@ -350,7 +350,7 @@ namespace boost
350350
c.dist.non_centrality(),
351351
&r,
352352
Policy()))
353-
return r;
353+
return r;
354354

355355
if((c.param < 0) || !(boost::math::isfinite)(c.param))
356356
{

0 commit comments

Comments
 (0)