Merge branch 'master' of github.com:wbhart/mpir into pull-from-gladman

This commit is contained in:
Alex Dyachenko 2014-03-27 17:02:31 -04:00
commit 8f9070c80e
5 changed files with 194 additions and 134 deletions

View File

@ -25,7 +25,7 @@ END-INFO-DIR-ENTRY

Indirect:
mpir.info-1: 1044
mpir.info-2: 299956
mpir.info-2: 300935

Tag Table:
(Indirect)
@ -105,73 +105,73 @@ Node: C++ Formatted Input215791
Node: C++ Class Interface217699
Node: C++ Interface General218697
Node: C++ Interface Integers221777
Node: C++ Interface Rationals225163
Node: C++ Interface Floats228809
Node: C++ Interface Random Numbers234036
Node: C++ Interface Limitations236144
Node: Custom Allocation238990
Node: Language Bindings243636
Node: Algorithms247666
Node: Multiplication Algorithms248371
Node: Basecase Multiplication249583
Node: Karatsuba Multiplication251495
Node: Toom 3-Way Multiplication255125
Node: Toom 4-Way Multiplication261541
Node: FFT Multiplication262915
Node: Other Multiplication268341
Node: Unbalanced Multiplication271023
Node: Division Algorithms271919
Node: Single Limb Division272267
Node: Basecase Division275187
Node: Divide and Conquer Division276390
Node: Exact Division278660
Node: Exact Remainder281860
Node: Small Quotient Division284153
Node: Greatest Common Divisor Algorithms285752
Node: Binary GCD286044
Node: Lehmer's GCD288720
Node: Subquadratic GCD290924
Node: Extended GCD293378
Node: Jacobi Symbol293937
Node: Powering Algorithms294854
Node: Normal Powering Algorithm295118
Node: Modular Powering Algorithm295647
Node: Root Extraction Algorithms296711
Node: Square Root Algorithm297027
Node: Nth Root Algorithm299170
Node: Perfect Square Algorithm299956
Node: Perfect Power Algorithm302043
Node: Radix Conversion Algorithms302665
Node: Binary to Radix303042
Node: Radix to Binary306973
Node: Other Algorithms308938
Node: Prime Testing Algorithm309292
Node: Factorial Algorithm310519
Node: Binomial Coefficients Algorithm311956
Node: Fibonacci Numbers Algorithm312851
Node: Lucas Numbers Algorithm315327
Node: Random Number Algorithms316049
Node: Assembler Coding318173
Node: Assembler Code Organisation319150
Node: Assembler Basics320123
Node: Assembler Carry Propagation321282
Node: Assembler Cache Handling323120
Node: Assembler Functional Units325288
Node: Assembler Floating Point326909
Node: Assembler SIMD Instructions330692
Node: Assembler Software Pipelining331681
Node: Assembler Loop Unrolling332749
Node: Assembler Writing Guide334969
Node: Internals337739
Node: Integer Internals338253
Node: Rational Internals340510
Node: Float Internals341750
Node: Raw Output Internals349078
Node: C++ Interface Internals350273
Node: Contributors353560
Node: References362555
Node: GNU Free Documentation License370302
Node: Concept Index395472
Node: Function Index438211
Node: C++ Interface Rationals225459
Node: C++ Interface Floats229486
Node: C++ Interface Random Numbers235015
Node: C++ Interface Limitations237123
Node: Custom Allocation239969
Node: Language Bindings244615
Node: Algorithms248645
Node: Multiplication Algorithms249350
Node: Basecase Multiplication250562
Node: Karatsuba Multiplication252474
Node: Toom 3-Way Multiplication256104
Node: Toom 4-Way Multiplication262520
Node: FFT Multiplication263894
Node: Other Multiplication269320
Node: Unbalanced Multiplication272002
Node: Division Algorithms272898
Node: Single Limb Division273246
Node: Basecase Division276166
Node: Divide and Conquer Division277369
Node: Exact Division279639
Node: Exact Remainder282839
Node: Small Quotient Division285132
Node: Greatest Common Divisor Algorithms286731
Node: Binary GCD287023
Node: Lehmer's GCD289699
Node: Subquadratic GCD291903
Node: Extended GCD294357
Node: Jacobi Symbol294916
Node: Powering Algorithms295833
Node: Normal Powering Algorithm296097
Node: Modular Powering Algorithm296626
Node: Root Extraction Algorithms297690
Node: Square Root Algorithm298006
Node: Nth Root Algorithm300149
Node: Perfect Square Algorithm300935
Node: Perfect Power Algorithm303022
Node: Radix Conversion Algorithms303644
Node: Binary to Radix304021
Node: Radix to Binary307952
Node: Other Algorithms309917
Node: Prime Testing Algorithm310271
Node: Factorial Algorithm311498
Node: Binomial Coefficients Algorithm312935
Node: Fibonacci Numbers Algorithm313830
Node: Lucas Numbers Algorithm316306
Node: Random Number Algorithms317028
Node: Assembler Coding319152
Node: Assembler Code Organisation320129
Node: Assembler Basics321102
Node: Assembler Carry Propagation322261
Node: Assembler Cache Handling324099
Node: Assembler Functional Units326267
Node: Assembler Floating Point327888
Node: Assembler SIMD Instructions331671
Node: Assembler Software Pipelining332660
Node: Assembler Loop Unrolling333728
Node: Assembler Writing Guide335948
Node: Internals338718
Node: Integer Internals339232
Node: Rational Internals341489
Node: Float Internals342729
Node: Raw Output Internals350057
Node: C++ Interface Internals351252
Node: Contributors354539
Node: References363534
Node: GNU Free Documentation License371281
Node: Concept Index396451
Node: Function Index439190

End Tag Table

View File

@ -5283,6 +5283,10 @@ File: mpir.info, Node: C++ Interface Integers, Next: C++ Interface Rationals,
If the string is not a valid integer, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
-- Function: mpz_class operator"" _mpz (const char *STR)
With C++11 compilers, integers can be constructed with the syntax
`123_mpz' which is equivalent to `mpz_class("123")'.
-- Function: mpz_class operator/ (mpz_class A, mpz_class D)
-- Function: mpz_class operator% (mpz_class A, mpz_class D)
Divisions involving `mpz_class' round towards zero, as per the
@ -5313,6 +5317,8 @@ File: mpir.info, Node: C++ Interface Integers, Next: C++ Interface Rationals,
-- Function: int mpz_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpz_class OP)
-- Function: mpz_class sqrt (mpz_class OP)
-- Function: void mpz_class::swap (mpz_class& OP)
-- Function: void swap (mpz_class& OP1, mpz_class& OP2)
These functions provide a C++ class interface to the corresponding
MPIR C routines.
@ -5367,6 +5373,11 @@ called.
If the string is not a valid rational, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
-- Function: mpq_class operator"" _mpq (const char *STR)
With C++11 compilers, integral rationals can be constructed with
the syntax `123_mpq' which is equivalent to `mpq_class(123_mpz)'.
Other rationals can be built as `-1_mpq/2' or `0xb_mpq/123456_mpz'.
-- Function: void mpq_class::canonicalize ()
Put an `mpq_class' into canonical form, as per *note Rational
Number Functions::. All arithmetic operators require their
@ -5381,6 +5392,8 @@ called.
-- Function: int mpq_class::set_str (const char *STR, int BASE)
-- Function: int mpq_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpq_class OP)
-- Function: void mpq_class::swap (mpq_class& OP)
-- Function: void swap (mpq_class& OP1, mpq_class& OP2)
These functions provide a C++ class interface to the corresponding
MPIR C routines.
@ -5459,6 +5472,10 @@ used if this doesn't suit.
If the string is not a valid float, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
-- Function: mpf_class operator"" _mpf (const char *STR)
With C++11 compilers, floats can be constructed with the syntax
`1.23e-1_mpf' which is equivalent to `mpf_class("1.23e-1")'.
-- Function: mpf_class& mpf_class::operator= (type OP)
Convert and store the given OP value to an `mpf_class' object. The
same types are accepted as for the constructors above.
@ -5503,6 +5520,8 @@ used if this doesn't suit.
-- Function: int mpf_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpf_class OP)
-- Function: mpf_class sqrt (mpf_class OP)
-- Function: void mpf_class::swap (mpf_class& OP)
-- Function: void swap (mpf_class& OP1, mpf_class& OP2)
-- Function: mpf_class trunc (mpf_class OP)
These functions provide a C++ class interface to the corresponding
MPIR C routines.

View File

@ -2777,21 +2777,21 @@ Function and Type Index
* _mpz_realloc: Integer Special Functions.
(line 54)
* abs <1>: C++ Interface Floats.
(line 69)
(line 73)
* abs <2>: C++ Interface Rationals.
(line 43)
(line 48)
* abs: C++ Interface Integers.
(line 41)
(line 45)
* ceil: C++ Interface Floats.
(line 70)
(line 74)
* cmp <1>: C++ Interface Floats.
(line 71)
(line 75)
* cmp <2>: C++ Interface Rationals.
(line 44)
(line 49)
* cmp: C++ Interface Integers.
(line 42)
(line 46)
* floor: C++ Interface Floats.
(line 79)
(line 83)
* gmp_asprintf: Formatted Output Functions.
(line 65)
* gmp_fprintf: Formatted Output Functions.
@ -2871,7 +2871,7 @@ Function and Type Index
* gmp_vsscanf: Formatted Input Functions.
(line 31)
* hypot: C++ Interface Floats.
(line 80)
(line 84)
* long: MPIR on Windows x64. (line 28)
* mp_bitcnt_t: Nomenclature and Types.
(line 41)
@ -2893,39 +2893,41 @@ Function and Type Index
* mpf_class: C++ Interface General.
(line 20)
* mpf_class::fits_sint_p: C++ Interface Floats.
(line 73)
* mpf_class::fits_slong_p: C++ Interface Floats.
(line 74)
* mpf_class::fits_sshort_p: C++ Interface Floats.
(line 75)
* mpf_class::fits_uint_p: C++ Interface Floats.
(line 76)
* mpf_class::fits_ulong_p: C++ Interface Floats.
(line 77)
* mpf_class::fits_ushort_p: C++ Interface Floats.
* mpf_class::fits_slong_p: C++ Interface Floats.
(line 78)
* mpf_class::get_d: C++ Interface Floats.
* mpf_class::fits_sshort_p: C++ Interface Floats.
(line 79)
* mpf_class::fits_uint_p: C++ Interface Floats.
(line 80)
* mpf_class::fits_ulong_p: C++ Interface Floats.
(line 81)
* mpf_class::fits_ushort_p: C++ Interface Floats.
(line 82)
* mpf_class::get_d: C++ Interface Floats.
(line 85)
* mpf_class::get_mpf_t: C++ Interface General.
(line 66)
* mpf_class::get_prec: C++ Interface Floats.
(line 99)
(line 105)
* mpf_class::get_si: C++ Interface Floats.
(line 82)
(line 86)
* mpf_class::get_str: C++ Interface Floats.
(line 84)
(line 88)
* mpf_class::get_ui: C++ Interface Floats.
(line 85)
(line 89)
* mpf_class::mpf_class: C++ Interface Floats.
(line 12)
* mpf_class::operator=: C++ Interface Floats.
(line 46)
(line 50)
* mpf_class::set_prec: C++ Interface Floats.
(line 100)
(line 106)
* mpf_class::set_prec_raw: C++ Interface Floats.
(line 101)
(line 107)
* mpf_class::set_str: C++ Interface Floats.
(line 86)
(line 90)
* mpf_class::swap: C++ Interface Floats.
(line 94)
* mpf_clear: Initializing Floats. (line 37)
* mpf_clears: Initializing Floats. (line 41)
* mpf_cmp: Float Comparison. (line 7)
@ -3069,25 +3071,27 @@ Function and Type Index
* mpq_class: C++ Interface General.
(line 19)
* mpq_class::canonicalize: C++ Interface Rationals.
(line 37)
(line 42)
* mpq_class::get_d: C++ Interface Rationals.
(line 46)
(line 51)
* mpq_class::get_den: C++ Interface Rationals.
(line 58)
(line 65)
* mpq_class::get_den_mpz_t: C++ Interface Rationals.
(line 68)
(line 75)
* mpq_class::get_mpq_t: C++ Interface General.
(line 65)
* mpq_class::get_num: C++ Interface Rationals.
(line 57)
(line 64)
* mpq_class::get_num_mpz_t: C++ Interface Rationals.
(line 67)
(line 74)
* mpq_class::get_str: C++ Interface Rationals.
(line 47)
(line 52)
* mpq_class::mpq_class: C++ Interface Rationals.
(line 11)
* mpq_class::set_str: C++ Interface Rationals.
(line 48)
(line 53)
* mpq_class::swap: C++ Interface Rationals.
(line 56)
* mpq_clear: Initializing Rationals.
(line 16)
* mpq_clears: Initializing Rationals.
@ -3171,31 +3175,33 @@ Function and Type Index
* mpz_class: C++ Interface General.
(line 18)
* mpz_class::fits_sint_p: C++ Interface Integers.
(line 44)
* mpz_class::fits_slong_p: C++ Interface Integers.
(line 45)
* mpz_class::fits_sshort_p: C++ Interface Integers.
(line 46)
* mpz_class::fits_uint_p: C++ Interface Integers.
(line 47)
* mpz_class::fits_ulong_p: C++ Interface Integers.
(line 48)
* mpz_class::fits_ushort_p: C++ Interface Integers.
* mpz_class::fits_slong_p: C++ Interface Integers.
(line 49)
* mpz_class::get_d: C++ Interface Integers.
* mpz_class::fits_sshort_p: C++ Interface Integers.
(line 50)
* mpz_class::fits_uint_p: C++ Interface Integers.
(line 51)
* mpz_class::fits_ulong_p: C++ Interface Integers.
(line 52)
* mpz_class::fits_ushort_p: C++ Interface Integers.
(line 53)
* mpz_class::get_d: C++ Interface Integers.
(line 54)
* mpz_class::get_mpz_t: C++ Interface General.
(line 64)
* mpz_class::get_si: C++ Interface Integers.
(line 51)
(line 55)
* mpz_class::get_str: C++ Interface Integers.
(line 52)
(line 56)
* mpz_class::get_ui: C++ Interface Integers.
(line 53)
(line 57)
* mpz_class::mpz_class: C++ Interface Integers.
(line 7)
* mpz_class::set_str: C++ Interface Integers.
(line 54)
(line 58)
* mpz_class::swap: C++ Interface Integers.
(line 62)
* mpz_clear: Initializing Integers.
(line 41)
* mpz_clears: Initializing Integers.
@ -3416,26 +3422,38 @@ Function and Type Index
(line 23)
* mpz_xor: Integer Logic and Bit Fiddling.
(line 17)
* operator%: C++ Interface Integers.
(line 29)
* operator/: C++ Interface Integers.
* operator"" <1>: C++ Interface Floats.
(line 46)
* operator"" <2>: C++ Interface Rationals.
(line 37)
* operator"": C++ Interface Integers.
(line 28)
* operator%: C++ Interface Integers.
(line 33)
* operator/: C++ Interface Integers.
(line 32)
* operator<<: C++ Formatted Output.
(line 11)
* operator>> <1>: C++ Interface Rationals.
(line 77)
(line 84)
* operator>>: C++ Formatted Input. (line 11)
* sgn <1>: C++ Interface Floats.
(line 88)
(line 92)
* sgn <2>: C++ Interface Rationals.
(line 50)
(line 55)
* sgn: C++ Interface Integers.
(line 56)
(line 60)
* sqrt <1>: C++ Interface Floats.
(line 89)
(line 93)
* sqrt: C++ Interface Integers.
(line 61)
* swap <1>: C++ Interface Floats.
(line 95)
* swap <2>: C++ Interface Rationals.
(line 57)
* swap: C++ Interface Integers.
(line 63)
* trunc: C++ Interface Floats.
(line 90)
(line 96)

View File

@ -6345,6 +6345,11 @@ If the string is not a valid integer, an @code{std::invalid_argument}
exception is thrown. The same applies to @code{operator=}.
@end deftypefun
@deftypefun mpz_class operator"" _mpz (const char *@var{str})
With C++11 compilers, integers can be constructed with the syntax
@code{123_mpz} which is equivalent to @code{mpz_class("123")}.
@end deftypefun
@deftypefun mpz_class operator/ (mpz_class @var{a}, mpz_class @var{d})
@deftypefunx mpz_class operator% (mpz_class @var{a}, mpz_class @var{d})
Divisions involving @code{mpz_class} round towards zero, as per the
@ -6382,6 +6387,8 @@ mpz_fdiv_q (q.get_mpz_t(), a.get_mpz_t(), d.get_mpz_t());
@deftypefunx int mpz_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpz_class @var{op})
@deftypefunx mpz_class sqrt (mpz_class @var{op})
@deftypefunx void mpz_class::swap (mpz_class& @var{op})
@deftypefunx void swap (mpz_class& @var{op1}, mpz_class& @var{op2})
These functions provide a C++ class interface to the corresponding MPIR C
routines.
@ -6438,6 +6445,12 @@ If the string is not a valid rational, an @code{std::invalid_argument}
exception is thrown. The same applies to @code{operator=}.
@end deftypefun
@deftypefun mpq_class operator"" _mpq (const char *@var{str})
With C++11 compilers, integral rationals can be constructed with the syntax
@code{123_mpq} which is equivalent to @code{mpq_class(123_mpz)}. Other
rationals can be built as @code{-1_mpq/2} or @code{0xb_mpq/123456_mpz}.
@end deftypefun
@deftypefun void mpq_class::canonicalize ()
Put an @code{mpq_class} into canonical form, as per @ref{Rational Number
Functions}. All arithmetic operators require their operands in canonical
@ -6454,6 +6467,8 @@ form, and will return results in canonical form.
@deftypefunx int mpq_class::set_str (const char *@var{str}, int @var{base})
@deftypefunx int mpq_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpq_class @var{op})
@deftypefunx void mpq_class::swap (mpq_class& @var{op})
@deftypefunx void swap (mpq_class& @var{op1}, mpq_class& @var{op2})
These functions provide a C++ class interface to the corresponding MPIR C
routines.
@ -6536,6 +6551,11 @@ If the string is not a valid float, an @code{std::invalid_argument} exception
is thrown. The same applies to @code{operator=}.
@end deftypefun
@deftypefun mpf_class operator"" _mpf (const char *@var{str})
With C++11 compilers, floats can be constructed with the syntax
@code{1.23e-1_mpf} which is equivalent to @code{mpf_class("1.23e-1")}.
@end deftypefun
@deftypefun {mpf_class&} mpf_class::operator= (type @var{op})
Convert and store the given @var{op} value to an @code{mpf_class} object. The
same types are accepted as for the constructors above.
@ -6586,6 +6606,8 @@ with the builtin float types.
@deftypefunx int mpf_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpf_class @var{op})
@deftypefunx mpf_class sqrt (mpf_class @var{op})
@deftypefunx void mpf_class::swap (mpf_class& @var{op})
@deftypefunx void swap (mpf_class& @var{op1}, mpf_class& @var{op2})
@deftypefunx mpf_class trunc (mpf_class @var{op})
These functions provide a C++ class interface to the corresponding MPIR C
routines.

View File

@ -40,6 +40,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include <string>
#include <stdexcept>
#include <cfloat>
#include <algorithm> /* swap */
#include <mpir.h>
#if defined( _MSC_VER ) && _MSC_VER >= 1700
@ -1383,7 +1384,7 @@ struct __gmp_resolve_expr<mpf_t, mpq_t>
typedef mpf_t value_type;
};
#if defined( __GMPXX_USE_CXX11 ) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
namespace std {
template <class T, class U, class V, class W>
struct common_type <__gmp_expr<T, U>, __gmp_expr<V, W> >
@ -1515,7 +1516,7 @@ public:
__gmp_expr() { mpz_init(mp); }
__gmp_expr(const __gmp_expr &z) { mpz_init_set(mp, z.mp); }
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr(__gmp_expr &&z)
{ *mp = *z.mp; mpz_init(z.mp); }
#endif
@ -1581,7 +1582,7 @@ public:
// assignment operators
__gmp_expr & operator=(const __gmp_expr &z)
{ mpz_set(mp, z.mp); return *this; }
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr & operator=(__gmp_expr &&z) __GMPXX_NOEXCEPT
{ swap(z); return *this; }
#endif
@ -1724,7 +1725,7 @@ public:
mpz_init_set(mpq_numref(mp), mpq_numref(q.mp));
mpz_init_set(mpq_denref(mp), mpq_denref(q.mp));
}
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr(__gmp_expr &&q)
{ *mp = *q.mp; mpq_init(q.mp); }
#endif
@ -1803,7 +1804,7 @@ public:
// assignment operators
__gmp_expr & operator=(const __gmp_expr &q)
{ mpq_set(mp, q.mp); return *this; }
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr & operator=(__gmp_expr &&q) __GMPXX_NOEXCEPT
{ swap(q); return *this; }
__gmp_expr & operator=(mpz_class &&z)__GMPXX_NOEXCEPT
@ -1933,7 +1934,7 @@ public:
__gmp_expr(const __gmp_expr &f)
{ mpf_init2(mp, f.get_prec()); mpf_set(mp, f.mp); }
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr(__gmp_expr &&f)
{ *mp = *f.mp; mpf_init2(f.mp, get_prec()); }
#endif
@ -2039,7 +2040,7 @@ public:
// assignment operators
__gmp_expr & operator=(const __gmp_expr &f)
{ mpf_set(mp, f.mp); return *this; }
#if defined(__GMPXX_USE_CXX11) || defined( MSC_CXX_11 )
#if __GMPXX_USE_CXX11 || defined( MSC_CXX_11 )
__gmp_expr & operator=(__gmp_expr &&f) __GMPXX_NOEXCEPT
{ swap(f); return *this; }
#endif