Browse Source
* Removed LiDIA interface since that is now outdated (namespace cln)
* Removed LiDIA interface since that is now outdated (namespace cln)
and maintained elsewhere.master
Richard Kreckel
24 years ago
13 changed files with 0 additions and 1901 deletions
-
321lidia-interface/LiDIA-patch1
-
27lidia-interface/LiDIA-patch2
-
57lidia-interface/README
-
236lidia-interface/TAR-FILE-LIST
-
BINlidia-interface/bigint.o.i386-linux
-
104lidia-interface/bigint.o.needs
-
62lidia-interface/bigint.o.undef
-
784lidia-interface/src/interfaces/integers/cln/bigint.c
-
40lidia-interface/src/interfaces/integers/cln/bigint_def.h
-
69lidia-interface/src/interfaces/integers/cln/makefile
-
17lidia-interface/src/kernel/integers/cln/README
-
6lidia-interface/src/kernel/integers/cln/cln/README.LiDIA
-
178lidia-interface/src/kernel/integers/cln/makefile
@ -1,321 +0,0 @@ |
|||
diff -r -c3 LiDIA-1.3.orig/Readme LiDIA-1.3/Readme |
|||
*** LiDIA-1.3.orig/Readme Wed Feb 5 21:51:10 1997 |
|||
--- LiDIA-1.3/Readme Sun Jan 25 00:44:29 1998 |
|||
*************** |
|||
*** 157,164 **** |
|||
o mpqs: large prime variant for quadratic sieve in the class |
|||
rational_factorization. |
|||
|
|||
! o You can now choose gmp as the integer arithmetic of the kernel. |
|||
! This LiDIA - release contains gmp version 2.0.2. |
|||
|
|||
|
|||
|
|||
--- 157,164 ---- |
|||
o mpqs: large prime variant for quadratic sieve in the class |
|||
rational_factorization. |
|||
|
|||
! o You can now choose gmp or cln as the integer arithmetic of the kernel. |
|||
! This LiDIA release contains gmp version 2.0.2 and cln version 1997-09-06. |
|||
|
|||
|
|||
|
|||
diff -r -c3 LiDIA-1.3.orig/config/CONFIG.in LiDIA-1.3/config/CONFIG.in |
|||
*** LiDIA-1.3.orig/config/CONFIG.in Wed Feb 5 12:02:16 1997 |
|||
--- LiDIA-1.3/config/CONFIG.in Sat Jan 24 18:42:57 1998 |
|||
*************** |
|||
*** 42,48 **** |
|||
# |
|||
# The Kernel And The Interface To Be compiled |
|||
# |
|||
! # Possible Integer Interfaces Are: libI, lip, gmp |
|||
# |
|||
# Possible Memory Managers Are: malloc, dentzer, boehm, |
|||
# default (no manager) |
|||
--- 42,48 ---- |
|||
# |
|||
# The Kernel And The Interface To Be compiled |
|||
# |
|||
! # Possible Integer Interfaces Are: libI, lip, gmp, cln |
|||
# |
|||
# Possible Memory Managers Are: malloc, dentzer, boehm, |
|||
# default (no manager) |
|||
*************** |
|||
*** 149,155 **** |
|||
LIDIA_INSTALL_DAT = ${LIDIA_INSTALL_DIR}/lib |
|||
|
|||
# |
|||
! # OS/2 Compatability Section |
|||
# |
|||
|
|||
CXX-off = |
|||
--- 149,155 ---- |
|||
LIDIA_INSTALL_DAT = ${LIDIA_INSTALL_DIR}/lib |
|||
|
|||
# |
|||
! # OS/2 Compatibility Section |
|||
# |
|||
|
|||
CXX-off = |
|||
*************** |
|||
*** 166,171 **** |
|||
--- 166,172 ---- |
|||
# Make Command Macros |
|||
# |
|||
# AR -- the archiver command |
|||
+ # ARX -- the archiver extract command |
|||
# RM -- command used to remove files |
|||
# RMR -- command used to remove directories |
|||
# CP -- command used to copy files |
|||
*************** |
|||
*** 178,183 **** |
|||
--- 179,185 ---- |
|||
# |
|||
|
|||
AR = @AR@ |
|||
+ ARX = ar x |
|||
RM = @RM@ |
|||
RMR = @RMR@ |
|||
CP = @CP@ |
|||
diff -r -c3 LiDIA-1.3.orig/config/CONFIG.os2 LiDIA-1.3/config/CONFIG.os2 |
|||
*** LiDIA-1.3.orig/config/CONFIG.os2 Tue Jan 21 14:55:44 1997 |
|||
--- LiDIA-1.3/config/CONFIG.os2 Sat Jan 24 18:43:28 1998 |
|||
*************** |
|||
*** 137,142 **** |
|||
--- 137,143 ---- |
|||
# Make Command Macros |
|||
# |
|||
# AR -- the archiver command |
|||
+ # ARX -- the archiver extract command |
|||
# RM -- command used to remove files |
|||
# RMR -- command used to remove directories |
|||
# CP -- command used to copy files |
|||
*************** |
|||
*** 147,152 **** |
|||
--- 148,154 ---- |
|||
# TOUCH -- command used to create an empry file |
|||
# |
|||
AR = ar ru |
|||
+ ARX = ar x |
|||
RM = del /N |
|||
RMR = del /N |
|||
CP = xcopy |
|||
diff -r -c3 LiDIA-1.3.orig/config/bin/integer-sh LiDIA-1.3/config/bin/integer-sh |
|||
*** LiDIA-1.3.orig/config/bin/integer-sh Tue Oct 22 22:25:57 1996 |
|||
--- LiDIA-1.3/config/bin/integer-sh Sun Jan 25 00:47:13 1998 |
|||
*************** |
|||
*** 7,15 **** |
|||
|
|||
echo " " |
|||
echo "You will now be asked for the integer arithmetic that " |
|||
! echo "will be used in the kernel of LiDIA (gmp, libI, lip)." |
|||
echo " " |
|||
echo "gmp - written by Torbjorn Granlund" |
|||
echo "libI - written by Ralf Dentzer" |
|||
echo "lip - written by Arjen Lenstra" |
|||
echo " " |
|||
--- 7,16 ---- |
|||
|
|||
echo " " |
|||
echo "You will now be asked for the integer arithmetic that " |
|||
! echo "will be used in the kernel of LiDIA (gmp, cln, libI, lip)." |
|||
echo " " |
|||
echo "gmp - written by Torbjorn Granlund" |
|||
+ echo "cln - written by Bruno Haible (based on gmp)" |
|||
echo "libI - written by Ralf Dentzer" |
|||
echo "lip - written by Arjen Lenstra" |
|||
echo " " |
|||
*************** |
|||
*** 23,35 **** |
|||
do |
|||
echo -n "integer arithmetic ? [$INTEGERS] : " |
|||
read ANSWER |
|||
! if test "$ANSWER" = "gmp" -o "$ANSWER" = "lip" -o "$ANSWER" = "libI" ; then |
|||
INTEGERS=$ANSWER |
|||
SUCCESS=y |
|||
elif test "$ANSWER" = "" ; then |
|||
SUCCESS=y |
|||
else |
|||
! echo "Please choose gmp, libI, or lip." |
|||
INTEGERS="libI" |
|||
fi |
|||
done |
|||
--- 24,36 ---- |
|||
do |
|||
echo -n "integer arithmetic ? [$INTEGERS] : " |
|||
read ANSWER |
|||
! if test "$ANSWER" = "gmp" -o "$ANSWER" = "cln" -o "$ANSWER" = "lip" -o "$ANSWER" = "libI" ; then |
|||
INTEGERS=$ANSWER |
|||
SUCCESS=y |
|||
elif test "$ANSWER" = "" ; then |
|||
SUCCESS=y |
|||
else |
|||
! echo "Please choose gmp, cln, libI, or lip." |
|||
INTEGERS="libI" |
|||
fi |
|||
done |
|||
diff -r -c3 LiDIA-1.3.orig/doc/manual/FIG/lidia_model.fig LiDIA-1.3/doc/manual/FIG/lidia_model.fig |
|||
*** LiDIA-1.3.orig/doc/manual/FIG/lidia_model.fig Tue Feb 27 11:57:01 1996 |
|||
--- LiDIA-1.3/doc/manual/FIG/lidia_model.fig Sun Jan 25 00:48:58 1998 |
|||
*************** |
|||
*** 55,61 **** |
|||
4 0 -1 0 0 2 16 0.0000000 4 225 2085 1200 2850 parameterized classes\001 |
|||
4 0 -1 0 0 2 16 0.0000000 4 225 1365 1200 4035 simple classes\001 |
|||
4 0 -1 0 0 2 16 0.0000000 4 165 930 1200 5220 interfaces\001 |
|||
! 4 2 -1 0 0 12 12 0.0000000 4 180 2100 9000 6375 (libI, lip, gmp, mm)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 1365 9000 5175 (bigint, gmm)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 2940 9000 3975 (bigrational, bigfloat, ...)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 3675 9000 2775 (vector, matrix, power series, ...)\001 |
|||
--- 55,61 ---- |
|||
4 0 -1 0 0 2 16 0.0000000 4 225 2085 1200 2850 parameterized classes\001 |
|||
4 0 -1 0 0 2 16 0.0000000 4 225 1365 1200 4035 simple classes\001 |
|||
4 0 -1 0 0 2 16 0.0000000 4 165 930 1200 5220 interfaces\001 |
|||
! 4 2 -1 0 0 12 12 0.0000000 4 180 2100 9000 6375 (libI, lip, gmp, cln, mm)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 1365 9000 5175 (bigint, gmm)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 2940 9000 3975 (bigrational, bigfloat, ...)\001 |
|||
4 2 -1 0 0 12 12 0.0000000 4 180 3675 9000 2775 (vector, matrix, power series, ...)\001 |
|||
diff -r -c3 LiDIA-1.3.orig/doc/manual/bibliography.tex LiDIA-1.3/doc/manual/bibliography.tex |
|||
*** LiDIA-1.3.orig/doc/manual/bibliography.tex Fri Jan 24 13:22:31 1997 |
|||
--- LiDIA-1.3/doc/manual/bibliography.tex Sun Jan 25 00:55:48 1998 |
|||
*************** |
|||
*** 151,156 **** |
|||
--- 151,159 ---- |
|||
\IT{A rigorous subexponential algorithm for computation of class groups}, |
|||
Tech. report, IBM Research Report, San Jose, CA, 1989. |
|||
|
|||
+ \bibitem{haible} B. Haible: |
|||
+ \IT{CLN, a Class Library for Numbers}, 1997. |
|||
+ |
|||
\bibitem{HLConF} G.H. Hardy and J.E. Littlewood: |
|||
\IT{\em Partitio numerorum {III}: On the expression of a number as a sum of |
|||
primes}, Acta Math. {\bf 44} (1923), 1--70. |
|||
diff -r -c3 LiDIA-1.3.orig/doc/manual/installing.tex LiDIA-1.3/doc/manual/installing.tex |
|||
*** LiDIA-1.3.orig/doc/manual/installing.tex Wed Feb 5 17:33:40 1997 |
|||
--- LiDIA-1.3/doc/manual/installing.tex Sun Jan 25 00:58:30 1998 |
|||
*************** |
|||
*** 309,316 **** |
|||
of the kernel. |
|||
\item BIGINT\\ |
|||
This is used to decide which integer arithmetic is to be compiled with |
|||
! {\LiDIA}. At the moment we support three possibilities: \TT{gmp}, \TT{libI}, |
|||
! and \TT{lip}. We suggest that you use the \TT{gmp} with the GNU g++ |
|||
compiler and \TT{libI} otherwise. Use \TT{lip}, if you have chosen |
|||
\TT{libI} during the configuration process and TARGET has been set |
|||
to c by configure. In this case, no \TT{libI} assembler code is |
|||
--- 309,316 ---- |
|||
of the kernel. |
|||
\item BIGINT\\ |
|||
This is used to decide which integer arithmetic is to be compiled with |
|||
! {\LiDIA}. At the moment we support four possibilities: \TT{gmp}, \TT{cln}, |
|||
! TT{libI}, and \TT{lip}. We suggest that you use the \TT{gmp} with the GNU g++ |
|||
compiler and \TT{libI} otherwise. Use \TT{lip}, if you have chosen |
|||
\TT{libI} during the configuration process and TARGET has been set |
|||
to c by configure. In this case, no \TT{libI} assembler code is |
|||
diff -r -c3 LiDIA-1.3.orig/doc/manual/overview.tex LiDIA-1.3/doc/manual/overview.tex |
|||
*** LiDIA-1.3.orig/doc/manual/overview.tex Wed Jan 29 19:32:32 1997 |
|||
--- LiDIA-1.3/doc/manual/overview.tex Sun Jan 25 00:57:36 1998 |
|||
*************** |
|||
*** 19,24 **** |
|||
--- 19,25 ---- |
|||
\newcommand{\libi}{{\bf libI}} |
|||
\newcommand{\gmp}{{\bf GNU gmp}} |
|||
\newcommand{\lip}{{\bf lip}} |
|||
+ \newcommand{\cln}{{\bf cln}} |
|||
\newcommand{\bigint}{{\bf bigint}} |
|||
|
|||
|
|||
*************** |
|||
*** 70,76 **** |
|||
It is a serious problem to decide which multiprecision integer package |
|||
and which memory manager should be used in \LiDIA. There are |
|||
competing multiprecision integer packages, for example the |
|||
! \gmp\ package \cite{gnump}, the \libi\ package \cite{dentzer} and |
|||
the \lip\ package \cite{lenstra}. Some of those packages are more |
|||
efficient on one architecture and some on others. Also, new |
|||
architectures lead very fast to new multiprecision packages. We decided |
|||
--- 71,78 ---- |
|||
It is a serious problem to decide which multiprecision integer package |
|||
and which memory manager should be used in \LiDIA. There are |
|||
competing multiprecision integer packages, for example the |
|||
! \gmp\ package \cite{gnump}, the \cln\ package \cite{haible}, |
|||
! the \libi\ package \cite{dentzer} and |
|||
the \lip\ package \cite{lenstra}. Some of those packages are more |
|||
efficient on one architecture and some on others. Also, new |
|||
architectures lead very fast to new multiprecision packages. We decided |
|||
*************** |
|||
*** 112,120 **** |
|||
whole functionality of the interface can be used in the kernel. |
|||
Currently, we support the multiprecision integer packages |
|||
\libi\ \cite{dentzer}, Arjen Lenstra's \Index{lip} package \cite{lenstra} |
|||
! (available by anonymous ftp via \TT{flash.bellcore.com:/pub/lenstra}) and GNU's |
|||
\IndexSUBTT{GNU}{gmp} arithmetic \cite{gnump} (available by anonymous |
|||
! ftp via \TT{prep.ai.mit.edu}). |
|||
|
|||
The second \LiDIA\ level is the \BF{interface} through which {\CPP} |
|||
applications on higher levels have access to the kernel. By that |
|||
--- 114,123 ---- |
|||
whole functionality of the interface can be used in the kernel. |
|||
Currently, we support the multiprecision integer packages |
|||
\libi\ \cite{dentzer}, Arjen Lenstra's \Index{lip} package \cite{lenstra} |
|||
! (available by anonymous ftp via \TT{flash.bellcore.com:/pub/lenstra}), GNU's |
|||
\IndexSUBTT{GNU}{gmp} arithmetic \cite{gnump} (available by anonymous |
|||
! ftp via \TT{prep.ai.mit.edu}), and CLN (available by anonymous ftp from |
|||
! \TT{ma2s2.mathematik.uni-karlsruhe.de:/pub/gnu}). |
|||
|
|||
The second \LiDIA\ level is the \BF{interface} through which {\CPP} |
|||
applications on higher levels have access to the kernel. By that |
|||
diff -r -c3 LiDIA-1.3.orig/include/LiDIA/bigint.h LiDIA-1.3/include/LiDIA/bigint.h |
|||
*** LiDIA-1.3.orig/include/LiDIA/bigint.h Tue Oct 29 17:47:17 1996 |
|||
--- LiDIA-1.3/include/LiDIA/bigint.h Sat Jan 24 20:29:16 1998 |
|||
*************** |
|||
*** 51,56 **** |
|||
--- 51,57 ---- |
|||
bigint(long l); |
|||
bigint(unsigned long ul); |
|||
bigint(const bigint & a); |
|||
+ bigint(const integer_type_name & II) : I (II) {} // cln needs this |
|||
~bigint(); |
|||
|
|||
/** |
|||
Only in LiDIA-1.3/src/interfaces/integers: cln |
|||
diff -r -c3 LiDIA-1.3.orig/src/interfaces/integers/gmp/bigint.c LiDIA-1.3/src/interfaces/integers/gmp/bigint.c |
|||
*** LiDIA-1.3.orig/src/interfaces/integers/gmp/bigint.c Fri Jan 10 18:19:00 1997 |
|||
--- LiDIA-1.3/src/interfaces/integers/gmp/bigint.c Sat Jan 24 17:41:29 1998 |
|||
*************** |
|||
*** 610,616 **** |
|||
|
|||
void invert(bigint & a, const bigint & b) |
|||
{ |
|||
! if ((a.I._mp_size == 1 || a.I._mp_size == -1) && a.I._mp_d[0] == 1) |
|||
mpz_set(&a.I, &b.I); |
|||
else |
|||
lidia_error_handler("bigint", "invert::inverting of a non-unit."); |
|||
--- 610,616 ---- |
|||
|
|||
void invert(bigint & a, const bigint & b) |
|||
{ |
|||
! if ((b.I._mp_size == 1 || b.I._mp_size == -1) && b.I._mp_d[0] == 1) |
|||
mpz_set(&a.I, &b.I); |
|||
else |
|||
lidia_error_handler("bigint", "invert::inverting of a non-unit."); |
|||
Only in LiDIA-1.3/src/kernel/integers: cln |
|||
diff -r -c3 LiDIA-1.3.orig/src/simple_classes/factorization/mpqs.c LiDIA-1.3/src/simple_classes/factorization/mpqs.c |
|||
*** LiDIA-1.3.orig/src/simple_classes/factorization/mpqs.c Tue Jan 28 14:00:36 1997 |
|||
--- LiDIA-1.3/src/simple_classes/factorization/mpqs.c Sat Jan 24 17:45:17 1998 |
|||
*************** |
|||
*** 17,23 **** |
|||
//extern "C" int system(char*); |
|||
#endif |
|||
|
|||
! #if !defined(__GNUG__) |
|||
#include <signal.h> |
|||
#else |
|||
#define SIGHUP 1 /* hangup */ |
|||
--- 17,23 ---- |
|||
//extern "C" int system(char*); |
|||
#endif |
|||
|
|||
! #if defined(__linux__) || !defined(__GNUG__) |
|||
#include <signal.h> |
|||
#else |
|||
#define SIGHUP 1 /* hangup */ |
@ -1,27 +0,0 @@ |
|||
diff -r -c3 LiDIA-1.3/config/CONFIG LiDIA/config/CONFIG |
|||
*** LiDIA-1.3/config/CONFIG Mon Apr 15 15:00:47 1996 |
|||
--- LiDIA/config/CONFIG Sun Nov 17 18:43:41 1996 |
|||
*************** |
|||
*** 49,57 **** |
|||
# default (no manager) |
|||
# |
|||
|
|||
! BIGINT = libI |
|||
! GMM = default |
|||
|
|||
|
|||
# |
|||
# The Compiler/Assembler/Linker Settings |
|||
--- 49,60 ---- |
|||
# default (no manager) |
|||
# |
|||
|
|||
! BIGINT = cln |
|||
! GMM = default |
|||
|
|||
+ CLN_DIR = /home/bruno/cln |
|||
+ CLN_TARGETDIR = /home/bruno/cln/linuxelf |
|||
+ CLN_INCLUDES = -I$(CLN_TARGETDIR)/include -I$(CLN_DIR)/include -I$(CLN_DIR)/src/base -I$(CLN_DIR)/src/float -I$(CLN_DIR)/src/float/dfloat -I$(CLN_DIR)/src/io |
|||
|
|||
# |
|||
# The Compiler/Assembler/Linker Settings |
@ -1,57 +0,0 @@ |
|||
This directory contains an interface to the LiDIA library, version 1.3.1. |
|||
It is already contained in LiDIA-1.3.1 and LiDIA-1.4a1, and is reproduced |
|||
here only as a sample for the use of CLN. |
|||
|
|||
LiDIA is available from |
|||
ftp://ftp.informatik.th-darmstadt.de/pub/TI/systems/LiDIA |
|||
(The LiDIA group has also a nice Web page.) |
|||
|
|||
LiDIA has an abstract interface to the underlying long integer implementation. |
|||
Using CLN instead of the default libI, lip or gmp has the following |
|||
advantages: |
|||
|
|||
- Maximum speed on all CPUs, since CLN is based on the highly |
|||
optimized gmp-2.0.2. |
|||
|
|||
- Very large integers profit from CLN's Schönhage-Strassen FFT multiplication |
|||
(asymptotic bit complexity: O(N log N log log N)). |
|||
|
|||
- Copying integers is fast: no copying is actually involved, only a |
|||
reference count is manipulated. |
|||
|
|||
- Small integers (absolute value < 2^29) are represented immediately, |
|||
thus no memory allocation/deallocation is involved when dealing with |
|||
small integers. |
|||
|
|||
CLN does all this automatically. |
|||
|
|||
INSTALLATION |
|||
------------ |
|||
|
|||
1. Build CLN. |
|||
|
|||
2. Apply the first patch to LiDIA: |
|||
$ cd .../LiDIA |
|||
$ patch -p1 < .../cln/lidia-interface/LiDIA-patch1 |
|||
|
|||
3. Configure LiDIA as described in its manual. |
|||
|
|||
4. Apply the second patch to LiDIA: |
|||
$ cd .../LiDIA |
|||
$ patch -p1 < .../cln/lidia-interface/LiDIA-patch2 |
|||
You may have to do this by hand, if the patch fails. |
|||
|
|||
5. Make two symbolic links |
|||
$ ln -s .../cln/lidia-interface/interfaces/integers/cln \ |
|||
.../LiDIA/src/interfaces/integers/cln |
|||
$ ln -s .../cln/BUILDDIR/src .../LiDIA/src/kernel/integers/cln |
|||
where .../cln/BUILDDIR is the directory in which you have built |
|||
cln (i.e. there is a file .../cln/BUILDDIR/src/libcln.a). |
|||
|
|||
6. Modify the definitions of the variables CLN_DIR and CLN_TARGETDIR in |
|||
the file .../LiDIA/config/CONFIG : |
|||
CLN_DIR must point to .../cln, |
|||
CLN_TARGETDIR must point to .../cln/BUILDDIR. |
|||
|
|||
7. Build LiDIA as described in its manual. |
|||
|
@ -1,236 +0,0 @@ |
|||
cln/COPYING |
|||
cln/INSTALL |
|||
cln/INSTALL.generic |
|||
cln/Makefile.in |
|||
cln/README |
|||
cln/configure |
|||
cln/autoconf/config.guess |
|||
cln/autoconf/config.sub |
|||
cln/autoconf/floatparam.c |
|||
cln/autoconf/intparam.c |
|||
cln/autoconf/ltconfig |
|||
cln/autoconf/ltmain.sh |
|||
cln/benchmarks/Makefile.in |
|||
cln/doc/Makefile.in |
|||
cln/examples/Makefile.in |
|||
cln/gmp/ |
|||
cln/include/cl_abort.h |
|||
cln/include/cl_complex_class.h |
|||
cln/include/cl_config.h.in |
|||
cln/include/cl_dfloat.h |
|||
cln/include/cl_dfloat_class.h |
|||
cln/include/cl_ffloat.h |
|||
cln/include/cl_ffloat_class.h |
|||
cln/include/cl_float.h |
|||
cln/include/cl_floatformat.h |
|||
cln/include/cl_float_class.h |
|||
cln/include/cl_input.h |
|||
cln/include/cl_integer.h |
|||
cln/include/cl_integer_class.h |
|||
cln/include/cl_integer_io.h |
|||
cln/include/cl_io.h |
|||
cln/include/cl_lfloat.h |
|||
cln/include/cl_lfloat_class.h |
|||
cln/include/cl_malloc.h |
|||
cln/include/cl_modules.h |
|||
cln/include/cl_number.h |
|||
cln/include/cl_number_io.h |
|||
cln/include/cl_object.h |
|||
cln/include/cl_output.h |
|||
cln/include/cl_random.h |
|||
cln/include/cl_rational_class.h |
|||
cln/include/cl_real_class.h |
|||
cln/include/cl_sfloat_class.h |
|||
cln/include/cl_string.h |
|||
cln/include/cl_types.h |
|||
cln/src/Makefile.in |
|||
cln/src/Makeflags |
|||
cln/src/base/Makeflags |
|||
cln/src/base/cl_N.h |
|||
cln/src/base/cl_N_err_d0.cc |
|||
cln/src/base/cl_alloca.cc |
|||
cln/src/base/cl_alloca.h |
|||
cln/src/base/cl_base_config.h.in |
|||
cln/src/base/cl_free.cc |
|||
cln/src/base/cl_gmpconfig.h.in |
|||
cln/src/base/cl_low.h |
|||
cln/src/base/cl_macros.h |
|||
cln/src/base/cl_malloc.cc |
|||
cln/src/base/cl_notreached.cc |
|||
cln/src/base/cl_offsetof.h |
|||
cln/src/base/cl_sysdep.h |
|||
cln/src/base/cl_xmacros.h |
|||
cln/src/base/digit/Makeflags |
|||
cln/src/base/digit/cl_D.h |
|||
cln/src/base/digitseq/Makeflags |
|||
cln/src/base/digitseq/cl_DS.h |
|||
cln/src/base/digitseq/cl_DS_div.cc |
|||
cln/src/base/digitseq/cl_DS_endian.h |
|||
cln/src/base/digitseq/cl_DS_mul.cc |
|||
cln/src/base/digitseq/cl_DS_mul_fftm.h |
|||
cln/src/base/digitseq/cl_DS_mul_kara.h |
|||
cln/src/base/digitseq/cl_DS_mul_kara_sqr.h |
|||
cln/src/base/digitseq/cl_DS_random.cc |
|||
cln/src/base/digitseq/cl_DS_recip.cc |
|||
cln/src/base/digitseq/cl_DS_recipsqrt.cc |
|||
cln/src/base/digitseq/cl_DS_sqrt.cc |
|||
cln/src/base/digitseq/cl_asm.h |
|||
cln/src/base/digitseq/cl_asm_.cc |
|||
cln/src/base/digitseq/cl_asm_arm.h |
|||
cln/src/base/digitseq/cl_asm_arm_.cc |
|||
cln/src/base/digitseq/cl_asm_hppa.h |
|||
cln/src/base/digitseq/cl_asm_hppa_.cc |
|||
cln/src/base/digitseq/cl_asm_i386.h |
|||
cln/src/base/digitseq/cl_asm_i386_.cc |
|||
cln/src/base/digitseq/cl_asm_m68k.h |
|||
cln/src/base/digitseq/cl_asm_m68k_.cc |
|||
cln/src/base/digitseq/cl_asm_mips.h |
|||
cln/src/base/digitseq/cl_asm_mips_.cc |
|||
cln/src/base/digitseq/cl_asm_sparc.h |
|||
cln/src/base/digitseq/cl_asm_sparc_.cc |
|||
cln/src/base/digitseq/cl_asm_sparc64.h |
|||
cln/src/base/digitseq/cl_asm_sparc64_.cc |
|||
cln/src/base/input/Makeflags |
|||
cln/src/base/input/cl_read_err_bad.cc |
|||
cln/src/base/input/cl_read_err_junk.cc |
|||
cln/src/base/low/Makeflags |
|||
cln/src/base/low/cl_low_div.cc |
|||
cln/src/base/low/cl_low_mul.cc |
|||
cln/src/base/output/Makeflags |
|||
cln/src/base/output/cl_output_dec.cc |
|||
cln/src/base/output/cl_prin_globals.cc |
|||
cln/src/base/random/Makeflags |
|||
cln/src/base/random/cl_UL_random.cc |
|||
cln/src/base/random/cl_random_def.cc |
|||
cln/src/base/random/cl_random_from.cc |
|||
cln/src/base/random/cl_random_impl.h |
|||
cln/src/base/string/Makeflags |
|||
cln/src/base/string/cl_spushstring.h |
|||
cln/src/base/string/cl_spushstring_push.cc |
|||
cln/src/base/string/cl_sstring.cc |
|||
cln/src/base/string/cl_sstring.h |
|||
cln/src/base/string/cl_st_c2.cc |
|||
cln/src/base/string/cl_st_make1.cc |
|||
cln/src/base/string/cl_st_make2.cc |
|||
cln/src/base/string/cl_st_null.cc |
|||
cln/src/base/string/misc/Makeflags |
|||
cln/src/base/string/misc/cl_st_class.cc |
|||
cln/src/integer/Makeflags |
|||
cln/src/integer/cl_I.h |
|||
cln/src/integer/algebraic/Makeflags |
|||
cln/src/integer/algebraic/cl_I_sqrt.cc |
|||
cln/src/integer/bitwise/Makeflags |
|||
cln/src/integer/bitwise/cl_I_ash.cc |
|||
cln/src/integer/bitwise/cl_I_ash.h |
|||
cln/src/integer/bitwise/cl_I_ash_I.cc |
|||
cln/src/integer/bitwise/cl_I_asherr.cc |
|||
cln/src/integer/bitwise/cl_I_byte.h |
|||
cln/src/integer/bitwise/cl_I_fullbyte.cc |
|||
cln/src/integer/bitwise/cl_I_ilength.cc |
|||
cln/src/integer/bitwise/cl_I_ldb.cc |
|||
cln/src/integer/bitwise/cl_I_ldbx.cc |
|||
cln/src/integer/bitwise/cl_I_log.h |
|||
cln/src/integer/bitwise/cl_I_log_aux.cc |
|||
cln/src/integer/bitwise/cl_I_logand.cc |
|||
cln/src/integer/bitwise/cl_I_logbitp.cc |
|||
cln/src/integer/bitwise/cl_I_logior.cc |
|||
cln/src/integer/bitwise/cl_I_lognot.cc |
|||
cln/src/integer/bitwise/cl_I_logxor.cc |
|||
cln/src/integer/conv/Makeflags |
|||
cln/src/integer/conv/cl_I_digits_need.cc |
|||
cln/src/integer/conv/cl_I_from_DS.cc |
|||
cln/src/integer/conv/cl_I_from_L.cc |
|||
cln/src/integer/conv/cl_I_from_L2.cc |
|||
cln/src/integer/conv/cl_I_from_NDS.cc |
|||
cln/src/integer/conv/cl_I_from_NUDS.cc |
|||
cln/src/integer/conv/cl_I_from_Q.cc |
|||
cln/src/integer/conv/cl_I_from_UDS.cc |
|||
cln/src/integer/conv/cl_I_from_UL.cc |
|||
cln/src/integer/conv/cl_I_from_UQ.cc |
|||
cln/src/integer/conv/cl_I_from_digits.cc |
|||
cln/src/integer/conv/cl_I_to_L.cc |
|||
cln/src/integer/conv/cl_I_to_Q.cc |
|||
cln/src/integer/conv/cl_I_to_UL.cc |
|||
cln/src/integer/conv/cl_I_to_UQ.cc |
|||
cln/src/integer/conv/cl_I_to_digits.cc |
|||
cln/src/integer/division/Makeflags |
|||
cln/src/integer/division/cl_I_floor2.cc |
|||
cln/src/integer/division/cl_I_rem.cc |
|||
cln/src/integer/division/cl_I_trunc1.cc |
|||
cln/src/integer/division/cl_I_trunc2.cc |
|||
cln/src/integer/elem/Makeflags |
|||
cln/src/integer/elem/cl_I_compare.cc |
|||
cln/src/integer/elem/cl_I_div.cc |
|||
cln/src/integer/elem/cl_I_equal.cc |
|||
cln/src/integer/elem/cl_I_minus.cc |
|||
cln/src/integer/elem/cl_I_minus1.cc |
|||
cln/src/integer/elem/cl_I_minusp.cc |
|||
cln/src/integer/elem/cl_I_mul.cc |
|||
cln/src/integer/elem/cl_I_plus.cc |
|||
cln/src/integer/elem/cl_I_plus1.cc |
|||
cln/src/integer/elem/cl_I_square.cc |
|||
cln/src/integer/elem/cl_I_uminus.cc |
|||
cln/src/integer/elem/cl_I_zerop.cc |
|||
cln/src/integer/gcd/Makeflags |
|||
cln/src/integer/gcd/cl_I_gcd.cc |
|||
cln/src/integer/gcd/cl_I_gcd_aux.cc |
|||
cln/src/integer/gcd/cl_I_gcd_aux2.cc |
|||
cln/src/integer/gcd/cl_I_xgcd.cc |
|||
cln/src/integer/gcd/cl_low_gcd.cc |
|||
cln/src/integer/input/Makeflags |
|||
cln/src/integer/input/cl_I_from_string.cc |
|||
cln/src/integer/input/cl_I_read.cc |
|||
cln/src/integer/input/cl_I_readparsed.cc |
|||
cln/src/integer/misc/Makeflags |
|||
cln/src/integer/misc/cl_BN_class.cc |
|||
cln/src/integer/misc/cl_I_abs.cc |
|||
cln/src/integer/misc/cl_I_exptpos_I.cc |
|||
cln/src/integer/misc/cl_I_oddp.cc |
|||
cln/src/integer/output/Makeflags |
|||
cln/src/integer/output/cl_I_aprint.cc |
|||
cln/src/integer/output/cl_I_bprint.cc |
|||
cln/src/integer/output/cl_I_cprint.cc |
|||
cln/src/integer/output/cl_I_decstring.cc |
|||
cln/src/integer/output/cl_I_dprint.cc |
|||
cln/src/integer/output/cl_I_print.cc |
|||
cln/src/integer/output/cl_I_print_string.cc |
|||
cln/src/integer/random/Makeflags |
|||
cln/src/integer/random/cl_I_random.cc |
|||
cln/src/float/Makeflags |
|||
cln/src/float/cl_F.h |
|||
cln/src/float/cl_float_config.h.in |
|||
cln/src/float/base/Makeflags |
|||
cln/src/float/base/cl_F_err_nan.cc |
|||
cln/src/float/base/cl_F_err_ov.cc |
|||
cln/src/float/base/cl_F_err_un.cc |
|||
cln/src/float/base/cl_F_globals.cc |
|||
cln/src/float/base/cl_ieee.cc |
|||
cln/src/float/base/cl_ieee.h |
|||
cln/src/float/ffloat/Makeflags |
|||
cln/src/float/ffloat/cl_FF.h |
|||
cln/src/float/ffloat/elem/Makeflags |
|||
cln/src/float/ffloat/elem/cl_FF_globals.cc |
|||
cln/src/float/ffloat/misc/Makeflags |
|||
cln/src/float/ffloat/misc/cl_FF_class.cc |
|||
cln/src/float/dfloat/Makeflags |
|||
cln/src/float/dfloat/cl_DF.h |
|||
cln/src/float/dfloat/conv/Makeflags |
|||
cln/src/float/dfloat/conv/cl_DF_from_double.cc |
|||
cln/src/float/dfloat/conv/cl_I_to_double.cc |
|||
cln/src/float/dfloat/elem/Makeflags |
|||
cln/src/float/dfloat/elem/cl_DF_fround.cc |
|||
cln/src/float/dfloat/elem/cl_DF_globals.cc |
|||
cln/src/float/dfloat/elem/cl_DF_to_I.cc |
|||
cln/src/float/dfloat/misc/Makeflags |
|||
cln/src/float/dfloat/misc/cl_DF_class.cc |
|||
cln/src/float/lfloat/Makeflags |
|||
cln/src/float/lfloat/cl_LF.h |
|||
cln/src/float/lfloat/cl_LF_impl.h |
|||
cln/src/float/lfloat/elem/Makeflags |
|||
cln/src/float/lfloat/elem/cl_LF_globals.cc |
|||
cln/src/float/lfloat/misc/Makeflags |
|||
cln/src/float/lfloat/misc/cl_LF_class.cc |
|||
cln/src/timing/Makeflags |
|||
cln/src/timing/cl_t_config.h.in |
|||
cln/tests/.gdbinit |
|||
cln/tests/Makefile.in |
@ -1,104 +0,0 @@ |
|||
; This is the list of object files needed by the undefined symbols of bigint.o. |
|||
$(GMP_OBJECTS) |
|||
cl_BN_class.o |
|||
cl_DF_class.o |
|||
cl_DF_from_double.o |
|||
cl_DF_fround.o |
|||
cl_DF_globals.o |
|||
cl_DF_to_I.o |
|||
cl_DS_div.o |
|||
cl_DS_mul.o |
|||
cl_DS_random.o |
|||
cl_DS_recip.o |
|||
cl_DS_recipsqrt.o |
|||
cl_DS_sqrt.o |
|||
cl_FF_class.o |
|||
cl_FF_globals.o |
|||
cl_F_err_nan.o |
|||
cl_F_err_ov.o |
|||
cl_F_err_un.o |
|||
cl_F_globals.o |
|||
cl_I_abs.o |
|||
cl_I_aprint.o |
|||
cl_I_ash.o |
|||
cl_I_ash_I.o |
|||
cl_I_asherr.o |
|||
cl_I_bprint.o |
|||
cl_I_compare.o |
|||
cl_I_cprint.o |
|||
cl_I_decstring.o |
|||
cl_I_digits_need.o |
|||
cl_I_div.o |
|||
cl_I_dprint.o |
|||
cl_I_equal.o |
|||
cl_I_exptpos_I.o |
|||
cl_I_floor2.o |
|||
cl_I_from_DS.o |
|||
cl_I_from_L.o |
|||
cl_I_from_L2.o |
|||
cl_I_from_NDS.o |
|||
cl_I_from_NUDS.o |
|||
cl_I_from_UDS.o |
|||
cl_I_from_UL.o |
|||
cl_I_from_digits.o |
|||
cl_I_from_string.o |
|||
cl_I_fullbyte.o |
|||
cl_I_gcd.o |
|||
cl_I_gcd_aux.o |
|||
cl_I_gcd_aux2.o |
|||
cl_I_ilength.o |
|||
cl_I_ldb.o |
|||
cl_I_ldbx.o |
|||
cl_I_log_aux.o |
|||
cl_I_logand.o |
|||
cl_I_logbitp.o |
|||
cl_I_logior.o |
|||
cl_I_lognot.o |
|||
cl_I_logxor.o |
|||
cl_I_minus.o |
|||
cl_I_minus1.o |
|||
cl_I_minusp.o |
|||
cl_I_mul.o |
|||
cl_I_oddp.o |
|||
cl_I_plus.o |
|||
cl_I_plus1.o |
|||
cl_I_print.o |
|||
cl_I_print_string.o |
|||
cl_I_random.o |
|||
cl_I_read.o |
|||
cl_I_readparsed.o |
|||
cl_I_rem.o |
|||
cl_I_sqrt.o |
|||
cl_I_square.o |
|||
cl_I_to_L.o |
|||
cl_I_to_UL.o |
|||
cl_I_to_digits.o |
|||
cl_I_to_double.o |
|||
cl_I_trunc1.o |
|||
cl_I_trunc2.o |
|||
cl_I_uminus.o |
|||
cl_I_xgcd.o |
|||
cl_I_zerop.o |
|||
cl_LF_class.o |
|||
cl_LF_globals.o |
|||
cl_N_err_d0.o |
|||
cl_UL_random.o |
|||
cl_asm_.o |
|||
cl_free.o |
|||
cl_ieee.o |
|||
cl_low_gcd.o |
|||
cl_malloc.o |
|||
cl_notreached.o |
|||
cl_output_dec.o |
|||
cl_prin_globals.o |
|||
cl_random_def.o |
|||
cl_random_from.o |
|||
cl_read_err_bad.o |
|||
cl_read_err_junk.o |
|||
cl_spushstring_push.o |
|||
cl_sstring.o |
|||
cl_st_c2.o |
|||
cl_st_class.o |
|||
cl_st_make1.o |
|||
cl_st_make2.o |
|||
cl_st_null.o |
@ -1,62 +0,0 @@ |
|||
; This is the list of undefined symbols from bigint.c |
|||
U _GLOBAL_.D.cl_module__cl_DF_globals__firstglobalfun |
|||
U _GLOBAL_.D.cl_module__cl_FF_globals__firstglobalfun |
|||
U _GLOBAL_.D.cl_module__cl_LF_globals__firstglobalfun |
|||
U _GLOBAL_.D.cl_module__cl_ieee__firstglobalfun |
|||
U _GLOBAL_.D.cl_module__cl_prin_globals__firstglobalfun |
|||
U _GLOBAL_.D.cl_module__cl_random_def__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_DF_globals__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_FF_globals__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_LF_globals__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_ieee__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_prin_globals__firstglobalfun |
|||
U _GLOBAL_.I.cl_module__cl_random_def__firstglobalfun |
|||
U __4cl_IPCc |
|||
U __mi__FRC4cl_I |
|||
U __mi__FRC4cl_IT0 |
|||
U __ml__FRC4cl_IT0 |
|||
U __pl__FRC4cl_IT0 |
|||
U abs__FRC4cl_I |
|||
U ash__FRC4cl_IT0 |
|||
U ash__FRC4cl_Il |
|||
U cl_DF_to_I__FRC5cl_DF |
|||
U cl_I_constructor_from_L__Fl |
|||
U cl_I_constructor_from_UL__FUl |
|||
U cl_I_to_L__FRC4cl_I |
|||
U cl_I_to_UL__FRC4cl_I |
|||
U cl_compare__FRC4cl_IT0 |
|||
U cl_decimal_string__FRC4cl_I |
|||
U cl_default_print_flags |
|||
U cl_default_random_state |
|||
U cl_double_approx__FRC4cl_I |
|||
U cl_double_to_DF_pointer__FRC11dfloatjanus |
|||
U cl_equal__FRC4cl_IT0 |
|||
U cl_free_heap_object__FP7cl_heap |
|||
U cl_free_hook |
|||
U cl_malloc_hook |
|||
U cl_sstring__FPCcUl |
|||
U expt_pos__FRC4cl_IT0 |
|||
U fround__FRC5cl_DF |
|||
U gcd__FRC4cl_IT0 |
|||
U integer_length__FRC4cl_I |
|||
U isqrt__FRC4cl_IP4cl_I |
|||
U ldb__FRC4cl_IRC7cl_byte |
|||
U logand__FRC4cl_IT0 |
|||
U logbitp__FUlRC4cl_I |
|||
U logior__FRC4cl_IT0 |
|||
U lognot__FRC4cl_I |
|||
U logxor__FRC4cl_IT0 |
|||
U minus1__FRC4cl_I |
|||
U minusp__FRC4cl_I |
|||
U oddp__FRC4cl_I |
|||
U plus1__FRC4cl_I |
|||
U print_integer__FR7ostreamRC14cl_print_flagsRC4cl_I |
|||
U print_integer_to_string__FUiRC4cl_I |
|||
U push__14cl_spushstringc |
|||
U random_I__FR15cl_random_stateRC4cl_I |
|||
U rem__FRC4cl_IT0 |
|||
U square__FRC4cl_I |
|||
U truncate1__FRC4cl_IT0 |
|||
U truncate2__FRC4cl_IT0 |
|||
U xgcd__FRC4cl_IT0P4cl_IT2 |
|||
U zerop__FRC4cl_I |
@ -1,784 +0,0 @@ |
|||
// |
|||
// LiDIA - a library for computational number theory |
|||
// Copyright (c) 1996-1998 by the LiDIA Group |
|||
// |
|||
// File : bigint.c (implementation of the cln interface) |
|||
// Author : Thomas Papanikolaou (TP), Bruno Haible (HB) |
|||
// Last change : HB, 1996-11-17, initial version |
|||
// HB, 1996-11-20, introduce BITOPS_ASSUME_ABS, off by default. |
|||
// HB, 1996-11-22, call functions cl_I_to_long() etc. just |
|||
// introduced in CLN. |
|||
// HB, 1998-01-24, modified for LiDIA-1.3 |
|||
// HB, 1998-01-25, BITOPS_ASSUME_ABS must be on. |
|||
// MM, 1998-03-10, Added a constructor, Changed the return type |
|||
// of length() and bit_length(), Added is_odd(), |
|||
// ..., is_one(), abs(). Normalize the xgcd |
|||
// result as needed by LiDIA. |
|||
// HB, 1998-12-13, Remove the xgcd normalization, because xgcd |
|||
// is fixed now. Include cl_integer_io.h instead |
|||
// of cl_print.h. |
|||
// HB, 1999-02-25, Make bigint_to_string work for negative args. |
|||
// |
|||
|
|||
#include <LiDIA/bigint.h> |
|||
#include <LiDIA/kernel/cl_dfloat.h> |
|||
#include <LiDIA/kernel/cl_random.h> |
|||
#include <LiDIA/kernel/cl_malloc.h> |
|||
#include <LiDIA/kernel/cl_abort.h> |
|||
#include <LiDIA/kernel/cl_integer_io.h> |
|||
#include <LiDIA/kernel/cl_spushstring.h> |
|||
|
|||
/* |
|||
* The bit operations assume a sign/magnitude representation. (The doc |
|||
* seems to indicate this, and this is supported by the fact that libI, |
|||
* lip, gmp all work on sign/magnitude representation. Thomas Papanikolaou |
|||
* says the contrary, but I think he's not right about this detail.) HB |
|||
*/ |
|||
#define BITOPS_ASSUME_ABS |
|||
|
|||
/** |
|||
** constructors and destructor; we could leave out some of these |
|||
**/ |
|||
|
|||
bigint::bigint() |
|||
: I () {} |
|||
|
|||
bigint::bigint(int i) |
|||
: I ((long)i) {} |
|||
|
|||
bigint::bigint(long l) |
|||
: I (l) {} |
|||
|
|||
bigint::bigint(unsigned long ul) |
|||
: I (ul) {} |
|||
|
|||
bigint::bigint(const cl_I & a) |
|||
: I (a) {} |
|||
|
|||
bigint::bigint(const bigint & a) |
|||
: I (a.I) {} |
|||
|
|||
bigint::~bigint() |
|||
{} |
|||
|
|||
/** |
|||
** inline member functions |
|||
**/ |
|||
|
|||
int bigint::bit(unsigned int i) const |
|||
{ |
|||
#ifdef BITOPS_ASSUME_ABS |
|||
if (minusp(I)) |
|||
return (int)logbitp(i,-I); |
|||
else |
|||
#endif |
|||
return (int)logbitp(i,I); |
|||
} |
|||
|
|||
lidia_size_t bigint::length() const |
|||
{ |
|||
#ifdef BITOPS_ASSUME_ABS |
|||
if (minusp(I)) |
|||
return (integer_length(-I)+intDsize-1)/intDsize; |
|||
else |
|||
#endif |
|||
return (integer_length(I)+intDsize-1)/intDsize; |
|||
} |
|||
|
|||
lidia_size_t bigint::bit_length() const |
|||
{ |
|||
#ifdef BITOPS_ASSUME_ABS |
|||
if (minusp(I)) |
|||
return integer_length(-I); |
|||
else |
|||
#endif |
|||
return integer_length(I); |
|||
} |
|||
|
|||
int bigint::sign() const |
|||
{ |
|||
if (minusp(I)) |
|||
return -1; |
|||
else if (zerop(I)) |
|||
return 0; |
|||
else |
|||
return 1; |
|||
} |
|||
|
|||
bool bigint::is_positive() const |
|||
{ if (!minusp(I)) |
|||
if (!zerop(I)) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool bigint::is_negative() const |
|||
{ return (bool)minusp(I); } |
|||
|
|||
bool bigint::is_even() const |
|||
{ return (bool)evenp(I); } |
|||
|
|||
bool bigint::is_odd() const |
|||
{ return (bool)oddp(I); } |
|||
|
|||
bool bigint::is_zero() const |
|||
{ return (bool)zerop(I); } |
|||
|
|||
bool bigint::is_gt_zero() const |
|||
{ if (!minusp(I)) |
|||
if (!zerop(I)) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool bigint::is_ge_zero() const |
|||
{ return (bool)!minusp(I); } |
|||
|
|||
bool bigint::is_lt_zero() const |
|||
{ return (bool)minusp(I); } |
|||
|
|||
bool bigint::is_le_zero() const |
|||
{ if (!minusp(I)) |
|||
if (!zerop(I)) |
|||
return (bool)0; |
|||
return (bool)1; |
|||
} |
|||
|
|||
bool bigint::is_one() const |
|||
{ return (bool)(I == 1); } |
|||
|
|||
|
|||
bool is_odd (const bigint & a) |
|||
{ return (bool)oddp(a.I); } |
|||
|
|||
bool is_even (const bigint & a) |
|||
{ return (bool)evenp(a.I); } |
|||
|
|||
bool is_positive (const bigint & a) |
|||
{ |
|||
if (!minusp(a.I)) |
|||
if (!zerop(a.I)) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_negative (const bigint & a) |
|||
{ return (bool)minusp(a.I); } |
|||
|
|||
bool is_zero (const bigint & a) |
|||
{ return (bool)zerop(a.I); } |
|||
|
|||
bool is_one (const bigint & a) |
|||
{ return (bool)(a.I == 1); } |
|||
|
|||
|
|||
|
|||
bool bigint::intify(int & i) const |
|||
{ |
|||
if (integer_length(I) >= int_bitsize) |
|||
return (bool)1; |
|||
i = cl_I_to_L(I); |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool bigint::longify(long & i) const |
|||
{ |
|||
if (integer_length(I) >= long_bitsize) |
|||
return (bool)1; |
|||
i = cl_I_to_long(I); |
|||
return (bool)0; |
|||
} |
|||
|
|||
int bigint::abs_compare(const bigint & a) const |
|||
{ |
|||
return (int)cl_compare(::abs(I),::abs(a.I)); |
|||
} |
|||
|
|||
int bigint::compare(const bigint & a) const |
|||
{ |
|||
return (int)cl_compare(I,a.I); |
|||
} |
|||
|
|||
unsigned long bigint::most_significant_digit() const |
|||
{ |
|||
if (zerop(I)) return 0; |
|||
cl_I aI = ::abs(I); |
|||
return cl_I_to_UL(ldb(aI,cl_byte(intDsize,((integer_length(aI)-1)/intDsize)*intDsize))); |
|||
} |
|||
|
|||
unsigned long bigint::least_significant_digit() const |
|||
{ |
|||
cl_I aI = ::abs(I); |
|||
return cl_I_to_UL(ldb(aI,cl_byte(intDsize,0))); |
|||
} |
|||
|
|||
const double bigint::radix() |
|||
{ return ldexp(1.0,intDsize); } |
|||
|
|||
const int bigint::bits_per_digit() |
|||
{ return intDsize; } |
|||
|
|||
void bigint::absolute_value() |
|||
{ if (minusp(I)) { I = -I; } } |
|||
|
|||
void bigint::abs() |
|||
{ if (minusp(I)) { I = -I; } } |
|||
|
|||
void bigint::negate() |
|||
{ I = -I; } |
|||
|
|||
void bigint::assign_zero() |
|||
{ I = 0; } |
|||
|
|||
void bigint::assign_one() |
|||
{ I = 1; } |
|||
|
|||
void bigint::assign(int i) |
|||
{ I = (long)i; } |
|||
|
|||
void bigint::assign(long i) |
|||
{ I = i; } |
|||
|
|||
void bigint::assign(unsigned long ui) |
|||
{ I = ui; } |
|||
|
|||
void bigint::assign(double d) |
|||
{ I = round1((cl_DF)d); } |
|||
|
|||
void bigint::assign(const bigint & a) |
|||
{ I = a.I; } |
|||
|
|||
void bigint::multiply_by_2() |
|||
{ I = ash(I,1); } |
|||
|
|||
void bigint::divide_by_2() |
|||
{ if (minusp(I)) { I = ash(plus1(I),-1); } else { I = ash(I,-1); } } |
|||
|
|||
/** |
|||
** Type checking |
|||
**/ |
|||
|
|||
bool is_char(const bigint & a) |
|||
{ if (integer_length(a.I) < char_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_uchar(const bigint & a) |
|||
{ if (!minusp(a.I)) |
|||
if (integer_length(a.I) <= char_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_short(const bigint & a) |
|||
{ if (integer_length(a.I) < short_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_ushort(const bigint & a) |
|||
{ if (!minusp(a.I)) |
|||
if (integer_length(a.I) <= short_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_int(const bigint & a) |
|||
{ if (integer_length(a.I) < int_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_uint(const bigint & a) |
|||
{ if (!minusp(a.I)) |
|||
if (integer_length(a.I) <= int_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_long(const bigint & a) |
|||
{ if (integer_length(a.I) < long_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
bool is_ulong(const bigint & a) |
|||
{ if (!minusp(a.I)) |
|||
if (integer_length(a.I) <= long_bitsize) |
|||
return (bool)1; |
|||
return (bool)0; |
|||
} |
|||
|
|||
/** |
|||
** assignments |
|||
**/ |
|||
|
|||
|
|||
int bigint::operator = (int i) |
|||
{ I = (long)i; return i; } |
|||
|
|||
long bigint::operator = (long l) |
|||
{ I = l; return l; } |
|||
|
|||
unsigned long bigint::operator = (unsigned long ul) |
|||
{ I = ul; return ul; } |
|||
|
|||
double bigint::operator = (double d) |
|||
{ I = round1((cl_DF)d); return d; } |
|||
|
|||
bigint & bigint::operator = (const bigint & a) |
|||
{ I = a.I; return *this; } |
|||
|
|||
/** |
|||
** comparisons |
|||
**/ |
|||
|
|||
bool operator == (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I == b.I); } |
|||
|
|||
bool operator != (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I != b.I); } |
|||
|
|||
bool operator > (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I > b.I); } |
|||
|
|||
bool operator >= (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I >= b.I); } |
|||
|
|||
bool operator < (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I < b.I); } |
|||
|
|||
bool operator <= (const bigint & a, const bigint & b) |
|||
{ return (bool)(a.I <= b.I); } |
|||
|
|||
/** |
|||
** operator overloading |
|||
**/ |
|||
|
|||
bigint operator - (const bigint & a) |
|||
{ return bigint(-a.I); } |
|||
|
|||
bigint operator + (const bigint & a, const bigint & b) |
|||
{ return bigint(a.I + b.I); } |
|||
|
|||
bigint operator - (const bigint & a, const bigint & b) |
|||
{ return bigint(a.I - b.I); } |
|||
|
|||
bigint operator * (const bigint & a, const bigint & b) |
|||
{ return bigint(a.I * b.I); } |
|||
|
|||
bigint operator / (const bigint & a, const bigint & b) |
|||
{ return bigint(truncate1(a.I,b.I)); } |
|||
|
|||
bigint operator % (const bigint & a, const bigint & b) |
|||
{ return bigint(rem(a.I,b.I)); } |
|||
|
|||
bigint operator << (const bigint & a, long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "operator<<::index is negative."); |
|||
return bigint(ash(a.I,(cl_I)ui)); |
|||
} |
|||
|
|||
bigint operator >> (const bigint & a, long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "operator>>::index is negative."); |
|||
return bigint(ash(a.I,-(cl_I)ui)); |
|||
} |
|||
|
|||
bigint operator & (const bigint & a, const bigint & b) |
|||
{ return bigint(logand(a.I,b.I)); } |
|||
|
|||
bigint operator | (const bigint & a, const bigint & b) |
|||
{ return bigint(logior(a.I,b.I)); } |
|||
|
|||
bigint operator ^ (const bigint & a, const bigint & b) |
|||
{ return bigint(logxor(a.I,b.I)); } |
|||
|
|||
bigint & bigint::operator += (const bigint & a) |
|||
{ I = I + a.I; return *this; } |
|||
|
|||
bigint & bigint::operator -= (const bigint & a) |
|||
{ I = I - a.I; return *this; } |
|||
|
|||
bigint & bigint::operator *= (const bigint & a) |
|||
{ I = I * a.I; return *this; } |
|||
|
|||
bigint & bigint::operator /= (const bigint & a) |
|||
{ I = truncate1(I,a.I); return *this; } |
|||
|
|||
bigint & bigint::operator %= (const bigint & a) |
|||
{ I = rem(I,a.I); return *this; } |
|||
|
|||
bigint & bigint::operator <<= (long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "operator<<=::index is negative."); |
|||
I = ash(I,(cl_I)ui); |
|||
return *this; |
|||
} |
|||
|
|||
bigint & bigint::operator >>= (long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "operator>>=::index is negative."); |
|||
I = ash(I,-(cl_I)ui); |
|||
return *this; |
|||
} |
|||
|
|||
bigint & bigint::operator &= (const bigint & a) |
|||
{ I = logand(I,a.I); return *this; } |
|||
|
|||
bigint & bigint::operator |= (const bigint & a) |
|||
{ I = logior(I,a.I); return *this; } |
|||
|
|||
bigint & bigint::operator ^= (const bigint & a) |
|||
{ I = logxor(I,a.I); return *this; } |
|||
|
|||
bigint & bigint::operator++ () |
|||
{ I = plus1(I); return *this; } |
|||
|
|||
bigint & bigint::operator-- () |
|||
{ I = minus1(I); return *this; } |
|||
|
|||
bigint bigint::operator++ (int) |
|||
{ bigint a = *this; I = plus1(I); return a; } |
|||
|
|||
bigint bigint::operator-- (int) |
|||
{ bigint a = *this; I = minus1(I); return a; } |
|||
|
|||
int bigint::operator ! () const |
|||
{ return (int)zerop(I); } |
|||
|
|||
bigint bigint::operator ~ () const |
|||
{ return bigint(lognot(I)); } |
|||
|
|||
/** |
|||
** Procedural versions |
|||
**/ |
|||
|
|||
void negate(bigint & a, const bigint & b) |
|||
{ a.I = -b.I; } |
|||
|
|||
void add(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = a.I + b.I; } |
|||
|
|||
void subtract(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = a.I - b.I; } |
|||
|
|||
void multiply(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = a.I * b.I; } |
|||
|
|||
void divide(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = truncate1(a.I,b.I); } |
|||
|
|||
void remainder(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = rem(a.I,b.I); } |
|||
|
|||
void div_rem(bigint & q, bigint & r, const bigint & a, const bigint & b) |
|||
{ |
|||
cl_I_div_t q_r = truncate2(a.I,b.I); |
|||
q.I = q_r.quotient; |
|||
r.I = q_r.remainder; |
|||
} |
|||
|
|||
void invert(bigint & a, const bigint & b) |
|||
{ |
|||
if ((b.I == 1) || (b.I == -1)) |
|||
a.I = b.I; |
|||
else |
|||
lidia_error_handler("bigint", "invert::inverting of a non-unit."); |
|||
} |
|||
|
|||
void shift_left(bigint & c, const bigint & a, long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "shift_left()::index is negative."); |
|||
c.I = ash(a.I,(cl_I)ui); |
|||
} |
|||
|
|||
void shift_right(bigint & c, const bigint & a, long ui) |
|||
{ |
|||
if (ui < 0) |
|||
lidia_error_handler("bigint", "shift_right()::index is negative."); |
|||
c.I = ash(a.I,-(cl_I)ui); |
|||
} |
|||
|
|||
void power(bigint & c, const bigint & a, const bigint & b) |
|||
{ |
|||
if ((a.I == 1) || (a.I == -1)) |
|||
{ |
|||
if (b.is_odd()) |
|||
c.I = a.I; |
|||
else |
|||
c.assign_one(); |
|||
} |
|||
else if (b.is_negative()) |
|||
c.assign_zero(); |
|||
else if (b.is_zero()) |
|||
c.assign_one(); |
|||
else |
|||
c.I = expt_pos(a.I,b.I); |
|||
} |
|||
|
|||
void power(bigint & c, const bigint & a, long i) |
|||
{ |
|||
if ((a.I == 1) || (a.I == -1)) |
|||
{ |
|||
if (i&1) |
|||
c.I = a.I; |
|||
else |
|||
c.assign_one(); |
|||
} |
|||
else if (i < 0) |
|||
c.assign_zero(); |
|||
else if (i == 0) |
|||
c.assign_one(); |
|||
else |
|||
c.I = expt_pos(a.I,(cl_I)i); |
|||
} |
|||
|
|||
void and(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = logand(a.I,b.I); } |
|||
|
|||
void or(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = logior(a.I,b.I); } |
|||
|
|||
void xor(bigint & c, const bigint & a, const bigint & b) |
|||
{ c.I = logxor(a.I,b.I); } |
|||
|
|||
void not(bigint & b, const bigint & a) |
|||
{ b.I = lognot(a.I); } |
|||
|
|||
void inc(bigint & c) |
|||
{ c.I = plus1(c.I); } |
|||
|
|||
void dec(bigint & c) |
|||
{ c.I = minus1(c.I); } |
|||
|
|||
void add(bigint & c, const bigint & a, long i) |
|||
{ c.I = a.I + i; } |
|||
|
|||
void subtract(bigint & c, const bigint & a, long i) |
|||
{ c.I = a.I - i; } |
|||
|
|||
void multiply(bigint & c, const bigint & a, long i) |
|||
{ c.I = a.I * i; } |
|||
|
|||
void divide(bigint & c, const bigint & a, long i) |
|||
{ c.I = truncate1(a.I,i); } |
|||
|
|||
void remainder(long &r, const bigint & a, long i) |
|||
{ |
|||
r = cl_I_to_long(rem(a.I,i)); |
|||
} |
|||
|
|||
long remainder(const bigint & a, long i) |
|||
{ |
|||
return cl_I_to_long(rem(a.I,i)); |
|||
} |
|||
|
|||
void div_rem(bigint & q, long &r, const bigint & a, long i) |
|||
{ |
|||
cl_I_div_t q_r = truncate2(a.I,i); |
|||
q.I = q_r.quotient; |
|||
r = cl_I_to_long(q_r.remainder); |
|||
} |
|||
|
|||
/** |
|||
** gcd's |
|||
**/ |
|||
|
|||
bigint gcd(const bigint & a, const bigint & b) |
|||
{ return bigint(gcd(a.I,b.I)); } |
|||
|
|||
bigint bgcd(const bigint & a, const bigint & b) |
|||
{ return bigint(gcd(a.I,b.I)); } |
|||
|
|||
bigint dgcd(const bigint & a, const bigint & b) |
|||
{ return bigint(gcd(a.I,b.I)); } |
|||
|
|||
bigint xgcd(bigint & u, bigint & v, const bigint & a, const bigint & b) |
|||
{ |
|||
#if 0 |
|||
// In the case abs(a) == abs(b), LiDIA wants to have u=0, abs(v)=1. |
|||
// But CLN returns abs(u)=1, v=0. Therefore we swap the arguments. |
|||
return bigint(xgcd(b.I,a.I,&v.I,&u.I)); |
|||
#else |
|||
// I think the above special case is unimportant, and it's more important |
|||
// to be consistent with xgcd_left and xgcd_right below. |
|||
return bigint(xgcd(a.I,b.I,&u.I,&v.I)); |
|||
#endif |
|||
} |
|||
|
|||
bigint xgcd_left(bigint & u, const bigint & a, const bigint & b) |
|||
{ cl_I v; return bigint(xgcd(a.I,b.I,&u.I,&v)); } |
|||
|
|||
bigint xgcd_right(bigint & v, const bigint & a, const bigint & b) |
|||
{ cl_I u; return bigint(xgcd(a.I,b.I,&u,&v.I)); } |
|||
|
|||
/** |
|||
** functions |
|||
**/ |
|||
|
|||
bigint abs(const bigint & a) |
|||
{ return bigint(abs(a.I)); } |
|||
|
|||
void seed(const bigint & a) |
|||
{ |
|||
cl_default_random_state.seed.lo = cl_I_to_UL(ldb(a.I,cl_byte(32,0))); |
|||
cl_default_random_state.seed.hi = cl_I_to_UL(ldb(a.I,cl_byte(32,32))); |
|||
} |
|||
|
|||
void bigint::randomize(const bigint & a) |
|||
{ |
|||
if (minusp(a.I)) |
|||
*this = bigint(-random_I(-a.I)); |
|||
else |
|||
*this = bigint(random_I(a.I)); |
|||
} |
|||
|
|||
bigint randomize(const bigint & a) |
|||
{ |
|||
if (minusp(a.I)) |
|||
return bigint(-random_I(-a.I)); |
|||
else |
|||
return bigint(random_I(a.I)); |
|||
} |
|||
|
|||
double dbl(const bigint & a) |
|||
{ return cl_double_approx(a.I); } |
|||
|
|||
xdouble xdbl(const bigint & a) |
|||
{ |
|||
double d1 = dbl(a); |
|||
bigint a1; a1.assign(d1); |
|||
double d2 = dbl(a - a1); |
|||
return (xdouble)d1 + (xdouble)d2; |
|||
} |
|||
|
|||
void sqrt(bigint & a, const bigint & b) |
|||
{ a.I = isqrt(b.I); } |
|||
|
|||
void square(bigint & a, const bigint & b) |
|||
{ a.I = square(b.I); } |
|||
|
|||
void swap(bigint & a, bigint & b) |
|||
{ |
|||
void* tmp = a.I.pointer; |
|||
a.I.pointer = b.I.pointer; |
|||
b.I.pointer = tmp; |
|||
} |
|||
|
|||
/** |
|||
** input / output |
|||
**/ |
|||
|
|||
istream & operator >> (istream & in, bigint & a) |
|||
{ |
|||
a.scan (in); |
|||
return (in); |
|||
} |
|||
|
|||
ostream & operator << (ostream & out, const bigint & a) |
|||
{ out << a.I; return out; } |
|||
|
|||
int string_to_bigint(const char *s, bigint & a) |
|||
{ |
|||
int n = strlen(s); |
|||
char c[n+1]; |
|||
for (int i = 0; i < n; i++) |
|||
switch (s[i]) |
|||
{ |
|||
case '+': case '-': case '.': |
|||
case '0': case '1': case '2': case '3': case '4': |
|||
case '5': case '6': case '7': case '8': case '9': |
|||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': |
|||
case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': |
|||
case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': |
|||
case 'V': case 'W': case 'X': case 'Y': case 'Z': |
|||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': |
|||
case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': |
|||
case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': |
|||
case 'v': case 'w': case 'x': case 'y': case 'z': |
|||
c[i] = s[i]; break; |
|||
default: |
|||
c[i] = '\0'; goto eos; |
|||
} |
|||
c[n] = '\0'; |
|||
eos: |
|||
n = strlen(c); |
|||
if (n == 0) return -1; |
|||
a = (bigint)(cl_I)c; return n; |
|||
} |
|||
|
|||
int bigint_to_string(const bigint & a, char *s) |
|||
{ |
|||
char* r = print_integer_to_string(10,a.I); |
|||
strcpy(s,r); |
|||
cl_free_hook(r); |
|||
return strlen(s); |
|||
} |
|||
|
|||
/** |
|||
** using fread/fwrite |
|||
**/ |
|||
|
|||
void bigint::read_from_file(FILE * fp) |
|||
{ |
|||
scan_from_file(fp); |
|||
int c = getc(fp); if (c != EOF && c != '\n') { ungetc(c,fp); } |
|||
} |
|||
|
|||
void bigint::write_to_file(FILE * fp) |
|||
{ |
|||
print_to_file(fp); |
|||
putc('\n',fp); |
|||
} |
|||
|
|||
/** |
|||
** using fscanf/fprintf |
|||
**/ |
|||
|
|||
void bigint::scan_from_file(FILE * fp) |
|||
{ |
|||
cl_spushstring buffer; |
|||
int c; |
|||
while ((c = getc(fp)) != EOF) |
|||
if (!(c=='\n' || c=='\t' || c==' ')) |
|||
{ ungetc(c,fp); break; } |
|||
while ((c = getc(fp)) != EOF) { |
|||
switch (c) |
|||
{ case '0': case '1': case '2': case '3': case '4': |
|||
case '5': case '6': case '7': case '8': case '9': |
|||
case '+': case '-': |
|||
buffer.push((char)c); break; |
|||
default: |
|||
ungetc(c,fp); goto end; |
|||
} |
|||
} |
|||
end: |
|||
char* s = buffer.contents(); |
|||
if (s[0] != '\0') |
|||
I = (cl_I)s; |
|||
cl_free_hook(s); |
|||
} |
|||
|
|||
void bigint::print_to_file(FILE * fp) |
|||
{ |
|||
char* s = print_integer_to_string(10,I); |
|||
fprintf(fp,"%s",s); |
|||
cl_free_hook(s); |
|||
} |
|||
|
|||
/** |
|||
** Error handler |
|||
**/ |
|||
|
|||
void cl_abort (void) |
|||
{ |
|||
lidia_error_handler("cln", "cl_abort() called"); |
|||
} |
|||
|
@ -1,40 +0,0 @@ |
|||
// |
|||
// LiDIA - a library for computational number theory |
|||
// Copyright (c) 1996 by the LiDIA Group |
|||
// |
|||
// File : bigint_def.h |
|||
// Author : Bruno Haible (HB) |
|||
// Last change : HB, 1996-11-17, initial version |
|||
// HB, 1998-01-24, change #include <cl_*> to #include "cl_*" |
|||
// because the files are in $(LIDIA_HOME)/include/LiDIA, |
|||
// and the only -I option is -I$(LIDIA_HOME)/include . |
|||
// |
|||
|
|||
#ifndef LIDIA_BIGINT_DEF_H |
|||
#define LIDIA_BIGINT_DEF_H |
|||
|
|||
/** |
|||
** The next include MUST remain in this file in THIS position. |
|||
**/ |
|||
|
|||
#include <LiDIA/lidia.h> |
|||
|
|||
/** |
|||
** include here the include file of the C multiple precision integers |
|||
** and define integer_type_name to be the integer type we have. Define |
|||
** base_digit to |
|||
** |
|||
** For example write something like |
|||
** |
|||
** #include "integer_include_file.h" |
|||
** #define integer_type_name your_integer_type_name |
|||
** |
|||
**/ |
|||
|
|||
#include <LiDIA/kernel/cln/number.h> |
|||
#include <LiDIA/kernel/cln/integer.h> |
|||
|
|||
#define integer_type_name cl_I |
|||
#define base_digit uintD |
|||
|
|||
#endif |
@ -1,69 +0,0 @@ |
|||
######################################################################
|
|||
#
|
|||
# Name ................... LiDIA/src/interfaces/integers/cln/makefile
|
|||
#
|
|||
# Architecture : unix
|
|||
# Compiler : gcc, g++
|
|||
# Flags : -g -O2
|
|||
# Program Flags:
|
|||
# Author : Thomas Papanikolaou & Bruno Haible
|
|||
# Release : 1.0
|
|||
# Last Change : 1998-01-24
|
|||
# Copyright : by the University of Saarland and Bruno Haible, 1996
|
|||
#
|
|||
|
|||
#
|
|||
# include the configuration file
|
|||
#
|
|||
|
|||
include ../../../../config/CONFIG |
|||
|
|||
#
|
|||
# Object
|
|||
#
|
|||
|
|||
OBJ=bigint.o |
|||
|
|||
#
|
|||
# Rules
|
|||
#
|
|||
|
|||
all: copyh $(libp)LiDIA.a |
|||
|
|||
appl: bigint_appl$(EXE) |
|||
|
|||
#
|
|||
# Dependencies
|
|||
#
|
|||
|
|||
copyh: |
|||
$(CP) bigint_def.h $(LIDIA_HOME)$(DIRSEP)include$(DIRSEP)LiDIA |
|||
|
|||
bigint.o: bigint.c $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)bigint.h |
|||
$(CXX) -c $(CXXFLAGS) -I$(LIDIA_INC) -I$(LIDIA_HOME)$(DIRSEP)src$(DIRSEP)kernel$(DIRSEP)integers$(DIRSEP)cln$(DIRSEP)cln$(DIRSEP)include -I$(LIDIA_HOME)$(DIRSEP)src$(DIRSEP)kernel$(DIRSEP)integers$(DIRSEP)cln $*.c -o $(objp)$*.o |
|||
$(NOOMV) $*.o $(objp)$*.o |
|||
$(TOUCH) $*.o |
|||
|
|||
$(libp)LiDIA.a: $(OBJ) |
|||
-$(AR) $(LIDIA_LIB)$(DIRSEP)$(libp)LiDIA.a $(objp)*.o |
|||
|
|||
ranlib: |
|||
$(RANLIB) $(LIDIA_LIB)$(DIRSEP)$(libp)LiDIA.a |
|||
|
|||
bigint_appl$(EXE): bigint_appl.c |
|||
$(CXX) $(CXXFLAGS) bigint_appl.c $(CXX-off) -I$(LIDIA_INC) -L$(LIDIA_LIB) -o bigint_appl$(EXE) $(LIB) |
|||
-$(MV) bigint_appl$(EXE) $(LIDIA_BIN) |
|||
|
|||
#
|
|||
# Clean
|
|||
#
|
|||
|
|||
clean: |
|||
-$(RM) *.o |
|||
|
|||
veryclean: clean |
|||
-$(RM) bigint_appl$(EXE) |
|||
|
|||
#
|
|||
# End Of Makefile
|
|||
#
|
@ -1,17 +0,0 @@ |
|||
LiDIA has an abstract interface to the underlying long integer implementation. |
|||
Using CLN instead of the default libI, lip or gmp has the following |
|||
advantages: |
|||
|
|||
- Maximum speed on all CPUs, since CLN is based on the highly |
|||
optimized gmp-2.0.2. |
|||
|
|||
- Very large integers profit from CLN's Schönhage-Strassen FFT multiplication |
|||
(asymptotic bit complexity: O(N log N log log N)). |
|||
|
|||
- Copying integers is fast: no copying is actually involved, only a |
|||
reference count is manipulated. |
|||
|
|||
- Small integers (absolute value < 2^29) are represented immediately, |
|||
thus no memory allocation/deallocation is involved when dealing with |
|||
small integers. |
|||
|
@ -1,6 +0,0 @@ |
|||
This directory contains a special version of CLN, trimmed down for LiDIA. |
|||
It was prepared from CLN version 1.0, found on ftp://ftp.santafe.edu/pub/gnu/, |
|||
by |
|||
1. removing many unnecessary files (including many source files, the test |
|||
suite and the documentation), |
|||
2. adding the file README.LiDIA |
@ -1,178 +0,0 @@ |
|||
######################################################################
|
|||
#
|
|||
# Name ............................... LiDIA/src/kernel/cln/makefile
|
|||
#
|
|||
# Architecture : unix
|
|||
# Compiler : gcc, g++
|
|||
# Flags : -g -O2 -fno-exceptions
|
|||
# Program Flags:
|
|||
# Author : Markus Maurer, Bruno Haible
|
|||
# Release : 1.0
|
|||
# Last Change : 1998-12-13
|
|||
# Copyright : by the University of Saarland and Bruno Haible, 1998
|
|||
#
|
|||
|
|||
#
|
|||
# include the configuration file
|
|||
#
|
|||
|
|||
include ../../../../config/CONFIG |
|||
|
|||
#
|
|||
# Dependencies
|
|||
#
|
|||
|
|||
|
|||
default: library |
|||
|
|||
c: library |
|||
|
|||
sparc: library |
|||
|
|||
sparc7: library |
|||
|
|||
sparc8: library |
|||
|
|||
mips: library |
|||
|
|||
i386: library |
|||
|
|||
i486: library |
|||
|
|||
i586: library |
|||
|
|||
i686: library |
|||
|
|||
hppa1.1: library |
|||
|
|||
|
|||
|
|||
|
|||
#
|
|||
# library and application files
|
|||
#
|
|||
|
|||
library: cln$(DIRSEP)include$(DIRSEP)cl_config.h cln$(DIRSEP)include$(DIRSEP)cl_intparam.h |
|||
cd cln$(DIRSEP)gmp $(SEP) $(MAKE) mpn/libmpn.la mp_clz_tab.lo |
|||
cd cln$(DIRSEP)src $(SEP) $(MAKE) |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_abort.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_complex_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_config.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_dfloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_dfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_ffloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_ffloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_float.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_float_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_floatformat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_floatparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_input.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_intparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_lfloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_lfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_malloc.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_modules.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_number.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_number_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_object.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_output.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_random.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_rational_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_real_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_sfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_string.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_types.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)src$(DIRSEP)base$(DIRSEP)cl_spushstring.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)src$(DIRSEP)base$(DIRSEP)cl_sstring.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)gmp.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)gmp-impl.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)longlong.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)mpn$(DIRSEP)gmp-mparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
$(SHELL) cln$(DIRSEP)libtool --mode=install cp cln$(DIRSEP)src$(DIRSEP)libcln.la `pwd`$(DIRSEP)libcln.la |
|||
$(ARX) libcln.a |
|||
$(AR) $(LIDIA_LIB)$(DIRSEP)$(libp)LiDIA.a *.o |
|||
$(RM) *.o |
|||
$(RM) libcln.a |
|||
$(TOUCH) library |
|||
|
|||
|
|||
ranlib: |
|||
$(RANLIB) $(LIDIA_LIB)$(DIRSEP)$(libp)LiDIA.a |
|||
|
|||
appl: |
|||
# cd cln $(SEP) $(MAKE) check
|
|||
|
|||
|
|||
|
|||
#
|
|||
# Configuration command
|
|||
#
|
|||
|
|||
|
|||
configure: |
|||
cd cln $(SEP) CC="$(CC)" CFLAGS="$(CFLAGS) -fno-exceptions" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) -fno-exceptions" .$(DIRSEP)configure --target=$(LIDIA_ARCH) |
|||
|
|||
|
|||
|
|||
#
|
|||
# Installation commands
|
|||
#
|
|||
|
|||
install: installh |
|||
|
|||
installh: |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_abort.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_complex_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_config.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_dfloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_dfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_ffloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_ffloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_float.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_float_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_floatformat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_floatparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_input.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_integer_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_intparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_lfloat.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_lfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_malloc.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_modules.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_number.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_number_io.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_object.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_output.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_random.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_rational_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_real_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_sfloat_class.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_string.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)include$(DIRSEP)cl_types.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)src$(DIRSEP)base$(DIRSEP)cl_spushstring.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)src$(DIRSEP)base$(DIRSEP)cl_sstring.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)gmp.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)gmp-impl.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)longlong.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
-$(CP) cln$(DIRSEP)gmp$(DIRSEP)mpn$(DIRSEP)gmp-mparam.h $(LIDIA_INC)$(DIRSEP)LiDIA$(DIRSEP)kernel |
|||
|
|||
|
|||
#
|
|||
# Clean
|
|||
#
|
|||
|
|||
clean: |
|||
-cd cln $(SEP) make clean |
|||
-$(RM) library |
|||
|
|||
|
|||
veryclean: clean |
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue