Skip to content

Commit 2be649d

Browse files
committed
refactor: added source code for boost multiprecision library instead of git link
1 parent ed78377 commit 2be649d

File tree

1,064 files changed

+205660
-0
lines changed

Some content is hidden

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

1,064 files changed

+205660
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Generated by `boostdep --cmake multiprecision`
2+
# Copyright 2020 Peter Dimov
3+
# Copyright 2021 Matt Borland
4+
# Distributed under the Boost Software License, Version 1.0.
5+
# https://www.boost.org/LICENSE_1_0.txt
6+
7+
cmake_minimum_required(VERSION 3.5...3.16)
8+
9+
project(boost_multiprecision VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
10+
11+
add_library(boost_multiprecision INTERFACE)
12+
add_library(Boost::multiprecision ALIAS boost_multiprecision)
13+
14+
target_include_directories(boost_multiprecision INTERFACE include)
15+
16+
include(CMakeDependentOption)
17+
18+
cmake_dependent_option(BOOST_MP_STANDALONE "Use Boost.Multiprecision in standalone mode" ON "NOT BOOST_SUPERPROJECT_VERSION" OFF)
19+
20+
message(STATUS "Boost.Multiprecision: standalone mode ${BOOST_MP_STANDALONE}")
21+
22+
if(BOOST_MP_STANDALONE)
23+
24+
target_compile_definitions(boost_multiprecision INTERFACE BOOST_MP_STANDALONE=1)
25+
26+
else()
27+
28+
target_link_libraries(boost_multiprecision
29+
INTERFACE
30+
Boost::assert
31+
Boost::config
32+
Boost::core
33+
Boost::integer
34+
Boost::lexical_cast
35+
Boost::math
36+
Boost::random
37+
)
38+
39+
endif()
40+
41+
# Only enable tests when we're the root project
42+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
43+
44+
#Testing with CMake not currently used
45+
#Uncomment following two lines onec
46+
#include(CTest)
47+
#add_subdirectory(test)
48+
include(GNUInstallDirs)
49+
install(DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
50+
51+
endif()

ThirdParty/multiprecision/LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

ThirdParty/multiprecision/README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
Boost Multiprecision Library
2+
============================
3+
4+
| | Master | Develop |
5+
|------------------|----------|-------------|
6+
| Drone | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/multiprecision) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg)](https://drone.cpp.al/boostorg/multiprecision) |
7+
| Github Actions | [![Build Status](https://github.com/boostorg/multiprecision/workflows/multiprecision/badge.svg?branch=master)](https://github.com/boostorg/multiprecision/actions) | [![Build Status](https://github.com/boostorg/multiprecision/workflows/multiprecision/badge.svg?branch=develop)](https://github.com/boostorg/multiprecision/actions) |
8+
| Codecov | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/master) | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/develop) |
9+
10+
11+
`Boost.Multiprecision` is a C++ library that provides integer, rational, floating-point, complex and interval number types
12+
having more range and precision than the language's ordinary built-in types.
13+
14+
Language adherence:
15+
- `Boost.Multiprecision` requires a compliant C++14 compiler.
16+
- It is compatible with C++14, 17, 20, 23 and beyond.
17+
18+
The big number types in `Boost.Multiprecision` can be used with a wide selection of basic
19+
mathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can
20+
also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows `Boost.Multiprecision` to be
21+
used for all kinds of mathematical calculations involving integer, rational and floating-point types requiring extended range and precision.
22+
23+
Multiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with
24+
support for integer, rational and floating-point types. `Boost.Multiprecision` provides a selection of back ends provided off-the-rack in
25+
including interfaces to GMP, MPFR, MPIR, TomMath as well as its own collection of Boost-licensed, header-only back ends for integers,
26+
rationals, floats and complex. In addition, user-defined back ends can be created and used with the interface of Multiprecision,
27+
provided the class implementation adheres to the necessary concepts.
28+
29+
Depending upon the number type, precision may be arbitrarily large (limited only by available memory), fixed at compile time
30+
(for example $50$ or $100$ decimal digits), or a variable controlled at run-time by member functions.
31+
The types are expression-template-enabled by default. This usually provides better performance than naive user-defined types.
32+
If not needed, expression templates can be disabled when configuring the `number` type with its backend.
33+
34+
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/multiprecision/index.html).
35+
36+
## Using Multiprecision ##
37+
38+
<p align="center">
39+
<a href="https://godbolt.org/z/hj75jEqcz" alt="godbolt">
40+
<img src="https://img.shields.io/badge/try%20it%20on-godbolt-green" /></a>
41+
</p>
42+
43+
In the following example, we use Multiprecision's Boost-licensed binary
44+
floating-point backend type `cpp_bin_float` to compute ${\sim}100$ decimal digits of
45+
46+
$$\sqrt{\pi} = \Gamma \left( \frac{1}{2} \right)~{\approx}~1.772453850905516027298{\ldots}\text{,}$$
47+
48+
where we also observe that Multiprecision can seemlesly interoperate with
49+
[Boost.Math](https://github.com/boostorg/math).
50+
51+
```cpp
52+
#include <iomanip>
53+
#include <iostream>
54+
#include <sstream>
55+
56+
#include <boost/multiprecision/cpp_bin_float.hpp>
57+
#include <boost/math/special_functions/gamma.hpp>
58+
59+
auto main() -> int
60+
{
61+
using big_float_type = boost::multiprecision::cpp_bin_float_100;
62+
63+
const big_float_type sqrt_pi { sqrt(boost::math::constants::pi<big_float_type>()) };
64+
65+
const big_float_type half { big_float_type(1) / 2 };
66+
67+
const big_float_type gamma_half { boost::math::tgamma(half) };
68+
69+
std::stringstream strm { };
70+
71+
strm << std::setprecision(std::numeric_limits<big_float_type>::digits10) << "sqrt_pi : " << sqrt_pi << '\n';
72+
strm << std::setprecision(std::numeric_limits<big_float_type>::digits10) << "gamma_half: " << gamma_half;
73+
74+
std::cout << strm.str() << std::endl;
75+
}
76+
```
77+
78+
## Standalone ##
79+
80+
Defining `BOOST_MP_STANDALONE` allows `Boost.Multiprecision`
81+
to be used with the only dependency being [Boost.Config](https://github.com/boostorg/config).
82+
83+
Our [package on this page](https://github.com/boostorg/multiprecision/releases)
84+
already includes a copy of Boost.Config so no other downloads are required.
85+
Some functionality is reduced in this mode.
86+
A static_assert message will alert you if a particular feature has been disabled by standalone mode.
87+
[Boost.Math](https://github.com/boostorg/math) standalone mode is compatiable,
88+
and recommended if special functions are required for the floating point types.
89+
90+
## Support, bugs and feature requests ##
91+
92+
Bugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/multiprecision/issues)
93+
(see [open issues](https://github.com/boostorg/multiprecision/issues) and
94+
[closed issues](https://github.com/boostorg/multiprecision/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)).
95+
96+
You can submit your changes through a [pull request](https://github.com/boostorg/multiprecision/pulls).
97+
98+
There is no mailing-list specific to `Boost Multiprecision`,
99+
although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users)
100+
using the tag [multiprecision].
101+
102+
103+
## Development ##
104+
105+
Clone the whole boost project, which includes the individual Boost projects as submodules
106+
([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):
107+
108+
```sh
109+
git clone https://github.com/boostorg/boost
110+
cd boost
111+
git submodule update --init
112+
```
113+
114+
The Boost Multiprecision Library is located in `libs/multiprecision/`.
115+
116+
### Running tests ###
117+
First, build the `b2` engine by running `bootstrap.sh` in the root of the boost directory. This will generate `b2` configuration in `project-config.jam`.
118+
119+
```sh
120+
./bootstrap.sh
121+
```
122+
123+
Now make sure you are in `libs/multiprecision/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test:
124+
125+
```sh
126+
../../../b2 <- run all tests
127+
../../../b2 test_complex <- single test
128+
```

ThirdParty/multiprecision/codecov.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
4+
coverage:
5+
precision: 1
6+
round: up
7+
range: '50...100'
8+
status:
9+
project:
10+
default: # This can be anything, but it needs to exist as the name
11+
# basic settings
12+
target: 75%
13+
threshold: 10%
14+
if_ci_failed: error #success, failure, error, ignore
15+
only_pulls: false
16+
patch:
17+
default:
18+
target: 75%
19+
threshold: 25%
20+
21+
parsers:
22+
gcov:
23+
branch_detection:
24+
conditional: no
25+
loop: no
26+
method: no
27+
macro: no
28+
29+
comment:
30+
layout: 'reach,diff,flags,files,footer'
31+
behavior: default
32+
require_changes: no
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# copyright John Maddock 2008
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt.
5+
6+
import modules ;
7+
import path ;
8+
import ../../config/checks/config : requires ;
9+
10+
local gmp_path = [ modules.peek : GMP_PATH ] ;
11+
local mpfr_path = [ modules.peek : MPFR_PATH ] ;
12+
local mpfi_path = [ modules.peek : MPFI_PATH ] ;
13+
local tommath_path = [ modules.peek : TOMMATH_PATH ] ;
14+
15+
project : requirements
16+
<include>$(gmp_path)
17+
<include>$(gmp_path)/mpfr
18+
<include>$(gmp_path)/gmpfrxx
19+
<include>$(mpfr_path)
20+
<include>$(mpfi_path)
21+
<include>$(mpfi_path)/src
22+
<include>$(tommath_path)
23+
<include>../../..
24+
<search>$(gmp_path)
25+
<search>$(mpfr_path)
26+
<search>$(mpfr_path)/build.vc10/lib/Win32/Debug
27+
<search>$(tommath_path)
28+
<search>$(mpfi_path)
29+
<search>$(mpfi_path)/src
30+
# We set these to make it easier to set up and test GMP and MPFR under Win32:
31+
<toolset>msvc:<runtime-link>static
32+
<toolset>msvc:<link>static
33+
<toolset>intel-win:<runtime-link>static
34+
<toolset>intel-win:<link>static
35+
<toolset>msvc:<warnings>all
36+
<toolset>gcc:<cxxflags>-Wall
37+
<toolset>gcc:<cxxflags>-Wextra
38+
;
39+
40+
lib gmp ;
41+
lib mpfr ;
42+
lib mpfi ;
43+
lib mpc ;
44+
lib quadmath ;
45+
lib tommath ;
46+
lib f2c ;
47+
48+
actions mp_simple_run_action
49+
{
50+
$(>) > $(<)
51+
}
52+
53+
rule mp-run-simple ( sources + : args * : input-files * : requirements * : target-name )
54+
{
55+
exe $(target-name)_exe : $(sources) : $(requirements) ;
56+
explicit $(target-name)_exe ;
57+
make $(target-name).output : $(target-name)_exe : @mp_simple_run_action ;
58+
explicit $(target-name).output ;
59+
alias $(target-name) : $(target-name).output ;
60+
}
61+
62+
mp-run-simple has_gmp.cpp gmp : : :
63+
<include>$(gmp_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx : has_gmp ;
64+
mp-run-simple has_mpfr.cpp mpfr gmp : : :
65+
<include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpfr ;
66+
mp-run-simple has_mpfi.cpp mpfi mpfr gmp : : :
67+
<include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpfi ;
68+
mp-run-simple has_mpc.cpp mpc mpfr gmp : : :
69+
<include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpc ;
70+
mp-run-simple has_tommath.cpp tommath : : :
71+
<include>$(tommath_path) : has_tommath ;
72+
mp-run-simple has_float128.cpp quadmath : : : : has_float128 ;
73+
exe has_intel_quad : has_intel_quad.cpp : <cxxflags>-Qoption,cpp,--extended_float_type ;
74+
exe has_eigen : has_eigen.cpp ;
75+
exe has_f2c : has_f2c.cpp f2c ;
76+
obj has_is_constant_evaluated : has_is_constant_evaluated.cpp ;
77+
obj has_constexpr_limits : has_constexpr_limits_cmd.cpp : <cxxflags>-fconstexpr-ops-limit=268435456 ;
78+
obj has_big_obj : has_big_obj.cpp : <cxxflags>-Wa,-mbig-obj ;
79+
obj is_ci_sanitizer_run : is_ci_sanitizer_run.cpp ;
80+
81+
explicit has_gmp ;
82+
explicit has_mpfr ;
83+
explicit has_mpfi ;
84+
explicit has_tommath ;
85+
explicit has_float128 ;
86+
explicit has_intel_quad ;
87+
explicit has_mpc ;
88+
explicit has_eigen ;
89+
explicit has_is_constant_evaluated ;
90+
explicit has_constexpr_limits ;
91+
explicit has_big_obj ;
92+
explicit has_f2c ;
93+
explicit is_ci_sanitizer_run ;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright John Maddock 2020.
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)
5+
6+
#ifndef __GNUC__
7+
#error "compiler is not GCC"
8+
#endif
9+
10+
int main()
11+
{
12+
return 0;
13+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright John Maddock 2019.
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)
5+
6+
#ifndef __GNUC__
7+
#error "Compiler is not GCC"
8+
#endif
9+
#if __GNUC__ < 9
10+
#error "Older GCC versions don't support -fconstexpr-ops-limit"
11+
#endif
12+
13+
int main()
14+
{
15+
return 0;
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright John Maddock 2011.
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)
5+
6+
#include <Eigen/Dense>
7+
8+
int main()
9+
{
10+
#if EIGEN_VERSION_AT_LEAST(3, 3, 0)
11+
#else
12+
#error "Obsolete Eigen"
13+
#endif
14+
return 0;
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright John Maddock 2019.
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)
5+
6+
#include <f2c.h>
7+
8+
int main()
9+
{
10+
return 0;
11+
}

0 commit comments

Comments
 (0)