Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:29

0001 ///////////////////////////////////////////////////////////////////////////////
0002 //  Copyright 2023 John Maddock. Distributed under the Boost
0003 //  Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_MP_FWD_HPP
0007 #define BOOST_MP_FWD_HPP
0008 
0009 #include <boost/multiprecision/cpp_int/cpp_int_config.hpp>
0010 
0011 namespace boost {
0012    namespace multiprecision {
0013 
0014       enum expression_template_option
0015       {
0016          et_off = 0,
0017          et_on = 1
0018       };
0019 
0020       template <class Backend>
0021       struct expression_template_default
0022       {
0023          static constexpr expression_template_option value = et_on;
0024       };
0025 
0026       template <class Backend, expression_template_option ExpressionTemplates = expression_template_default<Backend>::value>
0027       class number;
0028 
0029       template <class T>
0030       struct is_number : public std::integral_constant<bool, false>
0031       {};
0032 
0033       template <class Backend, expression_template_option ExpressionTemplates>
0034       struct is_number<number<Backend, ExpressionTemplates> > : public std::integral_constant<bool, true>
0035       {};
0036 
0037       namespace detail {
0038 
0039          // Forward-declare an expression wrapper
0040          template <class tag, class Arg1 = void, class Arg2 = void, class Arg3 = void, class Arg4 = void>
0041          struct expression;
0042 
0043       } // namespace detail
0044 
0045       enum cpp_integer_type
0046       {
0047          signed_magnitude = 1,
0048          unsigned_magnitude = 0,
0049          signed_packed = 3,
0050          unsigned_packed = 2
0051       };
0052 
0053       enum cpp_int_check_type
0054       {
0055          checked = 1,
0056          unchecked = 0
0057       };
0058 
0059       enum mpfr_allocation_type
0060       {
0061          allocate_stack,
0062          allocate_dynamic
0063       };
0064 
0065       template <class Backend>
0066       void log_postfix_event(const Backend&, const char* /*event_description*/);
0067       template <class Backend, class T>
0068       void log_postfix_event(const Backend&, const T&, const char* /*event_description*/);
0069       template <class Backend>
0070       void log_prefix_event(const Backend&, const char* /*event_description*/);
0071       template <class Backend, class T>
0072       void log_prefix_event(const Backend&, const T&, const char* /*event_description*/);
0073       template <class Backend, class T, class U>
0074       void log_prefix_event(const Backend&, const T&, const U&, const char* /*event_description*/);
0075       template <class Backend, class T, class U, class V>
0076       void log_prefix_event(const Backend&, const T&, const U&, const V&, const char* /*event_description*/);
0077 
0078       namespace backends {
0079 
0080          template <class Backend>
0081          struct debug_adaptor;
0082 
0083          template <class Backend>
0084          struct logged_adaptor;
0085 
0086          template <class Backend>
0087          struct complex_adaptor;
0088 
0089          enum digit_base_type
0090          {
0091             digit_base_2 = 2,
0092             digit_base_10 = 10
0093          };
0094 
0095          template <unsigned Digits, digit_base_type DigitBase = digit_base_10, class Allocator = void, class Exponent = int, Exponent MinExponent = 0, Exponent MaxExponent = 0>
0096          class cpp_bin_float;
0097 
0098          template <unsigned Digits10, class ExponentType = std::int32_t, class Allocator = void>
0099          class cpp_dec_float;
0100 
0101          template <std::size_t MinBits = 0, std::size_t MaxBits = 0, boost::multiprecision::cpp_integer_type SignType = signed_magnitude, cpp_int_check_type Checked = unchecked, class Allocator = typename std::conditional<MinBits && (MinBits == MaxBits), void, std::allocator<limb_type> >::type>
0102          struct cpp_int_backend;
0103 
0104          struct float128_backend;
0105 
0106          struct gmp_int;
0107          struct gmp_rational;
0108 
0109          template <unsigned digits10>
0110          struct gmp_float;
0111 
0112          template <unsigned digits10>
0113          struct mpc_complex_backend;
0114 
0115          template <unsigned digits10>
0116          struct mpfi_float_backend;
0117 
0118          template <unsigned digits10, mpfr_allocation_type AllocationType = allocate_dynamic>
0119          struct mpfr_float_backend;
0120 
0121          template <>
0122          struct mpfr_float_backend<0, allocate_stack>;
0123 
0124          template <class Backend>
0125          struct rational_adaptor;
0126 
0127          struct tommath_int;
0128       }
0129 
0130       using boost::multiprecision::backends::complex_adaptor;
0131       using boost::multiprecision::backends::debug_adaptor;
0132       using boost::multiprecision::backends::logged_adaptor;
0133       using backends::cpp_bin_float;
0134       using backends::digit_base_10;
0135       using backends::digit_base_2;
0136       using boost::multiprecision::backends::cpp_dec_float;
0137       using boost::multiprecision::backends::cpp_int_backend;
0138       using boost::multiprecision::backends::float128_backend;
0139       using boost::multiprecision::backends::gmp_float;
0140       using boost::multiprecision::backends::gmp_int;
0141       using boost::multiprecision::backends::gmp_rational;
0142       using boost::multiprecision::backends::mpc_complex_backend;
0143       using boost::multiprecision::backends::mpfi_float_backend;
0144       using boost::multiprecision::backends::mpfr_float_backend;
0145       using boost::multiprecision::backends::rational_adaptor;
0146       using boost::multiprecision::backends::tommath_int;
0147 
0148       template <unsigned Digits, backends::digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE>
0149       struct expression_template_default<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> >
0150       {
0151          static constexpr expression_template_option value = std::is_void<Allocator>::value ? et_off : et_on;
0152       };
0153 
0154       template <std::size_t MinBits, std::size_t MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked>
0155       struct expression_template_default<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, void> >
0156       {
0157          static constexpr expression_template_option value = et_off;
0158       };
0159 
0160       template <class IntBackend>
0161       struct expression_template_default<backends::rational_adaptor<IntBackend> > : public expression_template_default<IntBackend>
0162       {};
0163 
0164       using complex128 = number<complex_adaptor<float128_backend>, et_off>;
0165 
0166       using cpp_bin_float_50 = number<backends::cpp_bin_float<50> >;
0167       using cpp_bin_float_100 = number<backends::cpp_bin_float<100> >;
0168 
0169       using cpp_bin_float_single = number<backends::cpp_bin_float<24, backends::digit_base_2, void, std::int16_t, -126, 127>, et_off>;
0170       using cpp_bin_float_double = number<backends::cpp_bin_float<53, backends::digit_base_2, void, std::int16_t, -1022, 1023>, et_off>;
0171       using cpp_bin_float_double_extended = number<backends::cpp_bin_float<64, backends::digit_base_2, void, std::int16_t, -16382, 16383>, et_off>;
0172       using cpp_bin_float_quad = number<backends::cpp_bin_float<113, backends::digit_base_2, void, std::int16_t, -16382, 16383>, et_off>;
0173       using cpp_bin_float_oct = number<backends::cpp_bin_float<237, backends::digit_base_2, void, std::int32_t, -262142, 262143>, et_off>;
0174 
0175       template <unsigned Digits, backends::digit_base_type DigitBase = backends::digit_base_10, class Allocator = void, class Exponent = int, Exponent MinExponent = 0, Exponent MaxExponent = 0>
0176       using cpp_complex_backend = complex_adaptor<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinExponent, MaxExponent> >;
0177 
0178       template <unsigned Digits, backends::digit_base_type DigitBase = digit_base_10, class Allocator = void, class Exponent = int, Exponent MinExponent = 0, Exponent MaxExponent = 0, expression_template_option ExpressionTemplates = et_off>
0179       using cpp_complex = number<complex_adaptor<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinExponent, MaxExponent> >, ExpressionTemplates>;
0180 
0181       using cpp_complex_50 = cpp_complex<50>;
0182       using cpp_complex_100 = cpp_complex<100>;
0183 
0184       using cpp_complex_single = cpp_complex<24, backends::digit_base_2, void, std::int16_t, -126, 127>;
0185       using cpp_complex_double = cpp_complex<53, backends::digit_base_2, void, std::int16_t, -1022, 1023>;
0186       using cpp_complex_extended = cpp_complex<64, backends::digit_base_2, void, std::int16_t, -16382, 16383>;
0187       using cpp_complex_quad = cpp_complex<113, backends::digit_base_2, void, std::int16_t, -16382, 16383>;
0188       using cpp_complex_oct = cpp_complex<237, backends::digit_base_2, void, std::int32_t, -262142, 262143>;
0189 
0190       using cpp_dec_float_50 = number<cpp_dec_float<50> >;
0191       using cpp_dec_float_100 = number<cpp_dec_float<100> >;
0192 
0193       using cpp_int = number<cpp_int_backend<> >;
0194       using cpp_rational_backend = rational_adaptor<cpp_int_backend<> >;
0195       using cpp_rational = number<cpp_rational_backend>;
0196 
0197       // Fixed precision unsigned types:
0198       using uint128_t = number<cpp_int_backend<128, 128, unsigned_magnitude, unchecked, void> >;
0199       using uint256_t = number<cpp_int_backend<256, 256, unsigned_magnitude, unchecked, void> >;
0200       using uint512_t = number<cpp_int_backend<512, 512, unsigned_magnitude, unchecked, void> >;
0201       using uint1024_t = number<cpp_int_backend<1024, 1024, unsigned_magnitude, unchecked, void> >;
0202 
0203       // Fixed precision signed types:
0204       using int128_t = number<cpp_int_backend<128, 128, signed_magnitude, unchecked, void> >;
0205       using int256_t = number<cpp_int_backend<256, 256, signed_magnitude, unchecked, void> >;
0206       using int512_t = number<cpp_int_backend<512, 512, signed_magnitude, unchecked, void> >;
0207       using int1024_t = number<cpp_int_backend<1024, 1024, signed_magnitude, unchecked, void> >;
0208 
0209       // Over again, but with checking enabled this time:
0210       using checked_cpp_int = number<cpp_int_backend<0, 0, signed_magnitude, checked> >;
0211       using checked_cpp_rational_backend = rational_adaptor<cpp_int_backend<0, 0, signed_magnitude, checked> >;
0212       using checked_cpp_rational = number<checked_cpp_rational_backend>;
0213       // Fixed precision unsigned types:
0214       using checked_uint128_t = number<cpp_int_backend<128, 128, unsigned_magnitude, checked, void> >;
0215       using checked_uint256_t = number<cpp_int_backend<256, 256, unsigned_magnitude, checked, void> >;
0216       using checked_uint512_t = number<cpp_int_backend<512, 512, unsigned_magnitude, checked, void> >;
0217       using checked_uint1024_t = number<cpp_int_backend<1024, 1024, unsigned_magnitude, checked, void> >;
0218 
0219       // Fixed precision signed types:
0220       using checked_int128_t = number<cpp_int_backend<128, 128, signed_magnitude, checked, void> >;
0221       using checked_int256_t = number<cpp_int_backend<256, 256, signed_magnitude, checked, void> >;
0222       using checked_int512_t = number<cpp_int_backend<512, 512, signed_magnitude, checked, void> >;
0223       using checked_int1024_t = number<cpp_int_backend<1024, 1024, signed_magnitude, checked, void> >;
0224 
0225       template <class Number>
0226       using debug_adaptor_t = number<debug_adaptor<typename Number::backend_type>, Number::et>;
0227       template <class Number>
0228       using logged_adaptor_t = number<logged_adaptor<typename Number::backend_type>, Number::et>;
0229 
0230 
0231       using float128 = number<float128_backend, et_off>;
0232 
0233       using mpf_float_50 = number<gmp_float<50> >;
0234       using mpf_float_100 = number<gmp_float<100> >;
0235       using mpf_float_500 = number<gmp_float<500> >;
0236       using mpf_float_1000 = number<gmp_float<1000> >;
0237       using mpf_float = number<gmp_float<0> >;
0238       using mpz_int = number<gmp_int>;
0239       using mpq_rational = number<gmp_rational>;
0240 
0241       using mpc_complex_50 = number<mpc_complex_backend<50> >;
0242       using mpc_complex_100 = number<mpc_complex_backend<100> >;
0243       using mpc_complex_500 = number<mpc_complex_backend<500> >;
0244       using mpc_complex_1000 = number<mpc_complex_backend<1000> >;
0245       using mpc_complex = number<mpc_complex_backend<0> >;
0246 
0247       using mpfi_float_50 = number<mpfi_float_backend<50> >;
0248       using mpfi_float_100 = number<mpfi_float_backend<100> >;
0249       using mpfi_float_500 = number<mpfi_float_backend<500> >;
0250       using mpfi_float_1000 = number<mpfi_float_backend<1000> >;
0251       using mpfi_float = number<mpfi_float_backend<0> >;
0252 
0253       using mpfr_float_50 = number<mpfr_float_backend<50> >;
0254       using mpfr_float_100 = number<mpfr_float_backend<100> >;
0255       using mpfr_float_500 = number<mpfr_float_backend<500> >;
0256       using mpfr_float_1000 = number<mpfr_float_backend<1000> >;
0257       using mpfr_float = number<mpfr_float_backend<0> >;
0258 
0259       using static_mpfr_float_50 = number<mpfr_float_backend<50, allocate_stack> >;
0260       using static_mpfr_float_100 = number<mpfr_float_backend<100, allocate_stack> >;
0261 
0262       using tom_int = number<tommath_int>;
0263       using tommath_rational = rational_adaptor<tommath_int>;
0264       using tom_rational = number<tommath_rational>;
0265 
0266 } }
0267 
0268 #endif