A Tour of NTL: Summary of Changes
2009.08.14: Changes between NTL 5.5.1 and 5.5.2
-
New routines MulAddTo and MulSubFrom
for computing x += a*b and x -= a*b,
where x and a are ZZ's and
b is a ZZ or a long.
In the case where b is a long,
this may be much faster than writing
mul(t, a, b); add(x, x, t).
See ZZ.txt for details.
These new routines are used in a number of places in
NTL to get faster algorithms (for example, the LLL routine).
-
Fixed a relatively benign indexing bug in GF2EX
discovered by Berend-Benjamin Tams using the valgrind tool.
2009.05.05: Changes between NTL 5.5 and 5.5.1
- If using GMP (via either NTL_GMP_LIP
or NTL_GMP_HACK), then the new version (4.3.0) of
GMP implements the XGCD functionality differently,
so that the coefficients do not always agree with those returned by
the classical extended Euclidean algorithm.
This version of NTL corrects the coefficients, so that the
"classical" coefficients are always produced, regardless
of GMP's implementation.
This version of NTL also works
around a bug in GMP 4.3.0's XGCD code
(although that bug should be fixed in GMP 4.3.1).
-
The configure script has been slightly modified:
there is a new configuration variable DEF_PREFIX,
whose value can be used to set PREFIX, GMP_PREFIX,
and GF2X_PREFIX in one stroke.
Also, the (somewhat esoteric) configure variables
GMP_LIBDIR, GMP_INCDIR,
GF2X_LIBDIR, and GF2X_INCDIR
have slightly different meanings now.
2009.04.08: Changes between NTL 5.4.2 and 5.5
-
Added the ability to generate a shared library
(with help from Tim Abbott). Details.
-
Fixed some standardization issues
(with help from Tim Abbot):
default location of installed documentation files now conforms
to standards; use of EOF now conforms to standards.
-
Added a callback mechanism to NTL's error reporting function.
See ErrorCallback in tools.txt.
-
Added support for the gf2x library for speeding up
arithmetic in GF2X (with help from Emmanuel Thomé).
Details.
-
In conjuction with the above, I also changed the
GF2X so that it works better with very large polynomials:
large blocks of memory are released, recursive HalfGCD algorithms
are used for large polynomials.
-
Fixed a bug in void TraceMod(zz_p& x, const zz_pX& a, const zz_pXModulus& F) (reported by Luca De Feo).
-
Fixed a performance issue in various versions of SetCoeff
(reported by Luca De Feo).
-
Fixed the declaration of mat_zz_p transpose(const mat_zz_p& a)
(reported by Benoit Lacelle).
2008.03.05: Changes between NTL 5.4.1 and 5.4.2
-
Fixed a bug in the sub(ZZ_pEX, ZZ_pE, ZZ_pEX)
and sub(zz_pEX, zz_pE, zz_pEX) routines (reported by Charanjit Jutla).
Under certain circumstances, these could outout wrong answers.
2007.05.09: Changes between NTL 5.4 and 5.4.1
-
Fixed rounding bug in expm1 (reported by Paul Zimmermann).
-
Fixed memory leak in several LLL routines (reported by Friedrich Bahr).
-
Fixed infinite loop in several LLL routines
(this only occurred on machines, like x86, with double rounding).
-
Improved GF2X timing tests (suggested by Paul Zimmermann).
2005.03.24: Changes between NTL 5.3.2 and 5.4
2004.05.21: Changes between NTL 5.3.1 and 5.3.2
-
Some bug fixes.
-
Re-wrote SqrRootMod to make it run faster.
2002.12.17: Changes between NTL 5.3 and 5.3.1
-
Fixed a bug affecting the BuildIrred routines
for ZZ_pEX and zz_pEX.
2002.07.05: Changes between NTL 5.2 and 5.3
-
Minimized and isolated constructs that do not adhere to C/C++
standards,
and added flags NTL_CLEAN_INT and NTL_CLEAN_PTR
which force stricter compliance with these standards
[more details].
-
Added functions IsWhiteSpace, CharToIntVal,
and IntValToChar to the tools module
[more details].
-
Added methods allocated, position1 to generic vector classes
[more details].
-
Added method allocated to the class vec_GF2
[more details].
-
Added conversion routines from unsigned int/long to int, long, float, and double
[more details].
-
Added routines AddPrec, SubPrec, etc., to the RR
module, and declared the practice of directly assigning to the variable
RR::prec obsolete
[more details].
-
Fixed a number of minor bugs.
2001.07.19: Changes between NTL 5.1a and 5.2
2001.06.08: Changes between NTL 5.0c and 5.1a
Some minor fixes and additions.
Completely backward compatible.
-
Added a routine LatticeSolve() for finding integer
solutions to linear systems of integer equations.
[more details]
-
Modified the stragey used by the LLL() and image()
routines in the LLL package to deal
with linear dependencies.
The new strategy guarantees better worst-case bounds on the
sizes of intermediate values.
I'm not sure if it will have any serious practical impact, though.
-
Added some "partial ISO modes" so that one can use
some of the features of Standard C++,
even if ones compiler does not yet support all of the features.
[more details]
-
Bug fix: routine determnant() in mat_GF2.h
was not visible to the linker because of a typo in mat_GF2.c.
-
Made a "smarter" script for selecting the GetTime()
function.
This fixes an installation problem on Cygwin/Windows 95 platforms.
I hope it doesn't create more problems than it solves, though.
-
Added some extra documentation for installation under
Windows/MS Visual C++.
[more details]
-
Changed some names like c_lip.c to c_lip_impl.h.
This should avoid some potential installation problems.
-
Throw away first 256-bytes of arc4 streams to improve quality of
the pseudo-random number generator.
This may change the precise behavior of some programs.
-
Other minor, internal modifications.
2001.02.19: Changes between NTL 5.0b and 5.0c
Fixed a naming problem in the Windows distribution.
The Unix distribution is unaffected.
2001.02.19: Changes between NTL 5.0a and 5.0b
Fixed a typo in vec_ulong.c that causes a compile error
on some platforms.
2001.02.19: Changes between NTL 4.3a and 5.0a
Changes between NTL 4.2a and 4.3a
This is backward compatible with previous versions.
-
Improved the performance of ZZ_pX arithmetic when using
GMP.
The GMP version is also more space efficient
(the pre-computed tables are much smaller).
These improvements are most marked for very large p (several
thousand bits).
The only thing unsatisfactory about this state of affairs is that
vis a vis the GMP version, the pure
LIP code is asymptotically slower by more than a constant factor,
and is is also less space efficient.
Perhaps I'll get around to rectifying this imbalance someday.
To do this, I need a sub-quadratic division with remainder routine for LIP.
At any rate, the differences only become seriously noticible when
p has more than a few thousand bits.
-
Some other small adjustments here and there.
Changes between NTL 4.1a and 4.2a
This is backward compatible with previous versions.
-
Hacked the big integer code so that NTL uses GMP
(the GNU Multi-Precision library).
This is done in such a way as to get most of the benefits of GMP
with a reasonable amount of effort, and while maintaining complete backward
compatability and minimizing the risk of introducing bugs.
Some arithmetic operations
on some platforms may execute two to three times
faster if using GMP. [more details]
-
Simplified the installation procedure on Unix systems by
providing a simple configuration script so that setting
various configuration variables can be done without
editing the makefile and config.h file.
[more details]
-
Added function GenGermainPrime
to efficiently generate random Germain primes, i.e., primes p
such that 2p+1 is also prime. [more details]
-
Added a function random to generate random quad_floats.
[more details]
-
Added an ifdef in tools.h that allows
one to suppress the declaration of min and max
functions in NTL client programs;
these were causing problems when writing 'Windows applications'.
-
Implemented a faster algorithm for initializing the
ZZ_p auxilliary data structures.
-
Polished up a few other minor things in the code and documentation.
Changes between NTL 4.0a and 4.1a
This is backward compatible with previous versions.
-
Made some changes that should make NTL compile smoothly
using any variation of the C++ language between traditional and
ISO Standard.
These changes do not affect the documented NTL interface or the
behaviour of NTL.
-
Added a flag NTL_STD_CXX in the config.h file.
Setting this flag causes all of NTL to be "wrapped" in namespace NTL,
and that part of the standard library used by NTL is "wrapped"
in namespace std.
This should greatly help with the namespace pollution problem.
Go here for more details.
Changes between NTL 3.9b and 4.0a
This is backward compatible with previous version.
-
Attached the GNU General Public License to NTL.
-
Fixed two bugs:
-
one in ReconstructRational which resulted in a crash on some inputs;
-
one in exp(RR) (and by implication in pow(RR,RR)),
which led to wrong answers on 64-bit machines when computing exp(x)
for x > 2^53.
-
Increased some inconvenient limiting bounds, including a restriction on the
FFT.
Changes between NTL 3.9a and 3.9b
This is a minor revision of 3.9a.
-
Improved time and space efficiency of the HNF routine
(see HNF.txt).
The old version was based on the description in Henri Cohen's book,
which was not really properly optimized.
Changes between NTL 3.8b and 3.9a
This is backward compatible with previous versions.
-
Modified the installation script somewhat, adding
a configuration wizard that sets the flags in
config.h "automagically".
This works for the Unix version only.
-
Improved the xdouble input/output and ascii to xdouble
conversion.
The old version could be a bit flaky when reading/writing
very large numbers.
The new I/O routines also attain better accuracy.
-
Improved conversion routines between xdouble
and ZZ/RR.
-
Improved the RR output routine.
The new version should be more accurate and also
completely platform independent.
-
Added the following routines to the RR package:
{Trunc,Floor,Ceil,Round}ToZZ, round
RoundToPrecision, MakeRR
random
See RR.txt for details.
-
Improved the accuracy of quad_float input/output,
and the accuracy of conversion between quad_float and RR.
-
Made the timing function somewhat more robust.
-
Hacked the Unix installation script so that it works
more smoothly with Cygnus tools under Windows.
-
Fixed a few other, small problems.
Changes between NTL 3.8a and 3.8b
This is a minor revision of 3.8a.
Changes between NTL 3.7a and 3.8a
This is backward compatible with previous versions.
-
Added conversion routines from unsigned int
and unsigned long to
ZZ, RR, xdouble, and quad_float.
-
Added routines GF2XFromBytes and BytesFromGF2X
for conversion between byte vectors and polynomials over GF(2),
along with routines NumBits and NumBytes
for such polynomials.
See GF2X.txt for details.
-
Added a hack in the ZZX factorizer
to exploit polynomials of the form g(x^k).
This can be disabled by setting the variable ZZXFac_PowerHack
to zero.
See ZZXFactoring.txt
for details.
-
Improved the hensel system solver solve1.
See mat_ZZ.txt for details.
-
Changed documentation for RationalReconstruction
to reflect the Wang, Guy, Davenport bounds.
See ZZ.txt for details.
-
Improved the routine GenPrime a bit.
-
Some other small tweaks here and there.
No real bug fixes.
-
Polished the documentation a bit, adding more examples.
Changes between NTL 3.6b and 3.7a
This is backward compatible with previous versions.
-
Added a "rational reconstruction" routine.
See the routine ReconstructRational in ZZ.txt.
-
Added another routine for solving linear systems over ZZ
that is based on Hensel lifting, rather than Chinese Remaindering.
It can be significantly faster in some cases.
See the routine solve1 in mat_ZZ.txt).
-
Some performace tuning, especially CRT and polynomial interpolation code.
-
Various documentation corrections.
-
Added more "overflow checks" here and there to ensure programs crash gracefully
when certain things get too big.
-
Fixed a "benign" bug (i.e., it would never get triggered on any of today's
machines).
-
Removed references to <malloc.h>, which were unnecessary,
non-standard, and caused problems on some platforms.
Changes between NTL 3.6a and 3.6b
Bug fixes.
Changes between NTL 3.5a and 3.6a
This version is backward compatible with 3.5a.
-
A few small bug fixes and performance enhancements.
-
Changes to the ZZX factoring routines that in some
cases yield dramatic performance improvements
(more details).
Changes between NTL 3.1b and 3.5a
Please note. This version is NOT completely backward compatible.
Summary of changes:
-
Improved performance of the "all integer" LLL routine.
-
Put in a better pseudo-random number generator,
and added ZZ/byte array conversions.
-
Improved performance of primality test, and added a
more convenient routine GenPrime.
-
Overloaded NTL's vector placement "new" operator in a different
way to avoid conflicts with standard C++ library.
-
Renamed many macros.
-
Renamed header files.
-
Made some changes to the packaging
the installation procedure.
Renamed Macros.
I renamed many macros defined in NTL header files.
The reason is that I want to minimize namespace pollution.
Someday, NTL will be wrapped in a namespace, and when that happens
the only remaining namespace pollution problems will be caused by macros.
Eliminating all macros from NTL is not feasible.
Instead, all NTL defined macros now begin with the prefix "NTL_",
which reduces the namespace pollution to an ecceptable level.
You will probably not be affected by this, unless you
do some low level hacking using a macro like ZZ_NBITS
(now called NTL_NBITS), or unless you create your
own NTL vectors using a macro like ntl_vector_decl
(now called NTL_vector_decl).
For a complete list of affected names, see names.txt.
Adapting to this name change should be painless, as there is a
program to translate source files from the old naming convention to the new.
The file "newnames.c",
can be compiled as either a C or C++
program.
The program is a "filter" that copies its input to its output,
replacing all the old macro names by the new macro names.
In the WinNTL distribibution, "newnames.c" is called
"newnames.cpp" and is located in the directory
"newnames".
Renamed header files.
The names of header files themeselves pollute another (extra-linguitsic) namespace.
To alleviate this problem, the header files have been renamed.
Instead of
#include "foo.h"
one now should write
#include <NTL/foo.h>
The only exceptions are the old header files "ntl_vector.h",
"ntl_matrix.h", and "ntl_pair.h", which are now called
<NTL/vector.h>, <NTL/matrix.h>, and
<NTL/pair.h>.
Installation procedure.
Now all
NTL flags like NTL_LONG_LONG, NTL_AVOID_FLOAT, etc., can now be set
by editing the special file "include/NTL/config.h".
See details in that file.
The reason for this change is that this allows all of these settings
to be made when NTL is configured and built.
Clients of NTL will then automatically use consistent settings.
One should not set these flags on the compiler command line as previously.
Pentium/Linux people should no longer have to worry
about the NTL_X86_FIX flag. NTL now psychically deduces
the "right thing to do", although if its psychic abilities fail,
you can override it with flags in "include/NTL/config.h".
The "packaging" in the Unix distribution is slightly
different, but hopefully nicer.
Among other things, the tar file now unpacks into a sub-directory of the current directory.
See the unix installation section
for more details.
The Windows zip file now also
unpacks into sub-directory.
My apologies.
Although these changes are minor, they will cause some NTL
users some inconvenience.
I apologize for this.
I really, really hope there are no more changes like this
(see my roadmap of NTL's future).
Changes between NTL 3.1a and 3.1b
Defined functions div(GF2X,GF2X,GF2) and div(GF2X,GF2X,long),
which had not been defined in earlier versions.
Affected file: GF2X.c.
Most programs never use this, and most linkers do not complain
if these are missing (but some do).
Changes between NTL 3.0f and 3.1a
This version is backward compatible with previous versions.
-
Added floating point LLL routines based on Givens rotations,
instead of classical Gramm-Schmidt orthogonalization.
This is a more stable, but somewhat slower, method.
See LLL.txt for details.
-
Added support for irreducible trinomials and pentanomials
over GF(2). The GF2XModulus routines,
and by extension, the GF2E routines,
now exploit moduli of this special form.
The new routine BuildSparseIrred in GF2XFactoring
builds irreducibles of this form.
-
Also implemented a faster modular inversion routine
for GF2X, and improved the performance of ZZ_pX
multiplication for small degree polynomials.
Changes between NTL 3.0e and 3.0f
Changes between NTL 3.0 and 3.0e
Changes between NTL 2.0 and 3.0
-
Added functionality:
-
Added classes vec_GF2 and mat_GF2 for fast linear algebra over GF(2).
-
Added classes ZZ_pE, ZZ_pEX, zz_pE, zz_pEX, supporting polynomial
arithmetic over extension rings/fields over prime fields.
-
Added John Abbott's pruning heuristic to the ZZX factoring routine.
-
Speeded up multiplication in zz_pX for small p (this also helps
the ZZX factoring routine).
-
Added some some transcendental functions (e.g., exp, log, pi) to RR.
-
Added verbose mode and pruning to the XD and RR variants of LLL.
-
Improved programming interface:
with this version, I've taken an the opportunity to
give the programming interface a "professional facelift".
In previous releases, I've tried to maintain backward compatability
as much as possible, but to make the badly needed improvements
to the interface that I've made with this release, this was not
possible.
NTL 3.0 is not backward compatable with NTL 2.0.
I apologize to NTL users for this, but it is a bit of painful
medicine that should only be necessary to take just this one time
(but then as a C++ programmer, you must already
be used to suffering ;-).
Just about all of the incompatabilities are detectable by the compiler.
See below for a detailed list of the changes and
some tips on making the transition.
The new interface is much more enjoyable to work with,
and I don't foresee any changes to the interace in the future.
Here is a broad overview of the changes:
Compatibility
Here is a detailed list of the changes to the programming
interface.
-
The names of the classes
BB, BB_p, BB_pX
have been changed to
GF2X, GF2E, GF2EX
-
There is also a class GF2 to represent GF(2).
Many of the functions relating to BB, BB_p, BB_pX
had argument and return-value types of type long
that are now of the more appropriate type GF2.
This change was needed so that the interface would be consistent
with that of the new classes
ZZ_pE, ZZ_pEX, zz_pE, zz_pEX.
-
The explicit conversion operator from GF2X
(the new BB) to GF2EX (the new BB_pX)
has different semantics: it now performs a coefficient lift,
instead of creating a constant polynomial.
-
The conversion operator "<<" has been retired.
Now instead of
x << a;
one writes
conv(x, a);
Operator "<<" is now used for shift operations.
-
Every conversion routine now has a corresponding functional version
which has the name to_T, where T is the result type.
These new names replace old names that were less consistent.
So instead of
x = Long(a);
one writes
x = to_long(a);
-
The names of the routines
ZZ_pInit, zz_pInit, zz_pFFTInit, GF2EInit
have been changed to
zz_p::init, zz_p::init, zz_p::FFTInit, GF2E::init
-
The names of the routines
and, or, xor
for class ZZ have
changed to
bit_and, bit_or, bit_xor,
because the new C++
standard defines these as reserved words.
-
The function LowBits for ZZ is now called trunc.
-
Polynomial inversion mod X^n has changed from inv
to InvTrunc.
-
Modular trace, norm, minimum polynomial and characteristic
polynomial have changed from
trace, norm, MinPoly, IrredPoly, CharPoly
to
TraceMod, NormMod, MinPolyMod, IrredPolyMod, CharPolyMod
-
For the class ZZX, the functions
DivRem, div, rem, /, %, /=, %=
have new semantics when dividing by non-monic polynomials.
The old semantics are provided by new routines
PseudoDivRem, PseudoDiv, PseudoRem.
-
The UpdateMap routines have slightly different semantics:
in versions < 3.0, the output always had length n;
now high-order zeroes are stripped.
-
The classes ZZ_pBak, zz_pBak, etc.,
have just slightly different semantics; I can't imagine
any reasonable program detecting a difference.
-
The assignment operator and copy constructor for the class RR
have different semantics: they now produce exact copies, instead
of rounding to current precision.
-
All of the NTL compiler flags now start with NTL_
to avoid name space problems.
-
All of the files "zz_p.h", vec_zz_p.h", etc., have been eliminated.
Use instead the names "lzz_p.h", "vec_lzz_p.h", etc.
Tips on making the transition
-
Apply this sed script to make
most of the necessary syntactic changes.
-
Re-compile old NTL programs with the flag
-DNTL_TRANSITION
See flags.txt for details on how
this will help your compiler detect remaining incompatabilities.
In particular, any uses of operator <<
in its old role as a conversion operator will cause the compiler
to raise an error.
You can then convert all of these to the new notation.
Changes between NTL 1.7 and 2.0
-
Implementation of classes BB (polynomials over GF(2))
and BB_pX (polynomials over GF(2^n)).
-
A more consistent and natural interface, including arithmetic operators
and a disciplined use of automatic conversion.
So now one can write
x = a * b + c;
instead of
mul(x, a, b);
add(x, x, c);
as one must in older versions of NTL.
The operator notation leads to somewhat less efficient code,
and one can always use the old notation in situations
where efficiency is critical.
Despite the new programming interface,
care has been taken to ensure backward compitability;
pre-existing programs that use NTL should still work.
-
Windows port.
-
Added compile-time flag that allows one to exploit
"long long" data type if it exists (this especially helps on Pentium/Linux
platforms).
-
Added compile-time flag to get better quad_float code on
Pentium/Linux platforms.
-
A few bug fixes and performance tuning.
Changes between NTL 1.5 and NTL 1.7
-
Incorporation of Keith Briggs' quadratic precision package.
-
Much faster and more robust lattice basis reduction,
including Schnorr-Horner "volume heuristic" for Block Korkin
Zolotarev reductions, and a new quadratic precision LLL variant
that is much more robust.
-
A few bug fixes.
Changes between NTL 1.0 and NTL 1.5
-
Implementation of Schnorr-Euchner algorithms for
lattice basis reduction, including deep insertions and
block Korkin Zolotarev reduction.
These are significantly faster than the LLL algorithm
in NTL 1.0.
-
Implementation of arbitrary-precision floating point.
-
Implementation of double precision with extended exponent range,
which is useful for lattice basis reduction when the coefficients
are large.
-
Faster polynomial multiplication over the integers,
incorporating the Schoenhagge-Strassen method.
-
Compilation flags that increase performance on machines
with poor floating-point performance.
-
Sundry performance tuning and a few bug fixes.