update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -8,9 +8,11 @@
#include <iterator>
#include <tuple>
#include <boost/assert.hpp>
#include <boost/multiprecision/detail/number_base.hpp>
#include <limits>
#include <boost/math/tools/assert.hpp>
#include <boost/math/tools/header_deprecated.hpp>
BOOST_MATH_HEADER_DEPRECATED("<boost/math/statistics/bivariate_statistics.hpp>");
namespace boost{ namespace math{ namespace tools {
@@ -19,8 +21,8 @@ auto means_and_covariance(Container const & u, Container const & v)
{
using Real = typename Container::value_type;
using std::size;
BOOST_ASSERT_MSG(size(u) == size(v), "The size of each vector must be the same to compute covariance.");
BOOST_ASSERT_MSG(size(u) > 0, "Computing covariance requires at least one sample.");
BOOST_MATH_ASSERT_MSG(size(u) == size(v), "The size of each vector must be the same to compute covariance.");
BOOST_MATH_ASSERT_MSG(size(u) > 0, "Computing covariance requires at least one sample.");
// See Equation III.9 of "Numerically Stable, Single-Pass, Parallel Statistics Algorithms", Bennet et al.
Real cov = 0;
@@ -51,8 +53,8 @@ auto correlation_coefficient(Container const & u, Container const & v)
{
using Real = typename Container::value_type;
using std::size;
BOOST_ASSERT_MSG(size(u) == size(v), "The size of each vector must be the same to compute covariance.");
BOOST_ASSERT_MSG(size(u) > 0, "Computing covariance requires at least two samples.");
BOOST_MATH_ASSERT_MSG(size(u) == size(v), "The size of each vector must be the same to compute covariance.");
BOOST_MATH_ASSERT_MSG(size(u) > 0, "Computing covariance requires at least two samples.");
Real cov = 0;
Real mu_u = u[0];
@@ -71,15 +73,12 @@ auto correlation_coefficient(Container const & u, Container const & v)
mu_v = mu_v + v_tmp/(i+1);
}
// If both datasets are constant, then they are perfectly correlated.
if (Qu == 0 && Qv == 0)
{
return Real(1);
}
// If one dataset is constant and the other isn't, then they have no correlation:
// If one dataset is constant, then they have no correlation:
// See https://stats.stackexchange.com/questions/23676/normalized-correlation-with-a-constant-vector
// Thanks to zbjornson for pointing this out.
if (Qu == 0 || Qv == 0)
{
return Real(0);
return std::numeric_limits<Real>::quiet_NaN();
}
// Make sure rho in [-1, 1], even in the presence of numerical noise.