[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.10 Demonstration programs
The ‘demos’ subdirectory has some sample programs using GMP. These aren’t built or installed, but there’s a ‘Makefile’ with rules for them. For instance,
make pexpr ./pexpr 68^975+10
The following programs are provided
- ‘pexpr’ is an expression evaluator, the program used on the GMP web page.
-
The ‘calc’ subdirectory has a similar but simpler evaluator using
lex
andyacc
. - The ‘expr’ subdirectory is yet another expression evaluator, a library designed for ease of use within a C program. See ‘demos/expr/README’ for more information.
- ‘factorize’ is a Pollard-Rho factorization program.
-
‘isprime’ is a command-line interface to the
mpz_probab_prime_p
function. - ‘primes’ counts or lists primes in an interval, using a sieve.
-
‘qcn’ is an example use of
mpz_kronecker_ui
to estimate quadratic class numbers. - The ‘perl’ subdirectory is a comprehensive perl interface to GMP. See ‘demos/perl/INSTALL’ for more information. Documentation is in POD format in ‘demos/perl/GMP.pm’.
As an aside, consideration has been given at various times to some sort of expression evaluation within the main GMP library. Going beyond something minimal quickly leads to matters like user-defined functions, looping, fixnums for control variables, etc, which are considered outside the scope of GMP (much closer to language interpreters or compilers, See section Language Bindings.) Something simple for program input convenience may yet be a possibility, a combination of the ‘expr’ demo and the ‘pexpr’ tree back-end perhaps. But for now the above evaluators are offered as illustrations.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 31, 2014 using texi2html 5.0.