NTL vs GMP
deltatrinity at hotmail.com
Mon Jan 24 14:24:49 CET 2005
I used both GMP and NTL.
Both libraries are arbitrary precision number library. However, there are
strength and weekness to both. It just depend on your application.
GMP is designed to be fast. It can be highly optimized for specific target
processor. The core is written in assembly. It contain some number theory
functions too, like Legendre, GCD, ... If can work on 3 different kind of
numbers, which are integer, real numbers (float) and rationals (like 21/8).
Though, the weakness is in the availability (or rather, the lack of it) of
the real numbers functions, like cos, sin, log, ln, exp, ... Though, there
is an extention, called mpfr, which can be built with GMP and support those
functions. Mpfr is maintained by third-party. GMP is written if 'c'
(appart from the assembly core). It's interface is 'c'. There are c++
wrappers, but it's pretty just that, a wrapper.
NTL is slower than GMP. It's written solely in c++ (no assembly). It's
interface is c++. It is easier to use in a c++ environment. Though, being
written in c++, it is much slower that GMP. However, it can be compiled
using GMP as it's core, making it much faster. Still, being c++, with all
the class initialization and destruction, it is still slower than pure GMP.
Where in GMP you can initialize variables globally, the one that you use
often, in critical loops, in NTL, there's a lot of internal code that
construct and destroy classes, making it slower.
However, NTL is not built around absolute speed, but rather as a number
theory package (as the acronym imply). It contain very powerfull number
theory functions, like polynomial arithmetics, arythmetics under modulo, ...
This is not available in GMP, which was not created with the idea of being
number theoric, but rather a very fast library.
Both GMP and NTL are designed to be portable across multiple platforms.
Hope this help.
>From: "jojo 29" <jojo29118 at hotmail.com>
>To: gmp-discuss at swox.com
>Subject: NTL vs GMP
>Date: Sun, 23 Jan 2005 16:08:35 +0000
>gmp-discuss mailing list
>gmp-discuss at swox.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gmp-discuss