From 69579ae2106eed44e47c28f91df5994ad51a2cc1 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 24 Apr 2017 19:42:22 +0100 Subject: [PATCH] Update gcd/lcm docs to point to Boost.Integer. --- doc/gcd/math-gcd.qbk | 261 +------------------ doc/html/gcd_lcm.html | 31 +-- doc/html/index.html | 2 +- doc/html/indexes/s01.html | 19 +- doc/html/indexes/s02.html | 2 +- doc/html/indexes/s03.html | 2 +- doc/html/indexes/s04.html | 2 +- doc/html/indexes/s05.html | 43 +-- doc/html/math_toolkit/conventions.html | 2 +- doc/html/math_toolkit/navigation.html | 2 +- doc/html/math_toolkit/roots/polynomials.html | 10 + doc/html/rooting.html | 6 +- doc/html/standalone_HTML.manifest | 11 - 13 files changed, 36 insertions(+), 357 deletions(-) diff --git a/doc/gcd/math-gcd.qbk b/doc/gcd/math-gcd.qbk index dff53fafd..e1bc4d729 100644 --- a/doc/gcd/math-gcd.qbk +++ b/doc/gcd/math-gcd.qbk @@ -1,265 +1,10 @@ [mathpart gcd_lcm Integer Utilities (Greatest Common Divisor and Least Common Multiple)] -[section Introduction] +This code has now been moved to Boost.Integer, please see [@http://www.boost.org/doc/libs/release/libs/integer/doc/html/index.html here]. -The class and function templates in `` -provide both run-time and compile-time evaluation of the greatest common divisor -(GCD) or least common multiple (LCM) of two integers. -These facilities are useful for many numeric-oriented generic -programming problems. - -[endsect] [/section Introduction] - -[section Synopsis] - - namespace boost - { - namespace math - { - - template < typename IntegerType > - class gcd_evaluator; - template < typename IntegerType > - class lcm_evaluator; - - template < typename IntegerType > - constexpr IntegerType gcd( IntegerType const &a, IntegerType const &b ); - template < typename IntegerType, typename... Args> - constexpr IntegerType gcd( IntegerType const &a, IntegerType const &b, Args const&... args); - template < typename ForwardIterator > - std::pair::value_type, I> gcd_range(I first, I last); - template < typename IntegerType > - constexpr IntegerType lcm( IntegerType const &a, IntegerType const &b ); - template < typename IntegerType, typename... Args> - constexpr IntegerType lcm( IntegerType const &a, IntegerType const &b, Args const&... args); - template < typename ForwardIterator > - std::pair::value_type, I> lcm_range(I first, I last); - - typedef ``['see-below]`` static_gcd_type; - - template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_gcd; - template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_lcm; - - } - } - -[endsect] [/section Introduction] - -[section GCD Function Object] - -[*Header: ] [@../../../../boost/math/common_factor_rt.hpp ] - - template < typename IntegerType > - class boost::math::gcd_evaluator - { - public: - // Types - typedef IntegerType result_type; - typedef IntegerType first_argument_type; - typedef IntegerType second_argument_type; - - // Function object interface - result_type operator ()( first_argument_type const &a, - second_argument_type const &b ) const; - }; - -The `boost::math::gcd`_evaluator class template defines a function object -class to return the greatest common divisor of two integers. -The template is parameterized by a single type, called `IntegerType` here. -This type should be a numeric type that represents integers. -The result of the function object is always nonnegative, even if either of -the operator arguments is negative. - -This function object class template is used in the corresponding version of -the GCD function template. If a numeric type wants to customize evaluations -of its greatest common divisors, then the type should specialize on the -`gcd_evaluator` class template. - -[endsect] [/section GCD Function Object] - -[section LCM Function Object] - -[*Header: ] [@../../../../boost/math/common_factor_rt.hpp ] - - template < typename IntegerType > - class boost::math::lcm_evaluator - { - public: - // Types - typedef IntegerType result_type; - typedef IntegerType first_argument_type; - typedef IntegerType second_argument_type; - - // Function object interface - result_type operator ()( first_argument_type const &a, - second_argument_type const &b ) const; - }; - -The `boost::math::lcm_evaluator` class template defines a function object -class to return the least common multiple of two integers. The template -is parameterized by a single type, called `IntegerType `here. This type -should be a numeric type that represents integers. The result of the -function object is always nonnegative, even if either of the operator -arguments is negative. If the least common multiple is beyond the range -of the integer type, the results are undefined. - -This function object class template is used in the corresponding version -of the LCM function template. If a numeric type wants to customize -evaluations of its least common multiples, then the type should -specialize on the `lcm_evaluator` class template. - -[endsect] [/section LCM Function Object] - -[section:run_time Run-time GCD & LCM Determination] - -[*Header: ] [@../../../../boost/math/common_factor_rt.hpp ] - - template < typename IntegerType > - constexpr IntegerType gcd( IntegerType const &a, IntegerType const &b ); - - template < typename IntegerType, typename... Args> - constexpr IntegerType gcd( IntegerType const &a, IntegerType const &b, Args const&... args); - - template < typename ForwardIterator > - std::pair::value_type, I> gcd_range(I first, I last); - - template < typename IntegerType > - constexpr IntegerType lcm( IntegerType const &a, IntegerType const &b ); - - template < typename IntegerType, typename... Args> - constexpr IntegerType lcm( IntegerType const &a, IntegerType const &b, Args const&... args); - - template < typename ForwardIterator > - std::pair::value_type, I> lcm_range(I first, I last); - -The `boost::math::gcd` function template returns the greatest common -(nonnegative) divisor of the two integers passed to it. -`boost::math::gcd_range` is the iteration of the above gcd algorithm over a -range, returning the greatest common divisor of all the elements. The algorithm -terminates when the gcd reaches unity or the end of the range. Thus it also -returns the iterator after the last element inspected because this may not be -equal to the end of the range. The variadic version of `gcd` behaves similarly -but does not indicate which input value caused the gcd to reach unity. - -The boost::math::lcm function template returns the least common -(nonnegative) multiple of the two integers passed to it. -As with gcd, there are range and variadic versions of the function for -more than 2 arguments. - -[endsect] [/section:run_time Run-time GCD & LCM Determination] - -[section:compile_time Compile-time GCD and LCM determination] - -[*Header: ] [@../../../../boost/math/common_factor_ct.hpp ] - - typedef ``['unspecified]`` static_gcd_type; - - template < static_gcd_type Value1, static_gcd_type Value2 > - struct boost::math::static_gcd : public mpl::integral_c - { - }; - - template < static_gcd_type Value1, static_gcd_type Value2 > - struct boost::math::static_lcm : public mpl::integral_c - { - }; - -The type `static_gcd_type` is the widest unsigned-integer-type that is supported -for use in integral-constant-expressions by the compiler. Usually this -the same type as `boost::uintmax_t`, but may fall back to being `unsigned long` -for some older compilers. - -The boost::math::static_gcd and boost::math::static_lcm class templates -take two value-based template parameters of the ['static_gcd_type] type -and inherit from the type `boost::mpl::integral_c`. -Inherited from the base class, they have a member /value/ -that is the greatest common factor or least -common multiple, respectively, of the template arguments. -A compile-time error will occur if the least common multiple -is beyond the range of `static_gcd_type`. - -[h3 Example] - - #include - #include - #include - #include - - int main() - { - using std::cout; - using std::endl; - - cout << "The GCD and LCM of 6 and 15 are " - << boost::math::gcd(6, 15) << " and " - << boost::math::lcm(6, 15) << ", respectively." - << endl; - - cout << "The GCD and LCM of 8 and 9 are " - << boost::math::static_gcd<8, 9>::value - << " and " - << boost::math::static_lcm<8, 9>::value - << ", respectively." << endl; - - int a[] = { 4, 5, 6 }, b[] = { 7, 8, 9 }, c[3]; - std::transform( a, a + 3, b, c, boost::math::gcd_evaluator() ); - std::copy( c, c + 3, std::ostream_iterator(cout, " ") ); - } - -[endsect] [/section:compile_time Compile time GCD and LCM determination] - -[section:gcd_header Header ] - -This header simply includes the headers -[@../../../../boost/math/common_factor_ct.hpp ] -and [@../../../../boost/math/common_factor_rt.hpp ]. - -[note This is a legacy header: it used to contain the actual implementation, -but the compile-time and run-time facilities -were moved to separate headers (since they were independent of each other).] - -[endsect] [/section:gcd_header Header ] - -[section:demo Demonstration Program] - -The program [@../../../../libs/math/test/common_factor_test.cpp common_factor_test.cpp] -is a demonstration of the results from -instantiating various examples of the run-time GCD and LCM function -templates and the compile-time GCD and LCM class templates. -(The run-time GCD and LCM class templates are tested indirectly through -the run-time function templates.) - -[endsect] [/section:demo Demonstration Program] - -[section Rationale] - -The greatest common divisor and least common multiple functions are -greatly used in some numeric contexts, including some of the other -Boost libraries. Centralizing these functions to one header improves -code factoring and eases maintainence. - -[endsect] [/section Rationale] - -[section:gcd_history History] - -* 13 May 2013 Moved into main Boost.Math Quickbook documentation. -* 17 Dec 2005: Converted documentation to Quickbook Format. -* 2 Jul 2002: Compile-time and run-time items separated to new headers. -* 7 Nov 2001: Initial version - -[endsect] [/section:gcd_history History] - -[section:gcd_credits Credits] - -The author of the Boost compilation of GCD and LCM computations is -Daryle Walker. The code was prompted by existing code hiding in the -implementations of Paul Moore's rational library and Steve Cleary's -pool library. The code had updates by Helmut Zeisel. - -[endsect] [/section:gcd_credits Credits] +Note that for the time being the headers ``, `` and `` will continue to exist +and redirect to the moved headers. [endmathpart] [/mathpart gcd_lcm Integer Utilities (Greatest Common Divisor and Least Common Multiple)] diff --git a/doc/html/gcd_lcm.html b/doc/html/gcd_lcm.html index b9847bce9..937b9ec70 100644 --- a/doc/html/gcd_lcm.html +++ b/doc/html/gcd_lcm.html @@ -7,7 +7,7 @@ - + @@ -20,27 +20,20 @@

-PrevUpHomeNext +PrevUpHomeNext

Chapter 11. Integer Utilities (Greatest Common Divisor and Least Common Multiple)

- +

+ This code has now been moved to Boost.Integer, please see here. +

+

+ Note that for the time being the headers <boost/math/common_factor.hpp>, + <boost/math/common_factor_ct.hpp> and + <boost/math/common_factor_rt.hpp> will + continue to exist and redirect to the moved headers. +

@@ -55,7 +48,7 @@

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/index.html b/doc/html/index.html index 42f6591fa..08732a864 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -116,7 +116,7 @@ This manual is also available in -

Last revised: March 02, 2017 at 18:50:19 GMT

+

Last revised: April 24, 2017 at 18:38:47 GMT


diff --git a/doc/html/indexes/s01.html b/doc/html/indexes/s01.html index 1e1d5bdf0..8261fe840 100644 --- a/doc/html/indexes/s01.html +++ b/doc/html/indexes/s01.html @@ -24,7 +24,7 @@

-Function Index

+Function Index

2 4 A B C D E F G H I J K L M N O P Q R S T U V X Y Z

A B C D E F G H I L M N O P Q R S T U W

diff --git a/doc/html/indexes/s03.html b/doc/html/indexes/s03.html index b625a0d85..1b45ecfca 100644 --- a/doc/html/indexes/s03.html +++ b/doc/html/indexes/s03.html @@ -24,7 +24,7 @@

-Typedef Index

+Typedef Index

A B C D E F G H I L N O P R S T U V W

diff --git a/doc/html/indexes/s04.html b/doc/html/indexes/s04.html index 0e4c58819..cf01c41b7 100644 --- a/doc/html/indexes/s04.html +++ b/doc/html/indexes/s04.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B F

diff --git a/doc/html/indexes/s05.html b/doc/html/indexes/s05.html index c8f781f35..963477183 100644 --- a/doc/html/indexes/s05.html +++ b/doc/html/indexes/s05.html @@ -23,7 +23,7 @@

-Index

+Index

2 4 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

@@ -1583,10 +1583,6 @@
  • -

    Comparing the means of two samples with the Students-t test

    - -
  • -
  • Comparison of Cube Root Finding Algorithms

    • double

    • @@ -1625,13 +1621,6 @@
  • -

    Compile-time GCD and LCM determination

    - -
  • -
  • Compilers

  • - +

    Boost.Math documentation is provided in both HTML and PDF formats. diff --git a/doc/html/math_toolkit/roots/polynomials.html b/doc/html/math_toolkit/roots/polynomials.html index d7e264afa..5a2476348 100644 --- a/doc/html/math_toolkit/roots/polynomials.html +++ b/doc/html/math_toolkit/roots/polynomials.html @@ -179,6 +179,16 @@ (here floating point, complex, etc) and over a unique factorization domain (integers). Division of polynomials over a field is compatible with Euclidean GCD.

    +

    + Division of polynomials over a UFD is compatible with the subresultant algorithm + for GCD (implemented as subresultant_gcd), but a serious word of warning + is required: the intermediate value swell of that algorithm will cause single-precision + integral types to overflow very easily. So although the algorithm will work + on single-precision integral types, an overload of the gcd function is only + provided for polynomials with multi-precision integral types, to prevent + nasty surprises. This is done somewhat crudely by disabling the overload + for non-POD integral types. +

    Advanced manipulations: the FFT, factorisation etc are not currently provided. Submissions for these are of course welcome :-) diff --git a/doc/html/rooting.html b/doc/html/rooting.html index 6c0276e20..9117cff6e 100644 --- a/doc/html/rooting.html +++ b/doc/html/rooting.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@


    -PrevUpHomeNext +PrevUpHomeNext

    @@ -99,7 +99,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/standalone_HTML.manifest b/doc/html/standalone_HTML.manifest index 319e71a2f..67568ed38 100644 --- a/doc/html/standalone_HTML.manifest +++ b/doc/html/standalone_HTML.manifest @@ -293,17 +293,6 @@ math_toolkit/acknowledgements.html math_toolkit/oct_history.html math_toolkit/oct_todo.html gcd_lcm.html -math_toolkit/introduction.html -math_toolkit/synopsis.html -math_toolkit/gcd_function_object.html -math_toolkit/lcm_function_object.html -math_toolkit/run_time.html -math_toolkit/compile_time.html -math_toolkit/gcd_header.html -math_toolkit/demo.html -math_toolkit/rationale0.html -math_toolkit/gcd_history.html -math_toolkit/gcd_credits.html rooting.html math_toolkit/roots.html math_toolkit/roots/roots_noderiv.html