Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Jun 24, 2022
2 parents 2b99278 + 7df6a28 commit 85e2a55
Show file tree
Hide file tree
Showing 69 changed files with 2,171 additions and 310 deletions.
21 changes: 14 additions & 7 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):

things_to_test = [ "special_fun", "distribution_tests", "mp", "misc", "interpolators", "quadrature", "autodiff", "long-running-tests", "float128_tests" ]
sanitizer_test = [ "special_fun", "distribution_tests", "misc", "interpolators", "quadrature", "autodiff", "float128_tests" ]
gnu_5_stds = [ "gnu++11" ]
gnu_6_stds = [ "gnu++11", "gnu++14" ]
gnu_8_stds = [ "gnu++11", "gnu++14", "gnu++17" ]
gnu_10_stds = [ "gnu++11", "gnu++14", "gnu++17", "gnu++20" ]
sanitizer_test = [ "special_fun", "distribution_tests", "misc", "interpolators", "quadrature", "float128_tests" ]
gnu_5_stds = [ "gnu++11", "c++11", "gnu++14", "c++14" ]
gnu_6_stds = [ "gnu++11", "c++11", "gnu++14", "c++14", "gnu++17", "c++17" ]
clang_6_stds = [ "c++11", "c++14", "c++17" ]
gnu_9_stds = [ "gnu++14", "c++14", "gnu++17", "c++17", "gnu++2a", "c++2a" ]
clang_10_stds = [ "c++14", "c++17", "c++2a" ]

result = []

Expand All @@ -38,12 +39,18 @@ def main(ctx):
result.append(linux_cxx("Ubunti g++-5 " + cxx + " " + suite, "g++-5", packages="g++-5", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
for cxx in gnu_6_stds:
result.append(linux_cxx("Ubunti g++-6 " + cxx + " " + suite, "g++-6", packages="g++-6", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
for cxx in gnu_8_stds:
result.append(linux_cxx("Ubunti g++-7 " + cxx + " " + suite, "g++-7", packages="g++-7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti g++-8 " + cxx + " " + suite, "g++-8", packages="g++-8", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-8', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti g++-9 " + cxx + " " + suite, "g++-9", packages="g++-9", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-9', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
for cxx in clang_6_stds:
result.append(linux_cxx("Ubunti clang++-6 " + cxx + " " + suite, "clang++-6.0", packages="clang-6.0", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti clang++-7 " + cxx + " " + suite, "clang++-7", packages="clang-7", llvm_os="xenial", llvm_ver="7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti clang++-8 " + cxx + " " + suite, "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti clang++-9 " + cxx + " " + suite, "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
for cxx in gnu_10_stds:
for cxx in gnu_9_stds:
result.append(linux_cxx("Ubunti g++-10 " + cxx + " " + suite, "g++-10", packages="g++-10", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
result.append(linux_cxx("Ubunti g++-11 " + cxx + " " + suite, "g++-11", packages="g++-11", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-11', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))
for cxx in clang_10_stds:
result.append(linux_cxx("Ubunti clang++-10 " + cxx + " " + suite, "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv))

return result
Expand Down
89 changes: 68 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ on:
release:
types: [published, created, edited]
jobs:
ubuntu-focal:
runs-on: ubuntu-20.04
ubuntu-jammy:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: [ g++-9, g++-11, clang++-10 ]
standard: [ c++11, c++14, c++17, c++2a ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, mp, interpolators, autodiff, ../example//examples, ../tools ]
compiler: [ g++-12, clang++-14 ]
standard: [ c++14, c++17, c++20 ]
suite: [ github_ci_block_1, github_ci_block_2 ]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -47,7 +47,7 @@ jobs:
if: steps.retry1.outcome=='failure'
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Install packages
run: sudo apt install g++-9 g++-11 clang-9 clang-10 libgmp-dev libmpfr-dev libfftw3-dev
run: sudo apt install g++-12 clang-14 libgmp-dev libmpfr-dev libfftw3-dev
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
Expand Down Expand Up @@ -75,16 +75,15 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 -j2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
ubuntu-bionic:
runs-on: ubuntu-18.04
ubuntu-focal-no-eh:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [ g++-6, clang++-6.0, g++-7, g++-8, clang++-7, clang++-8 ]
standard: [ c++11, c++14, c++17 ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, mp, interpolators, autodiff, ../example//examples, ../tools ]
compiler: [ g++-9, g++-11, clang++-10 ]
standard: [ c++11, c++14, c++17, c++2a ]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -111,7 +110,7 @@ jobs:
if: steps.retry1.outcome=='failure'
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Install packages
run: sudo apt install g++-6 g++-7 g++-8 clang-6.0 clang-7 clang-8 libgmp-dev libmpfr-dev libfftw3-dev
run: sudo apt install g++-9 g++-11 clang-9 clang-10 libgmp-dev libmpfr-dev libfftw3-dev
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
Expand Down Expand Up @@ -139,16 +138,16 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 toolset=$TOOLSET no_eh_tests exception-handling=off rtti=off define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
toolset: [ clang ]
standard: [ 11, 14, 17, 2a ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, mp, interpolators, autodiff, ../example//examples, ../tools ]
standard: [ 11, 14, 17, 20 ]
suite: [ github_ci_block_1, github_ci_block_2 ]
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -194,8 +193,56 @@ jobs:
strategy:
fail-fast: false
matrix:
toolset: [ gcc, msvc-14.0, msvc-14.2 ]
standard: [ 11, 14, 17 ]
toolset: [ msvc-14.0, msvc-14.2 ]
standard: [ 14, 17 ]
suite: [ github_ci_block_1, github_ci_block_2 ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX];[standalone];[STANDALONE];[cygwin];[CYGWIN]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\math
working-directory: ../boost-root
- name: Install deps
run: python tools/boostdep/depinst/depinst.py math
working-directory: ../boost-root
- name: Bootstrap
run: bootstrap
working-directory: ../boost-root
- name: Generate headers
run: b2 headers
working-directory: ../boost-root
- name: Config info install
run: ..\..\..\b2 config_info_travis_install %ARGS%
working-directory: ../boost-root/libs/config/test
- name: Config info
run: config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }}
working-directory: ../boost-root/libs/math/test
windows_gcc:
runs-on: windows-2019
defaults:
run:
shell: cmd
env:
ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }}
strategy:
fail-fast: false
matrix:
toolset: [ gcc ]
standard: [ 14, 17 ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, mp, interpolators, autodiff, ../example//examples, ../tools ]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -243,7 +290,7 @@ jobs:
fail-fast: false
matrix:
standard: [ 14, 17, 20 ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, mp, interpolators, autodiff, ../example//examples, ../tools ]
suite: [ github_ci_block_1, github_ci_block_2 ]
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -415,8 +462,8 @@ jobs:
fail-fast: false
matrix:
compiler: [ g++-10 ]
standard: [ c++11, c++14, c++17, c++2a ]
suite: [ float128_tests, special_fun, distribution_tests, misc, quadrature, interpolators, autodiff, ../example//examples, ../tools ]
standard: [ c++14, c++17, c++20 ]
suite: [ github_ci_block_1, github_ci_block_2 ]
steps:
- uses: actions/checkout@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Makefile
**CTestTestfile.cmake
DartConfiguration.tcl
cmake-build-debug/*
.cmake/*
build.ninja
.ninja*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Boost Math Library
[![Build Status](https://drone.cpp.al/api/badges/boostorg/math/status.svg)](https://drone.cpp.al/boostorg/math)[![Build Status](https://github.com/boostorg/math/workflows/CI/badge.svg?branch=develop)](https://github.com/boostorg/math/actions)
==================

>ANNOUNCEMENT: Support for C++03 is now deprecated in this library and will be supported in existing features
>only until March 2021. New features will require *at least* C++11, as will existing features from next year.
>ANNOUNCEMENT: Support for C++11 will be deprecated in this library starting in July 2023 (Boost 1.82).
>New features will require *at least* C++14, as will existing features starting with the deprecation release.
This library is divided into several interconnected parts:

Expand Down
7 changes: 7 additions & 0 deletions doc/sf/ccmath.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ All of the following functions require C++17 or greater.
template <typename T>
inline constexpr bool isunordered(T x, T y) noexcept

template <typename Real>
inline constexpr Real fma(Real x, Real y, Real z) noexcept
Requires compiling with fma flag

template <typename Arithmetic1, typename Arithmetic2, typename Arithmetic3>
inline constepxr Promoted fma(Arithmetic1 x, Arithmetic2 y, Arithmetic3 z) noexcept

} // Namespaces

[endsect] [/section:ccmath Constexpr CMath]
74 changes: 74 additions & 0 deletions doc/statistics/chatterjee_correlation.qbk
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[/
Copyright 2022 Matt Borland

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).
]

[section:chatterjee_correlation Chatterjee Correlation]

[heading Synopsis]

``
#include <boost/math/statistics/chatterjee_correlation.hpp>

namespace boost::math::statistics {

C++17:
template <typename ExecutionPolicy, typename Container>
auto chatterjee_correlation(ExecutionPolicy&& exec, const Container& u, const Container& v);

C++11:
template <typename Container>
auto chatterjee_correlation(const Container& u, const Container& v);
}
``

[heading Description]

The classical correlation coefficients like the Pearson's correlation are useful primarily for distinguishing when one dataset depends linearly on another.
However, Pearson's correlation coefficient has a known weakness in that when the dependent variable has an obvious functional relationship with the independent variable, the value of the correlation coefficient can take on any value.
As Chatterjee says:

> Ideally, one would like a coefficient that approaches
its maximum value if and only if one variable looks more and more like a
noiseless function of the other, just as Pearson correlation is close to its maximum value if and only if one variable is close to being a noiseless linear function of the other.

This is the problem Chatterjee's coefficient solves.
Let X and Y be random variables, where Y is not constant, and let (X_i, Y_i) be samples from this distribution.
Rearrange these samples so that X_(0) < X_{(1)} < ... X_{(n-1)} and create (R(X_{(i)}), R(Y_{(i)})).
The Chatterjee correlation is then given by

[$../equations/chatterjee_correlation.svg]

In the limit of an infinite amount of i.i.d data, the statistic lies in [0, 1].
However, if the data is not infinite, the statistic may be negative.
If X and Y are independent, the value is zero, and if Y is a measurable function of X, then the statistic is unity.
The complexity is O(n log n).

An example is given below:

std::vector<double> X{1,2,3,4,5};
std::vector<double> Y{1,2,3,4,5};
using boost::math::statistics::chatterjee_correlation;
double coeff = chatterjee_correlation(X, Y);

The implementation follows [@https://arxiv.org/pdf/1909.10140.pdf Chatterjee's paper].

/Nota bene:/ If the input is an integer type the output will be a double precision type.

[heading Invariants]

The function expects at least two samples, a non-constant vector Y, and the same number of X's as Y's.
If Y is constant, the result is a quiet NaN.
The data set must be sorted by X values.
If there are ties in the values of X, then the statistic is random due to the random breaking of ties.
Of course, random numbers are not used internally, but the result is not guaranteed to be identical on different systems.

[heading References]

* Chatterjee, Sourav. "A new coefficient of correlation." Journal of the American Statistical Association 116.536 (2021): 2009-2022.

[endsect]
[/section:chatterjee_correlation Chatterjee Correlation]
2 changes: 1 addition & 1 deletion example/dot_net_example/distribution_explorer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Statistical Distribution Explorer
Paul A. Bristow
John Maddock

Copyright 2008 , 2009, 2010, 2012 Paul A. Bristow, John Maddock
Copyright (C) 2008, 2009, 2010, 2012 Paul A. Bristow, John Maddock

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)

Expand Down
2 changes: 1 addition & 1 deletion example/policy_eg_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using boost::math::policies::policy;
using boost::math::policies::evaluation_error;
using boost::math::policies::domain_error;
using boost::math::policies::overflow_error;
using boost::math::policies::domain_error;
using boost::math::policies::underflow_error;
using boost::math::policies::pole_error;
// Actions on error (in enum error_policy_type):
using boost::math::policies::errno_on_error;
Expand Down
1 change: 1 addition & 0 deletions include/boost/math/ccmath/ccmath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
#include <boost/math/ccmath/isless.hpp>
#include <boost/math/ccmath/islessequal.hpp>
#include <boost/math/ccmath/isunordered.hpp>
#include <boost/math/ccmath/fma.hpp>

#endif // BOOST_MATH_CCMATH_HPP
Loading

0 comments on commit 85e2a55

Please sign in to comment.