|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2006-07-24 04:39:06
We have a general algorithms directory, currently with a subdirectory with
string routines. I want to add a parallel subdirectory with math routines.
The routines I want to add are for the Greatest Common Factor and the Least
Common Multiple. Now, I already have a header for that in Boost at
$ROOT/boost/math/common_factor_rt.hpp, but the main function and function
object class templates in that header encapsulate the real implementation.
It's those implementation functions that I want to public place in the
algorithm collection. They would be:
1. GCD for unsigned numbers and other non-signed entities, like
polynomials, using division & modulus reduction.
2. GCD for signed entities; similar to [1] but there are sign comparisons
and possible negations, which types in [1] don't have to support.
3. GCD for binary unsigned integers using bit-level operations; it has the
same complexity as [1] and [2], O(digit_count^2), but is generally faster
because bit twiddling is faster than division.
The wrapping code currently in the math libraries, and elsewhere, would be
changed to call these routines.
Would this require a full-blown review, a mini-review, or no review? Note
that we currently do _not_ implement [3] anywhere in Boost (AFAIK).
For the future, I envision algorithm/math to only hold function (templates)
that compute specific ways to evaluate a relation of interest. Full blown
wrapping functions and function objects, as well as types, would stay within
the regular math libraries (and call the algorithms as needed).
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk