← 返回首页
[CI SKIP] changes to get inspect program problem-free, but one test f… · boostorg/math@0ab00c3 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit 0ab00c3

Browse files
committed
[CI SKIP] changes to get inspect program problem-free, but one test failure in recurrence.cpp
1 parent c20af16 commit 0ab00c3

67 files changed

Lines changed: 531 additions & 382 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎doc/graphs/plot_1d_errors.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright John Maddock 2018.
2+
// Use, modification and distribution are subject to the
3+
// Boost Software License, Version 1.0. (See accompanying file
4+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
15

26
#include <map>
37
#include <boost/config.hpp>

‎doc/math.css‎

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1616
1717
Visual Studio is recommended for editing this file
1818
because it checks syntax, does layout and provides help on options.
19+
20+
boost-no-inspect
1921
2022
/*=============================================================================
2123
Program listings
@@ -34,22 +36,15 @@ Program listings
3436
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
3537
}
3638

37-
.programlisting,
38-
.screen {
39-
font-size: 10pt;
40-
display: block;
41-
/* was margin: 1pc 4% 0pc 4%;
42-
but that led to overflow on some code lines, so reduced and lined up with blockquote indent (see below). */
43-
margin: 1pc 2% 0pc 2%;
44-
/* https://www.w3schools.com/Css/css_margin.asp margin-top margin-right margin-bottom margin-left.
45-
* auto - the browser calculates the margin
46-
* length - specifies a margin in px, pt, cm, etc.
47-
* % - specifies a margin in % of the width of the containing element
48-
* inherit - specifies that the margin should be inherited from the parent element
49-
50-
*/
51-
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
52-
}
39+
.programlisting,
40+
.screen
41+
{
42+
font-size: 10pt;
43+
display: block;
44+
/* was margin: 1pc 4% 0pc 4%; */
45+
margin: 1pc 2% 0pc 2%;
46+
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
47+
}
5348
@media screen
5449
{
5550
/* Syntax Highlighting */
@@ -146,7 +141,6 @@ span.gray { color: #808080; } /* light gray */
146141
and a little bigger (* 125%) because the serif font appears smaller than the default sans serif fonts.
147142
Used, for example: [role serif_italic This is in serif font and italic].
148143
Used in turn by template for inline expressions to match equations as SVG or PNG images.
149-
150144
*/
151145
span.serif_italic {
152146
font-family: serif;
@@ -155,7 +149,7 @@ span.serif_italic {
155149
font-stretch: expanded;
156150
}
157151

158-
/* Custom indent of paragraphs to make equations look nicer, 2% to match that indent of code block above.
152+
/* Custom indent of paragraphs to make equations look nicer.
159153
https://www.w3schools.com/tags/tag_blockquote.asp says
160154
"Most browsers will display the <blockquote> element with left and right margin 40px values: "
161155
*/

‎dot_net_example/boost_math/boost_math.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error""
1717
// so command line shows:
1818
// /D "BOOST_MATH_ASSERT_UNDEFINED_POLICY=0"
19-
// /D "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error""
19+
// /D "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error""
2020

2121
#include "stdafx.h"
2222

@@ -92,7 +92,7 @@ any_distribution::any_distribution(int t, double arg1, double arg2, double arg3)
9292
break;
9393
case 17:
9494
this->reset(new concrete_distribution<boost::math::negative_binomial_distribution<> >(boost::math::negative_binomial_distribution<>(arg1, arg2)));
95-
break;
95+
break;
9696
case 18:
9797
this->reset(new concrete_distribution<boost::math::non_central_beta_distribution<> >(boost::math::non_central_beta_distribution<>(arg1, arg2, arg3)));
9898
break;
@@ -133,10 +133,10 @@ any_distribution::any_distribution(int t, double arg1, double arg2, double arg3)
133133
this->reset(new concrete_distribution<boost::math::weibull>(boost::math::weibull(arg1, arg2)));
134134
break;
135135

136-
136+
137137
default:
138138
// TODO Need some proper error handling here?
139-
assert(0);
139+
BOOST_ASSERT(0);
140140
}
141141
TRANSLATE_EXCEPTIONS_END
142142
} // any_distribution constructor.
@@ -156,8 +156,8 @@ struct distribution_info
156156
double third_default; // 0 if there isn't a third argument.
157157
};
158158

159-
distribution_info distributions[] =
160-
{ // distribution name, parameter name(s) and default(s)
159+
distribution_info distributions[] =
160+
{ // distribution name, parameter name(s) and default(s)
161161
// Order must match any_distribution constructor above!
162162
// Null string "" and zero default for un-used arguments.
163163
{ "Bernoulli", "Probability", "", "",0.5, 0, 0}, // case 0

‎example/arcsine_example.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <iostream>
2020
#include <exception>
21+
#include <boost/assert.hpp>
2122

2223
int main()
2324
{
@@ -62,8 +63,8 @@ int main()
6263
using boost::math::arcsine_distribution;
6364

6465
arcsine_distribution<> as(2, 5); // Cconstructs a double arcsine distribution.
65-
assert(as.x_min() == 2.); // as.x_min() returns 2.
66-
assert(as.x_max() == 5.); // as.x_max() returns 5.
66+
BOOST_ASSERT(as.x_min() == 2.); // as.x_min() returns 2.
67+
BOOST_ASSERT(as.x_max() == 5.); // as.x_max() returns 5.
6768
//] [/arcsine_snip_8]
6869
}
6970
return 0;

‎example/big_seventh.cpp‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// Use, modification and distribution are subject to the
32
// Boost Software License, Version 1.0.
43
// (See accompanying file LICENSE_1_0.txt
@@ -52,16 +51,16 @@ int main()
5251
/*`Using `typedef cpp_dec_float_50` hides the complexity of multiprecision,
5352
allows us to define variables with 50 decimal digit precision just like built-in `double`.
5453
*/
55-
using boost::multiprecision::cpp_dec_float_50;
54+
using boost::multiprecision::cpp_dec_float_50;
5655

57-
cpp_dec_float_50 seventh = cpp_dec_float_50(1) / 7; // 1 / 7
56+
cpp_dec_float_50 seventh = cpp_dec_float_50(1) / 7; // 1 / 7
5857

5958
/*`By default, output would only show the standard 6 decimal digits,
6059
so set precision to show all 50 significant digits, including any trailing zeros.
6160
*/
62-
std::cout.precision(std::numeric_limits<cpp_dec_float_50>::digits10);
63-
std::cout << std::showpoint << std::endl; // Append any trailing zeros.
64-
std::cout << seventh << std::endl;
61+
std::cout.precision(std::numeric_limits<cpp_dec_float_50>::digits10);
62+
std::cout << std::showpoint << std::endl; // Append any trailing zeros.
63+
std::cout << seventh << std::endl;
6564
/*`which outputs:
6665
6766
0.14285714285714285714285714285714285714285714285714

‎example/binomial_coinflip_example.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ Finally, print two tables of probability for the /exactly/ and /at least/ a numb
160160
/*`
161161
The last (0 to 10 heads) must, of course, be 100% probability.
162162
*/
163-
double probability = 0.3;
164-
double q = quantile(flip, probability);
165-
std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.3) = 3
166-
probability = 0.6;
167-
q = quantile(flip, probability);
168-
std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.6) = 5
163+
double probability = 0.3;
164+
double q = quantile(flip, probability);
165+
std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.3) = 3
166+
probability = 0.6;
167+
q = quantile(flip, probability);
168+
std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.6) = 5
169169
}
170170
catch(const std::exception& e)
171171
{

‎example/brent_minimise_example.cpp‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ using std::numeric_limits;
5858

5959
// http://en.wikipedia.org/wiki/Brent%27s_method Brent's method
6060

61-
// An example of a function for which we want to find a minimum.
61+
// An example of a function for which we want to find a minimum.
6262
double f(double x)
6363
{
6464
return (x + 3) * (x - 1) * (x - 1);
@@ -68,7 +68,7 @@ double f(double x)
6868
struct funcdouble
6969
{
7070
double operator()(double const& x)
71-
{
71+
{
7272
return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2
7373
}
7474
};
@@ -79,7 +79,7 @@ struct func
7979
{
8080
template <class T>
8181
T operator()(T const& x)
82-
{
82+
{
8383
return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2
8484
}
8585
};
@@ -96,7 +96,7 @@ is_close_to(FPT left, FPT right, FPT tolerance)
9696
//[brent_minimise_close
9797

9898
//! Compare if value got is close to expected,
99-
//! checking first if expected is very small
99+
//! checking first if expected is very small
100100
//! (to avoid divide by tiny or zero during comparison)
101101
//! before comparing expect with value got.
102102

@@ -136,7 +136,7 @@ void show_minima()
136136
std::cout << "\n\nFor type: " << typeid(T).name()
137137
<< ",\n epsilon = " << std::numeric_limits<T>::epsilon()
138138
// << ", precision of " << bits << " bits"
139-
<< ",\n the maximum theoretical precision from Brent's minimization is "
139+
<< ",\n the maximum theoretical precision from Brent's minimization is "
140140
<< sqrt(std::numeric_limits<T>::epsilon())
141141
<< "\n Displaying to std::numeric_limits<T>::digits10 " << prec << ", significant decimal digits."
142142
<< std::endl;
@@ -165,7 +165,7 @@ void show_minima()
165165
}
166166
// Check that result is that expected (compared to theoretical uncertainty).
167167
T uncertainty = sqrt(std::numeric_limits<T>::epsilon());
168-
std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is "
168+
std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is "
169169
<< is_close(static_cast<T>(1), r.first, uncertainty) << std::endl;
170170
std::cout << std::boolalpha << "f(x) == (0 compared to uncertainty " << uncertainty << ") is "
171171
<< is_close(static_cast<T>(0), r.second, uncertainty) << std::endl;
@@ -194,7 +194,7 @@ int main()
194194

195195
// Tip - using
196196
// std::cout.precision(std::numeric_limits<T>::digits10);
197-
// during debugging is wise because it warns
197+
// during debugging is wise because it warns
198198
// if construction of multiprecision involves conversion from double
199199
// by finding random or zero digits after 17th decimal digit.
200200

@@ -224,9 +224,9 @@ int main()
224224
using boost::math::fpc::is_small;
225225

226226
std::cout << "x = " << r.first << ", f(x) = " << r.second << std::endl;
227-
std::cout << std::boolalpha << "x == 1 (compared to uncertainty "
227+
std::cout << std::boolalpha << "x == 1 (compared to uncertainty "
228228
<< uncertainty << ") is " << is_close(1., r.first, uncertainty) << std::endl; // true
229-
std::cout << std::boolalpha << "f(x) == 0 (compared to uncertainty "
229+
std::cout << std::boolalpha << "f(x) == 0 (compared to uncertainty "
230230
<< uncertainty << ") is " << is_close(0., r.second, uncertainty) << std::endl; // true
231231
//] [/brent_minimise_double_1a]
232232

@@ -248,11 +248,11 @@ int main()
248248
std::streamsize prec = static_cast<int>(2 + sqrt((double)bits)); // Number of significant decimal digits.
249249
std::streamsize precision_3 = std::cout.precision(prec); // Save and set new precision.
250250
std::cout << "Showing " << bits << " bits "
251-
"precision with " << prec
251+
"precision with " << prec
252252
<< " decimal digits from tolerance " << sqrt(std::numeric_limits<double>::epsilon())
253253
<< std::endl;
254254

255-
std::cout << "x at minimum = " << r.first
255+
std::cout << "x at minimum = " << r.first
256256
<< ", f(" << r.first << ") = " << r.second
257257
<< " after " << it << " iterations. " << std::endl;
258258
std::cout.precision(precision_3); // Restore.
@@ -362,7 +362,7 @@ int main()
362362
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<50>,
363363
boost::multiprecision::et_off>
364364
cpp_bin_float_50_et_off;
365-
365+
366366
typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<50>,
367367
boost::multiprecision::et_on> // et_on is default so is same as cpp_dec_float_50.
368368
cpp_dec_float_50_et_on;
@@ -382,7 +382,7 @@ int main()
382382
std::cout << "Bracketing " << bracket_min << " to " << bracket_max << std::endl;
383383
const boost::uintmax_t maxit = 20;
384384
boost::uintmax_t it = maxit; // Will be updated with actual iteration count.
385-
std::pair<cpp_bin_float_50, cpp_bin_float_50> r
385+
std::pair<cpp_bin_float_50, cpp_bin_float_50> r
386386
= brent_find_minima(func(), bracket_min, bracket_max, bits, it);
387387

388388
std::cout << "x at minimum = " << r.first << ",\n f(" << r.first << ") = " << r.second
@@ -406,7 +406,7 @@ x == 1 (compared to uncertainty 7.311312755e-26) is true
406406
f(x) == (0 compared to uncertainty 7.311312755e-26) is true
407407
-4 1.3333333333333333333333333333333333333333333333333
408408
x at minimum = 0.99999999999999999999999999998813903221565569205253,
409-
f(0.99999999999999999999999999998813903221565569205253) =
409+
f(0.99999999999999999999999999998813903221565569205253) =
410410
5.6273022712501408640665300316078046703496236636624e-58
411411
14 iterations
412412
//] [/brent_minimise_mp_output_1]
@@ -556,21 +556,21 @@ f(x) == 0 (compared to uncertainty 1.49012e-08) is true
556556
557557
Type double with limited iterations.
558558
Precision bits = 53
559-
x at minimum = 1.00000, f(1.00000) = 5.04853e-18 after 10 iterations.
559+
x at minimum = 1.00000, f(1.00000) = 5.04853e-18 after 10 iterations.
560560
Showing 53 bits precision with 9 decimal digits from tolerance 1.49011612e-08
561-
x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-18 after 10 iterations.
561+
x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-18 after 10 iterations.
562562
563563
Type double with limited iterations and half double bits.
564564
Showing 26 bits precision with 7 decimal digits from tolerance 0.000172633
565565
x at minimum = 1.000000, f(1.000000) = 5.048526e-18
566-
10 iterations.
566+
10 iterations.
567567
568568
Type double with limited iterations and quarter double bits.
569569
Showing 13 bits precision with 5 decimal digits from tolerance 0.0156250
570-
x at minimum = 0.99998, f(0.99998) = 2.0070e-09, after 7 iterations.
570+
x at minimum = 0.99998, f(0.99998) = 2.0070e-09, after 7 iterations.
571571
572572
Type long double with limited iterations and all long double bits.
573-
x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18, after 10 iterations.
573+
x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18, after 10 iterations.
574574
575575
576576
For type: float,
@@ -603,7 +603,7 @@ x == 1 (compared to uncertainty 1.490116e-08) is true
603603
f(x) == (0 compared to uncertainty 1.490116e-08) is true
604604
Bracketing -4.0000000000000000000000000000000000000000000000000 to 1.3333333333333333333333333333333333333333333333333
605605
x at minimum = 0.99999999999999999999999999998813903221565569205253,
606-
f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations.
606+
f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations.
607607
608608
609609
For type: class boost::multiprecision::number<class boost::multiprecision::backends::cpp_bin_float<50,10,void,int,0,0>,1>,
@@ -616,7 +616,7 @@ x == 1 (compared to uncertainty 7.3113127550e-26) is true
616616
f(x) == (0 compared to uncertainty 7.3113127550e-26) is true
617617
-4.0000000000000000000000000000000000000000000000000 1.3333333333333333333333333333333333333333333333333
618618
x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58
619-
14 iterations.
619+
14 iterations.
620620
621621
622622
For type: class boost::multiprecision::number<class boost::multiprecision::backends::cpp_bin_float<50,10,void,int,0,0>,1>,
@@ -727,4 +727,4 @@ met 84 bits precision, after 14 iterations.
727727
x == 1 (compared to uncertainty 7.3113127550e-26) is true
728728
f(x) == (0 compared to uncertainty 7.3113127550e-26) is true
729729
730-
*/
730+
*/

‎example/distribution_construction.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this:
116116
negative_binomial mydist11(5, 0.4); // Using provided typedef of type double, and int and double arguments.
117117
/*`
118118
This is probably the most common usage.
119-
Other combination are possible too:
119+
Other combination are possible too:
120120
*/
121121
negative_binomial mydist12(5., 0.4F); // Double and float arguments.
122122
negative_binomial mydist13(5, 1); // Both arguments integer.
@@ -177,7 +177,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this:
177177

178178
// Explicit long double precision:
179179
negative_binomial_distribution<long double> mydist7(8., 0.25);
180-
180+
181181
/*`
182182
And you can use your own template RealType,
183183
for example, `boost::math::cpp_bin_float_50` (an arbitrary 50 decimal digits precision type),
@@ -189,8 +189,8 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this:
189189
// `integer` arguments are promoted to your RealType exactly, but
190190
// `double` argument are converted to RealType,
191191
// most likely losing precision!
192-
193-
// So DON'T be tempted to write the 'obvious':
192+
193+
// So DON'T be tempted to write the 'obvious':
194194
negative_binomial_distribution<cpp_bin_float_50> mydist20(8, 0.23456789012345678901234567890);
195195
// to avoid truncation of second parameter to `0.2345678901234567` and loss of precision.
196196

@@ -199,7 +199,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this:
199199

200200
// Ensure that all potentially significant digits are shown.
201201
std::cout.precision(std::numeric_limits<cpp_bin_float_50>::digits10);
202-
//
202+
//
203203
cpp_bin_float_50 x("1.23456789012345678901234567890");
204204
std::cout << pdf(mydist8, x) << std::endl;
205205
/*` showing 0.00012630010495970320103876754721976419438231705359935

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.