diff --git a/doc/cln.dvi b/doc/cln.dvi index 086cf54..00de7ca 100644 Binary files a/doc/cln.dvi and b/doc/cln.dvi differ diff --git a/doc/cln.html b/doc/cln.html index f464153..68af2b7 100644 --- a/doc/cln.html +++ b/doc/cln.html @@ -1,6 +1,6 @@
- +@@ -316,21 +319,23 @@ of static and global variables, a feature which I could implement for GNU g++ only. -
To build CLN, you also need to have GNU make installed.
-
To build CLN on HP-UX, you also need to have GNU sed installed.
@@ -466,11 +471,40 @@ library.
-
+Starting with version 1.0.4, CLN may be configured to make use of a
+preinstalled gmp library. Please make sure that you have at
+least gmp version 3.0 installed since earlier versions are
+unsupported and likely not to work. Enabling this feature by calling
+configure with the option `--with-gmp' is known to be quite
+a boost for CLN's performance.
+
+
+
+If you have installed the gmp library and its header file in
+some place where your compiler cannot find it by default, you must help
+configure by setting CPPFLAGS and LDFLAGS. Here is
+an example:
+
+
+
+
+$ CC="gcc" CFLAGS="-O2" CXX="g++" CXXFLAGS="-O2 -fno-exceptions" \ + CPPFLAGS="-I/opt/gmp/include" LDFLAGS="-L/opt/gmp/lib" ./configure --with-gmp ++ + + +
As with any autoconfiguring GNU software, installation is as easy as this:
@@ -496,7 +530,7 @@ the --prefix=... option.
-
You can remove system-dependent files generated by make through
@@ -519,7 +553,7 @@ $ make distclean
-
CLN implements the following class hierarchy: @@ -555,8 +589,8 @@ Rational number Floating-point number
-
+
The base class cl_number is an abstract base class.
It is not useful to declare a variable of this type except if you want
to completely disable compile-time type checking and use run-time type
@@ -564,24 +598,24 @@ checking instead.
-
+
The class cl_N comprises real and complex numbers. There is
no special class for complex numbers since complex numbers with imaginary
part 0 are automatically converted to real numbers.
-
+
The class cl_R comprises real numbers of different kinds. It is an
abstract class.
-
+
The class cl_RA comprises exact real numbers: rational numbers, including
integers. There is no special class for non-integral rational numbers
since rational numbers with denominator 1 are automatically converted
@@ -589,16 +623,16 @@ to integers.
-
+
The class cl_F implements floating-point approximations to real numbers.
It is an abstract class.
-
@@ -640,9 +674,9 @@ is completely transparent. -
@@ -654,7 +688,7 @@ CLN implements ordinary floating-point numbers, with mantissa and exponent.
-
+
The elementary operations (+, -, *, /, ...)
only return approximate results. For example, the value of the expression
(cl_F) 0.3 + (cl_F) 0.4 prints as `0.70000005', not as
@@ -685,7 +719,7 @@ Floating point numbers come in four flavors:
cl_SF.
They have 1 sign bit, 8 exponent bits (including the exponent's sign),
and 17 mantissa bits (including the "hidden" bit).
@@ -693,7 +727,7 @@ They don't consume heap allocation.
cl_FF.
They have 1 sign bit, 8 exponent bits (including the exponent's sign),
and 24 mantissa bits (including the "hidden" bit).
@@ -702,7 +736,7 @@ This corresponds closely to the C/C++ type `float'.
cl_DF.
They have 1 sign bit, 11 exponent bits (including the exponent's sign),
and 53 mantissa bits (including the "hidden" bit).
@@ -711,7 +745,7 @@ This corresponds closely to the C/C++ type `double'.
cl_LF.
They have 1 sign bit, 32 exponent bits (including the exponent's sign),
and n mantissa bits (including the "hidden" bit), where n >= 64.
@@ -732,7 +766,7 @@ with larger exponent range.
-
+
As a user of CLN, you can forget about the differences between the
four floating-point types and just declare all your floating-point
variables as being of type cl_F. This has the advantage that
@@ -747,9 +781,9 @@ the floating point contagion rule happened to change in the future.)
-
@@ -766,9 +800,9 @@ through application of sqrt or transcendental functions.
-
@@ -827,7 +861,7 @@ Conversions from `const char *' are provided for the classes
cl_R, cl_N.
The easiest way to specify a value which is outside of the range of the
C++ built-in types is therefore to specify it as a string, like this:
-
+
cl_I order_of_rubiks_cube_group = "43252003274489856000";
@@ -847,16 +881,16 @@ the functions
int cl_I_to_int (const cl_I& x)
unsigned int cl_I_to_uint (const cl_I& x)
long cl_I_to_long (const cl_I& x)
unsigned long cl_I_to_ulong (const cl_I& x)
x as element of the C type ctype. If x is not
representable in the range of ctype, a runtime error occurs.
@@ -873,10 +907,10 @@ the functions
float cl_float_approx (const type& x)
double cl_double_approx (const type& x)
x of C type ctype.
If abs(x) is too close to 0 (underflow), 0 is returned.
If abs(x) is too large (overflow), an IEEE infinity is returned.
@@ -887,10 +921,10 @@ Conversions from any class to any of its subclasses ("derived classes" in
C++ terminology) are not provided. Instead, you can assert and check
that a value belongs to a certain subclass, and return it as element of that
class, using the `As' and `The' macros.
-
+
As(type)(value) checks that value belongs to
type and returns it as such.
-
+
The(type)(value) assumes that value belongs to
type and returns it as such. It is your responsibility to ensure
that this assumption is valid.
@@ -907,7 +941,7 @@ Example:
-
Each of the number classes declares its mathematical operations in the
@@ -917,7 +951,7 @@ objects of type
Here is how to create number objects "from nothing".
@@ -925,37 +959,37 @@ Here is how to create number objects "from nothing".
-
To construct a
The programmatic way to construct a
Non-real
-See section 4.4 Elementary complex functions.
+See section 4.4 Elementary complex functions.
-
Each of the classes
Each of the classes
The class
@@ -1237,22 +1271,22 @@ defines the following operations:
@@ -1389,19 +1423,19 @@ defines the following operations:
@@ -1518,16 +1552,16 @@ defines the following operations:
@@ -1559,6 +1593,11 @@ and the remainder. The suffix `2' indicates this.
Each of the classes
and similarly for class
@@ -1631,15 +1671,15 @@ The classes
Each of the classes
@@ -1736,13 +1776,13 @@ For example,
-
-
+
+
Archimedes' constant pi = 3.14... is returned by the following functions:
@@ -1923,7 +1963,7 @@ Archimedes' constant pi = 3.14... is returned by the following functions:
@@ -2024,7 +2064,7 @@ Euler's constant C = 0.577... is returned by the following functions:
@@ -2073,7 +2113,7 @@ following functions:
Integers, when viewed as in two's complement notation, can be thought as
@@ -2113,69 +2153,69 @@ on each of the bit positions in parallel.
where
@@ -2219,19 +2259,19 @@ Other functions that view integers as bit strings:
-
+
represents the bit interval containing the bits
Recall that a floating-point number consists of a sign
The complete internal representation of a float is encoded in the type
-
-
-
-
-
+
+
+
+
+
The type
Each of the classes
A random generator is a machine which produces (pseudo-)random numbers.
@@ -2749,7 +2790,8 @@ a complicated but deterministic way.
@@ -2814,7 +2856,7 @@ to get happy, then add
-
+
to the beginning of your source files, before the inclusion of any CLN
include files. This flag will enable the following operators:
@@ -2828,16 +2870,16 @@ For the classes
@@ -2854,19 +2896,19 @@ For the class
@@ -2878,7 +2920,7 @@ For the classes
@@ -2927,9 +2969,9 @@ Several external representations may denote the same number, for example,
Converting an internal to an external representation is called "printing",
-
+
converting an external to an internal representation is called "reading".
-
+
In CLN, it is always true that conversion of an internal to an external
representation and then back to an internal representation will yield the
same internal representation. Symbolically:
Including
Including
CLN has a class of abstract rings.
@@ -3415,16 +3457,16 @@ Tests whether the given number is an element of the number ring R.
-
@@ -3452,6 +3494,10 @@ The class of modular integer rings is
<cl_modinteger.h>
+
and the class of all modular integers (elements of modular integer rings) is
@@ -3471,11 +3517,11 @@ Modular integer rings are constructed using the function
Given a modular integer ring
@@ -3660,9 +3706,9 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols.
-
@@ -3688,7 +3734,7 @@ Strings are constructed through the following constructors:
@@ -3752,7 +3798,7 @@ Symbols are constructed through the following constructor:
CLN implements univariate polynomials (polynomials in one variable) over an
@@ -3891,7 +3937,7 @@ return the same polynomial ring.
Given a univariate polynomial ring
The following functions return special polynomials.
@@ -4090,26 +4136,26 @@ The following functions return special polynomials.
@@ -4142,7 +4188,7 @@ Efficiency: It compiles to machine code.
In order to save memory allocations, CLN implements:
@@ -4188,8 +4234,8 @@ Object sharing: An operation like
Speed efficiency is obtained by the combination of the following tricks
@@ -4234,9 +4280,9 @@ algorithm.
For very large numbers (more than 12000 decimal digits), CLN uses
Schönhage-Strassen
-
-multiplication, which is an asymptotically
-optimal multiplication algorithm.
+
+multiplication, which is an asymptotically optimal multiplication
+algorithm.
@@ -4271,7 +4317,7 @@ cached, whereas undue memory consumption through cached rings is avoided.
-
For the following discussion, we will assume that you have installed
@@ -4283,9 +4329,9 @@ environment variables, or directly substitute the appropriate values.
-
@@ -4322,10 +4368,10 @@ linking a CLN application it is sufficient to give the flag
@@ -4518,11 +4564,11 @@ Includes all of the above.
-
A function which computes the nth Fibonacci number can be written as follows.
-
+
@@ -4606,9 +4652,9 @@ contains this implementation together with an even faster algorithm.
-
@@ -4642,7 +4688,7 @@ CLN offers a function
When a fatal error occurs, an error message is output to the standard error
@@ -4711,15 +4757,15 @@ void cl_abort (void);
-
+
This function must not return control to its caller.
-
@@ -4740,17 +4786,17 @@ will be generated instead. The default value of
-
The output of the function
Every memory allocation of CLN is done through the function pointer
@@ -4769,8 +4815,8 @@ void (*cl_free_hook) (void* ptr) = ...;
-
-
+
+
The
Jump to:
@@ -4790,7 +4836,7 @@ Jump to:
-This document was generated on 4 May 2000 using
+This document was generated on 5 May 2000 using
texi2html 1.56k.
cl_I, it should #include <cl_integer.h
-4.1 Constructing numbers
+4.1 Constructing numbers
4.1.1 Constructing integers
+4.1.1 Constructing integers
cl_I objects are most easily constructed from C integers and from
-strings. See section 3.4 Conversions.
+strings. See section 3.4 Conversions.
-4.1.2 Constructing rational numbers
+4.1.2 Constructing rational numbers
cl_RA objects can be constructed from strings. The syntax
-for rational numbers is described in section 5.1 Internal and printed representation.
+for rational numbers is described in section 5.1 Internal and printed representation.
Another standard way to produce a rational number is through application
of `operator /' or `recip' on integers.
-4.1.3 Constructing floating-point numbers
+4.1.3 Constructing floating-point numbers
cl_F objects with low precision are most easily constructed from
-C `float' and `double'. See section 3.4 Conversions.
+C `float' and `double'. See section 3.4 Conversions.
cl_F with high precision, you can use the conversion
from `const char *', but you have to specify the desired precision
-within the string. (See section 5.1 Internal and printed representation.)
+within the string. (See section 5.1 Internal and printed representation.)
Example:
@@ -969,7 +1003,7 @@ will set `e' to the given value, with a precision of 40 decimal dig
cl_F with high precision is
through the cl_float conversion function, see
-section 4.11.1 Conversion to floating-point numbers. For example, to compute
+section 4.11.1 Conversion to floating-point numbers. For example, to compute
e to 40 decimal places, first construct 1.0 to 40 decimal places
and then apply the exponential function:
@@ -980,7 +1014,7 @@ and then apply the exponential function:
-4.1.4 Constructing complex numbers
+4.1.4 Constructing complex numbers
cl_N objects are normally constructed through the function
@@ -990,12 +1024,12 @@ Non-real cl_N objects are normally constructed through the function
4.2 Elementary functions
+4.2 Elementary functions
cl_N, cl_R, cl_RA, cl_I,
@@ -1007,12 +1041,12 @@ defines the following operations:
type operator + (const type&, const type&)
type operator - (const type&, const type&)
type operator - (const type&)
@@ -1021,22 +1055,22 @@ Returns the negative of the argument.
type plus1 (const type& x)
x + 1.
type minus1 (const type& x)
x - 1.
type operator * (const type&, const type&)
type square (const type& x)
x * x.
@@ -1050,12 +1084,12 @@ defines the following operations:
type operator / (const type&, const type&)
type recip (const type&)
cl_I doesn't define a `/' operation because
in the C/C++ language this operator, applied to integral types,
denotes the `floor' or `truncate' operation (which one of these,
-is implementation dependent). (See section 4.6 Rounding functions)
+is implementation dependent). (See section 4.6 Rounding functions.)
Instead, cl_I defines an "exact quotient" function:
@@ -1071,7 +1105,7 @@ Instead, cl_I defines an "exact quotient" function:
cl_I exquo (const cl_I& x, const cl_I& y)
y divides x, and returns the quotient x/y.
@@ -1083,14 +1117,14 @@ The following exponentiation functions are defined:
cl_I expt_pos (const cl_I& x, const cl_I& y)
cl_RA expt_pos (const cl_RA& x, const cl_I& y)
y must be > 0. Returns x^y.
cl_RA expt (const cl_RA& x, const cl_I& y)
cl_R expt (const cl_R& x, const cl_I& y)
cl_N expt (const cl_N& x, const cl_I& y)
@@ -1108,7 +1142,7 @@ defines the following operation:
type abs (const type& x)
x.
This is x if x >= 0, and -x if x <= 0.
@@ -1134,7 +1168,7 @@ defines the following operation:
type signum (const type& x)
x, in the same number format as x.
This is defined as x / abs(x) if x is non-zero, and
x if x is zero. If x is real, the value is either
@@ -1143,7 +1177,7 @@ This is defined as x / abs(x) if x is non-zero, and
-4.3 Elementary rational functions
+4.3 Elementary rational functions
cl_RA, cl_I defines the following operations:
@@ -1153,12 +1187,12 @@ Each of the classes cl_RA, cl_I defines the following
cl_I numerator (const type& x)
x.
cl_I denominator (const type& x)
x.
@@ -1169,7 +1203,7 @@ a way that they have no factor in common and the denominator is positive.
-4.4 Elementary complex functions
+4.4 Elementary complex functions
cl_N defines the following operation:
@@ -1179,7 +1213,7 @@ The class cl_N defines the following operation:
cl_N complex (const cl_R& a, const cl_R& b)
a+bi, that is, the complex number with
real part a and imaginary part b.
@@ -1192,17 +1226,17 @@ Each of the classes cl_N, cl_R defines the following o
cl_R realpart (const type& x)
x.
cl_R imagpart (const type& x)
x.
type conjugate (const type& x)
x.
@@ -1222,9 +1256,9 @@ We have the relations
-4.5 Comparisons
+4.5 Comparisons
bool operator == (const type&, const type&)
bool operator != (const type&, const type&)
uint32 cl_equal_hashcode (const type&)
==. This hash code depends on the number's value,
not its type or precision.
cl_boolean zerop (const type& x)
x == 0
@@ -1266,42 +1300,42 @@ defines the following operations:
cl_signean cl_compare (const type& x, const type& y)
x and y. Returns +1 if x>y,
-1 if x<y, 0 if x=y.
bool operator <= (const type&, const type&)
bool operator < (const type&, const type&)
bool operator >= (const type&, const type&)
bool operator > (const type&, const type&)
cl_boolean minusp (const type& x)
x < 0
cl_boolean plusp (const type& x)
x > 0
type max (const type& x, const type& y)
x and y.
type min (const type& x, const type& y)
x and y.
@@ -1316,9 +1350,9 @@ there is no floating point number whose value is exactly 1/3.
-4.6 Rounding functions
+4.6 Rounding functions
cl_I floor1 (const type& x)
floor(x).
cl_I ceiling1 (const type& x)
ceiling(x).
cl_I truncate1 (const type& x)
truncate(x).
cl_I round1 (const type& x)
round(x).
@@ -1490,16 +1524,16 @@ defines the following operations:
type_div_t floor2 (const type& x, const type& y)
type_div_t ceiling2 (const type& x, const type& y)
type_div_t truncate2 (const type& x, const type& y)
type_div_t round2 (const type& x, const type& y)
type ffloor (const type& x)
type fceiling (const type& x)
type ftruncate (const type& x)
type fround (const type& x)
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines the following operations:
+
+
+
+
+
@@ -1567,19 +1606,20 @@ defines the following operations:
type_fdiv_t ffloor2 (const type& x)
type_fdiv_t fceiling2 (const type& x)
type_fdiv_t ftruncate2 (const type& x)
type_fdiv_t fround2 (const type& x)
cl_R, but with quotient type cl_F.
+
cl_R, cl_I define the following operations
type mod (const type& x, const type& y)
type rem (const type& x, const type& y)
4.7 Roots
+4.7 Roots
cl_R,
@@ -1651,7 +1691,7 @@ defines the following operation:
type sqrt (const type& x)
x must be >= 0. This function returns the square root of x,
normalized to be >= 0. If x is the square of a rational number,
sqrt(x) will be a rational number, else it will return a
@@ -1666,7 +1706,7 @@ The classes cl_RA, cl_I define the following operation
cl_boolean sqrtp (const type& x, type* root)
x is a perfect square. If so, it returns true
and the exact square root in *root, else it returns false.
@@ -1679,7 +1719,7 @@ Furthermore, for integers, similarly:
cl_boolean isqrt (const type& x, type* root)
x should be >= 0. This function sets *root to
floor(sqrt(x)) and returns the same value as sqrtp:
the boolean value (expt(*root,2) == x).
@@ -1694,7 +1734,7 @@ define the following operation:
cl_boolean rootp (const type& x, const cl_I& n, type* root)
x must be >= 0. n must be > 0.
This tests whether x is an nth power of a rational number.
If so, it returns true and the exact root in *root, else it returns
@@ -1710,7 +1750,7 @@ for class cl_N:
cl_N sqrt (const cl_N& z)
z, as defined by the formula
sqrt(z) = exp(log(z)/2). Conversion to a floating-point type
or to a complex number are done if necessary. The range of the result is the
@@ -1722,9 +1762,9 @@ The result is an exact number only if z is an exact number.
-4.8 Transcendental functions
+4.8 Transcendental functions
cos(0) = 1 returns the rational number 1.
-4.8.1 Exponential and logarithmic functions
+4.8.1 Exponential and logarithmic functions
@@ -1798,7 +1838,7 @@ The constant e = exp(1) = 2.71828... is returned by the following functions:
cl_R exp (const cl_R& x)
cl_N exp (const cl_N& x)
x. This is e^x where
@@ -1751,12 +1791,12 @@ is the entire complex plane excluding 0.
cl_R ln (const cl_R& x)
x must be > 0. Returns the (natural) logarithm of x.
cl_N log (const cl_N& x)
x is real and positive,
this is ln(x). In general, log(x) = log(abs(x)) + i*phase(x).
The range of the result is the strip in the complex plane
@@ -1764,7 +1804,7 @@ The range of the result is the strip in the complex plane
cl_R phase (const cl_N& x)
x in its polar representation as a
complex number. That is, phase(x) = atan(realpart(x),imagpart(x)).
This is also the imaginary part of log(x).
@@ -1786,7 +1826,7 @@ Returns the logarithm of a with respect to base b.
cl_N expt (const cl_N& x, const cl_N& y)
x^y = exp(y*log(x)).
cl_F cl_exp1 (cl_float_format_t f)
f.
cl_F cl_exp1 (const cl_F& y)
@@ -1812,13 +1852,13 @@ Returns e as a float of format cl_default_float_format.
-4.8.2 Trigonometric functions
+4.8.2 Trigonometric functions
cl_R sin (const cl_R& x)
sin(x). The range of the result is the interval
-1 <= sin(x) <= 1.
@@ -1828,7 +1868,7 @@ Returns sin(z). The range of the result is the entire complex plane
cl_R cos (const cl_R& x)
cos(x). The range of the result is the interval
-1 <= cos(x) <= 1.
@@ -1838,31 +1878,31 @@ Returns cos(z). The range of the result is the entire complex plane
struct cl_cos_sin_t { cl_R cos; cl_R sin; };
cl_cos_sin_t cl_cos_sin (const cl_R& x)
sin(x) and cos(x). This is more efficient than
-
+
computing them separately. The relation cos^2 + sin^2 = 1 will
hold only approximately.
cl_R tan (const cl_R& x)
cl_N tan (const cl_N& x)
tan(x) = sin(x)/cos(x).
cl_N cis (const cl_R& x)
cl_N cis (const cl_N& x)
exp(i*x). The name `cis' means "cos + i sin", because
e^(i*x) = cos(x) + i*sin(x).
-
-
+
+
cl_N asin (const cl_N& z)
arcsin(z). This is defined as
@@ -1875,7 +1915,7 @@ with realpart = pi/2 and imagpart > 0.
cl_N acos (const cl_N& z)
arccos(z). This is defined as
arccos(z) = pi/2 - arcsin(z) = log(z+i*sqrt(1-z^2))/i
and satisfies arccos(-z) = pi - arccos(z).
@@ -1884,8 +1924,8 @@ The range of the result is the strip in the complex domain
with realpart = 0 and imagpart < 0 and the numbers
with realpart = pi and imagpart > 0.
-
-
+
+
cl_R atan (const cl_R& x, const cl_R& y)
realpart = pi/2 and imagpart <= 0.
cl_F cl_pi (cl_float_format_t f)
f.
cl_F cl_pi (const cl_F& y)
@@ -1937,13 +1977,13 @@ Returns pi as a float of format cl_default_float_format.
-4.8.3 Hyperbolic functions
+4.8.3 Hyperbolic functions
cl_R sinh (const cl_R& x)
sinh(x).
cl_N sinh (const cl_N& z)
@@ -1952,7 +1992,7 @@ Returns sinh(z). The range of the result is the entire complex plan
cl_R cosh (const cl_R& x)
cosh(x). The range of the result is the interval
cosh(x) >= 1.
@@ -1962,24 +2002,24 @@ Returns cosh(z). The range of the result is the entire complex plan
struct cl_cosh_sinh_t { cl_R cosh; cl_R sinh; };
cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x)
sinh(x) and cosh(x). This is more efficient than
computing them separately. The relation cosh^2 - sinh^2 = 1 will
hold only approximately.
cl_R tanh (const cl_R& x)
cl_N tanh (const cl_N& x)
tanh(x) = sinh(x)/cosh(x).
cl_N asinh (const cl_N& z)
arsinh(z). This is defined as
arsinh(z) = log(z+sqrt(1+z^2)) and satisfies
arsinh(-z) = -arsinh(z).
@@ -1990,7 +2030,7 @@ with imagpart = pi/2 and realpart < 0.
cl_N acosh (const cl_N& z)
arcosh(z). This is defined as
arcosh(z) = 2*log(sqrt((z+1)/2)+sqrt((z-1)/2)).
The range of the result is the half-strip in the complex domain
@@ -1999,7 +2039,7 @@ excluding the numbers with realpart = 0 and -pi < imagpar
cl_N atanh (const cl_N& z)
artanh(z). This is defined as
artanh(z) = (log(1+z)-log(1-z)) / 2 and satisfies
artanh(-z) = -artanh(z). The range of the result is
@@ -2011,9 +2051,9 @@ with imagpart = pi/2 and realpart >= 0.
-4.8.4 Euler gamma
+4.8.4 Euler gamma
cl_F cl_eulerconst (cl_float_format_t f)
f.
cl_F cl_eulerconst (const cl_F& y)
@@ -2038,14 +2078,14 @@ Returns Euler's constant as a float of format cl_default_float_format
Catalan's constant G = 0.915... is returned by the following functions:
-
+
@@ -2185,7 +2225,7 @@ These operations are all available though the function
cl_F cl_catalanconst (cl_float_format_t f)
f.
cl_F cl_catalanconst (const cl_F& y)
@@ -2059,9 +2099,9 @@ Returns Catalan's constant as a float of format cl_default_float_format4.8.5 Riemann zeta
+4.8.5 Riemann zeta
cl_F cl_zeta (int s, cl_float_format_t f)
s as a float of format f.
cl_F cl_zeta (int s, const cl_F& y)
@@ -2088,11 +2128,11 @@ Returns Riemann's zeta function at s as a float of format
-4.9 Functions on integers
+4.9 Functions on integers
-4.9.1 Logical functions
+4.9.1 Logical functions
cl_I lognot (const cl_I& x)
cl_I operator ~ (const cl_I& x)
~x in C. This is the same as -1-x.
cl_I logand (const cl_I& x, const cl_I& y)
cl_I operator & (const cl_I& x, const cl_I& y)
x & y in C.
cl_I logior (const cl_I& x, const cl_I& y)
cl_I operator | (const cl_I& x, const cl_I& y)
x | y in C.
cl_I logxor (const cl_I& x, const cl_I& y)
cl_I operator ^ (const cl_I& x, const cl_I& y)
x ^ y in C.
cl_I logeqv (const cl_I& x, const cl_I& y)
~(x ^ y) in C.
cl_I lognand (const cl_I& x, const cl_I& y)
~(x & y) in C.
cl_I lognor (const cl_I& x, const cl_I& y)
~(x | y) in C.
cl_I logandc1 (const cl_I& x, const cl_I& y)
~x & y in C.
cl_I logandc2 (const cl_I& x, const cl_I& y)
x & ~y in C.
cl_I logorc1 (const cl_I& x, const cl_I& y)
~x | y in C.
cl_I logorc2 (const cl_I& x, const cl_I& y)
x | ~y in C.
cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)
op must have one of the 16 values (each one stands for a function
@@ -2194,13 +2234,6 @@ which combines two bits into one bit): boole_clr, boole_set
boole_and, boole_ior, boole_xor, boole_eqv,
boole_nand, boole_nor, boole_andc1, boole_andc2,
boole_orc1, boole_orc2.
-
-
-
-
-
-
-
@@ -2209,6 +2242,13 @@ which combines two bits into one bit): boole_clr, boole_set
+
+
+
+
+
+
+
cl_boolean logtest (const cl_I& x, const cl_I& y)
x and y, i.e. if
logand(x,y) != 0.
cl_boolean logbitp (const cl_I& n, const cl_I& x)
nth bit (from the right) of x is set.
Bit 0 is the least significant bit.
uintL logcount (const cl_I& x)
x, if x >= 0, or
the number of zero bits in x, if x < 0.
@@ -2245,7 +2285,7 @@ struct cl_byte { uintL size; uintL position; };
position...position+size-1 of an integer.
The constructor cl_byte(size,position) constructs a cl_byte.
@@ -2255,19 +2295,19 @@ The constructor cl_byte(size,position) constructs a cl_byte
cl_I ldb (const cl_I& n, const cl_byte& b)
n described by the bit interval b
and returns them as a nonnegative integer with b.size bits.
cl_boolean ldb_test (const cl_I& n, const cl_byte& b)
b is set in
n.
cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
n, with the bits described by the bit interval b
replaced by newbyte. Only the lowest b.size bits of
newbyte are relevant.
@@ -2282,13 +2322,13 @@ functions are their counterparts without shifting:
cl_I mask_field (const cl_I& n, const cl_byte& b)
b
copied from the corresponding bits in n, the other bits zero.
cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
b
come from newbyte and the other bits come from n.
@@ -2319,39 +2359,39 @@ for common arithmetic operations:
cl_boolean oddp (const cl_I& x)
x is 1. Equivalent to
mod(x,2) != 0.
cl_boolean evenp (const cl_I& x)
x is 0. Equivalent to
mod(x,2) == 0.
cl_I operator << (const cl_I& x, const cl_I& n)
x by n bits to the left. n should be >=0.
Equivalent to x * expt(2,n).
cl_I operator >> (const cl_I& x, const cl_I& n)
x by n bits to the right. n should be >=0.
Bits shifted out to the right are thrown away.
Equivalent to floor(x / expt(2,n)).
cl_I ash (const cl_I& x, const cl_I& y)
x by y bits to the left (if y>=0) or
by -y bits to the right (if y<=0). In other words, this
returns floor(x * expt(2,y)).
uintL integer_length (const cl_I& x)
x
in two's complement notation. This is the smallest n >= 0 such that
-2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that
@@ -2359,14 +2399,14 @@ in two's complement notation. This is the smallest n >= 0 such that
uintL ord2 (const cl_I& x)
x must be non-zero. This function returns the number of 0 bits at the
right of x in two's complement notation. This is the largest n >= 0
such that 2^n divides x.
uintL power2p (const cl_I& x)
x must be > 0. This function checks whether x is a power of 2.
If x = 2^(n-1), it returns n. Else it returns 0.
(See also the function logp.)
@@ -2374,13 +2414,13 @@ If x = 2^(n-1), it returns n. Else it returns 0.
-4.9.2 Number theoretic functions
+4.9.2 Number theoretic functions
-uint32 gcd (uint32 a, uint32 b)
cl_I gcd (const cl_I& a, const cl_I& b)
a and b,
@@ -2388,7 +2428,7 @@ normalized to be >= 0.
cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)
g of
a and b and at the same time the representation of g
as an integral linear combination of a and b:
@@ -2400,13 +2440,13 @@ value, in the following sense: If a and b are non-zero
cl_I lcm (const cl_I& a, const cl_I& b)
a and b,
normalized to be >= 0.
cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l)
cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l)
a must be > 0. b must be >0 and != 1. If log(a,b) is
@@ -2416,26 +2456,26 @@ it returns false.
-4.9.3 Combinatorial functions
+4.9.3 Combinatorial functions
-cl_I factorial (uintL n)
n must be a small integer >= 0. This function returns the factorial
n! = 1*2*...*n.
cl_I doublefactorial (uintL n)
n must be a small integer >= 0. This function returns the
doublefactorial n!! = 1*3*...*n or
n!! = 2*4*...*n, respectively.
cl_I binomial (uintL n, uintL k)
n and k must be small integers >= 0. This function returns the
binomial coefficient
(n choose k) = n! / k! (n-k)!
@@ -2444,7 +2484,7 @@ for 0 <= k <= n, 0 else.
-4.10 Functions on floating-point numbers
+4.10 Functions on floating-point numbers
s, an
@@ -2462,7 +2502,7 @@ defines the following operations.
type scale_float (const type& x, sintL delta)
type scale_float (const type& x, const cl_I& delta)
x*2^delta. This is more efficient than an explicit multiplication
@@ -2478,32 +2518,32 @@ representation of floating-point numbers.
sintL float_exponent (const type& x)
e of x.
For x = 0.0, this is 0. For x non-zero, this is the unique
integer with 2^(e-1) <= abs(x) < 2^e.
sintL float_radix (const type& x)
2.
type float_sign (const type& x)
s of x as a float. The value is 1 for
x >= 0, -1 for x < 0.
uintL float_digits (const type& x)
x, including the hidden bit. The value only depends on the type
of x, not on its value.
uintL float_precision (const type& x)
x. Since denormalized numbers are not supported,
this is the same as float_digits(x) if x is non-zero, and
@@ -2512,11 +2552,11 @@ this is the same as float_digits(x) if x is non-zero,
cl_decoded_float (or cl_decoded_sfloat, cl_decoded_ffloat,
cl_decoded_dfloat, cl_decoded_lfloat, respectively), defined by
@@ -2534,7 +2574,7 @@ and returned by the function
cl_decoded_typefloat decode_float (const type& x)
x non-zero, this returns (-1)^s, e, m with
x = (-1)^s * 2^e * m and 0.5 <= m < 1.0. For x = 0,
it returns (-1)^s=1, e=0, m=0.
@@ -2545,7 +2585,7 @@ it returns (-1)^s=1, e=0, m=0.
A complete decoding in terms of integers is provided as type
-struct cl_idecoded_float {
+struct cl_idecoded_float {
cl_I mantissa; cl_I exponent; cl_I sign;
};
@@ -2558,7 +2598,7 @@ by the following function:
cl_idecoded_float integer_decode_float (const type& x)
x non-zero, this returns (-1)^s, e, m with
x = (-1)^s * 2^e * m and m an integer with float_digits(x)
bits. For x = 0, it returns (-1)^s=1, e=0, m=0.
@@ -2574,7 +2614,7 @@ Some other function, implemented only for class cl_F:
cl_F float_sign (const cl_F& x, const cl_F& y)
y and whose sign is that of x. If x is
zero, it is treated as positive. Same for y.
@@ -2582,24 +2622,25 @@ zero, it is treated as positive. Same for y.
-4.11 Conversion functions
+4.11 Conversion functions
4.11.1 Conversion to floating-point numbers
+4.11.1 Conversion to floating-point numbers
cl_float_format_t describes a floating-point format.
+
@@ -2625,7 +2666,7 @@ defines the following operations:
cl_float_format_t cl_float_format (uintL n)
n
decimal digits in the mantissa (after the decimal point).
@@ -2609,7 +2650,7 @@ Returns the floating point format of x.
cl_float_format_t cl_default_float_format
cl_F cl_float (const type&x, cl_float_format_t f)
x as a float of format f.
cl_F cl_float (const type&x, const cl_F& y)
cl_F most_positive_float (cl_float_format_t f)
f.
cl_F most_negative_float (cl_float_format_t f)
f.
cl_F least_positive_float (cl_float_format_t f)
f.
cl_F least_negative_float (cl_float_format_t f)
f.
cl_F float_epsilon (cl_float_format_t f)
1+e != 1.
cl_F float_negative_epsilon (cl_float_format_t f)
1-e != 1.
4.11.2 Conversion to rational numbers
+4.11.2 Conversion to rational numbers
cl_R, cl_RA, cl_F
@@ -2692,7 +2733,7 @@ defines the following operation:
cl_RA rational (const type& x)
x as an exact number. If x is already
an exact number, this is x. If x is a floating-point number,
the value is a rational number whose denominator is a power of 2.
@@ -2707,7 +2748,7 @@ the function
cl_RA rationalize (const cl_R& x)
x is a floating-point number, it actually represents an interval
of real numbers, and this function returns the rational number with
smallest denominator (and smallest numerator, in magnitude)
@@ -2731,7 +2772,7 @@ If x is any float, one has
-4.12 Random number generators
+4.12 Random number generators
cl_random_state cl_default_random_state
@@ -2766,14 +2808,14 @@ below are called without
cl_random_state argument.
uint32 random32 ()
cl_I random_I (cl_random_state& randomstate, const cl_I& n)
cl_I random_I (const cl_I& n)
n must be an integer > 0. This function returns a random integer x
in the range 0 <= x < n.
@@ -2781,7 +2823,7 @@ in the range 0 <= x < n.
cl_F random_F (const cl_F& n)
n must be a float > 0. This function returns a random floating-point
number of the same format as n in the range 0 <= x < n.
@@ -2789,16 +2831,16 @@ number of the same format as n in the range 0 <= x <
cl_R random_R (const cl_R& n)
random_I if n is an integer and like random_F
if n is a float.
4.13 Obfuscating operators
+4.13 Obfuscating operators
cl_N, cl_R, cl_RA,
type& operator += (type&, const type&)
type& operator -= (type&, const type&)
type& operator *= (type&, const type&)
type& operator /= (type&, const type&)
cl_I:
type& operator &= (type&, const type&)
type& operator |= (type&, const type&)
type& operator ^= (type&, const type&)
type& operator <<= (type&, const type&)
type& operator >>= (type&, const type&)
cl_N, cl_R, cl_RA,
type& operator ++ (type& x)
++x.
void operator ++ (type& x, int)
@@ -2887,7 +2929,7 @@ The postfix operator x++.
type& operator -- (type& x)
--x.
void operator -- (type& x, int)
@@ -2903,16 +2945,16 @@ efficient.
-5. Input/Output
+5. Input/Output
5.1 Internal and printed representation
+5.1 Internal and printed representation
read(print(x)) == x.
@@ -3009,7 +3051,7 @@ In Common Lisp notation: #C(realpart imagpart)5.2 Input functions
+5.2 Input functions
<cl_io.h> defines a type cl_istream, which is
@@ -3161,7 +3203,7 @@ precision corresponding to their number of significant digits.
-5.3 Output functions
+5.3 Output functions
<cl_io.h> defines a type cl_ostream, which is
@@ -3316,7 +3358,7 @@ used by the function fprint.
-6. Rings
+6. Rings
7. Modular integers
+7. Modular integers
7.1 Modular integer rings
+7.1 Modular integer rings
cl_modint_ring cl_find_modint_ring (const cl_I& N)
N, like powers of two
and odd numbers for which Montgomery multiplication will be a win,
-
+
and precomputes any necessary auxiliary data for computing modulo N.
There is a cache table of rings, indexed by N (or, more precisely,
by abs(N)). This ensures that the precomputation costs are reduced
@@ -3490,10 +3536,10 @@ Modular integer rings can be compared for equality:
bool operator== (const cl_modint_ring&, const cl_modint_ring&)
bool operator!= (const cl_modint_ring&, const cl_modint_ring&)
cl_find_modint_ring with the same argument necessarily return the
same ring because it is memoized in the cache table.
@@ -3501,7 +3547,7 @@ same ring because it is memoized in the cache table.
-7.2 Functions on modular integers
+7.2 Functions on modular integers
R, the following members can be used.
@@ -3511,27 +3557,27 @@ Given a modular integer ring R, the following members can be used.
cl_I R->modulus
abs(N).
cl_MI R->zero()
0 mod N.
cl_MI R->one()
1 mod N.
cl_MI R->canonhom (const cl_I& x)
x mod N.
cl_I R->retract (const cl_MI& x)
R->canonhom. It returns the
standard representative (>=0, <N) of x.
@@ -3539,7 +3585,7 @@ standard representative (>=0, <N) of x
cl_MI R->random()
N.
@@ -3551,18 +3597,18 @@ The following operations are defined on modular integers.
cl_modint_ring x.ring ()
x belongs.
cl_MI operator+ (const cl_MI&, const cl_MI&)
cl_MI operator- (const cl_MI&, const cl_MI&)
cl_MI operator* (const cl_MI&, const cl_MI&)
cl_MI square (const cl_MI&)
cl_MI recip (const cl_MI& x)
x^-1 of a modular integer x. x
must be coprime to the modulus, otherwise an error message is issued.
cl_MI div (const cl_MI& x, const cl_MI& y)
x*y^-1 of two modular integers x, y.
y must be coprime to the modulus, otherwise an error message is issued.
cl_MI expt_pos (const cl_MI& x, const cl_I& y)
y must be > 0. Returns x^y.
cl_MI expt (const cl_MI& x, const cl_I& y)
x^y. If y is negative, x must be coprime to the
modulus, else an error message is issued.
cl_MI operator<< (const cl_MI& x, const cl_I& y)
x*2^y.
cl_MI operator>> (const cl_MI& x, const cl_I& y)
x*2^-y. When y is positive, the modulus must be odd,
or an error message is issued.
bool operator== (const cl_MI&, const cl_MI&)
bool operator!= (const cl_MI&, const cl_MI&)
cl_boolean zerop (const cl_MI& x)
x is 0 mod N.
@@ -3639,19 +3685,19 @@ input/output).
void fprint (cl_ostream stream, const cl_MI& x)
cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
x on the stream. The output may depend
on the global printer settings in the variable cl_default_print_flags.
-8. Symbolic data types
+8. Symbolic data types
8.1 Strings
+8.1 Strings
cl_string (const char * s)
s.
cl_string (const char * ptr, unsigned long len)
@@ -3709,30 +3755,30 @@ Assignment from cl_string and const char *.
s.length()
strlen(s)
s.
s[i]
ith character of the string s.
i must be in the range 0 <= i < s.length().
bool equal (const cl_string& s1, const cl_string& s2)
const char *.
-8.2 Symbols
+8.2 Symbols
cl_symbol (const cl_string& s)
cl_string: Returns the string which names the symbol
bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
9. Univariate polynomials
+9. Univariate polynomials
9.1 Univariate polynomial rings
+9.1 Univariate polynomial rings
cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R)
cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R)
@@ -3916,7 +3962,7 @@ only the return type is more specific, according to the base ring's type.
-9.2 Functions on univariate polynomials
+9.2 Functions on univariate polynomials
R, the following members can be used.
@@ -3926,33 +3972,33 @@ Given a univariate polynomial ring R, the following members can be
cl_ring R->basering()
cl_UP R->zero()
0 in R, a polynomial of degree -1.
cl_UP R->one()
1 in R, a polynomial of degree <= 0.
cl_UP R->canonhom (const cl_I& x)
x in R, a polynomial of degree <= 0.
cl_UP R->monomial (const cl_ring_element& x, uintL e)
x * X^e, where X is the
indeterminate.
cl_UP R->create (sintL degree)
-1. After creating the polynomial, you should put in the coefficients,
using the set_coeff member function, and then call the finalize
@@ -3967,14 +4013,14 @@ The following are the only destructive operations on univariate polynomials.
void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)
X^index in x to be y.
After changing a polynomial and before applying any "normal" operation on it,
you should call its finalize member function.
void finalize (cl_UP& x)
cl_univpoly_ring x.ring ()
x belongs.
cl_UP operator+ (const cl_UP&, const cl_UP&)
cl_UP operator- (const cl_UP&, const cl_UP&)
cl_UP operator- (const cl_UP&)
@@ -4008,54 +4054,54 @@ Returns the negative of a univariate polynomial.
cl_UP operator* (const cl_UP&, const cl_UP&)
cl_UP square (const cl_UP&)
cl_UP expt_pos (const cl_UP& x, const cl_I& y)
y must be > 0. Returns x^y.
bool operator== (const cl_UP&, const cl_UP&)
bool operator!= (const cl_UP&, const cl_UP&)
cl_boolean zerop (const cl_UP& x)
x is 0 in R.
sintL degree (const cl_UP& x)
-1.
cl_ring_element coeff (const cl_UP& x, uintL index)
X^index in the polynomial x.
cl_ring_element x (const cl_ring_element& y)
x is a polynomial and y belongs to the base ring,
then `x(y)' returns the value of the substitution of y into
x.
cl_UP deriv (const cl_UP& x)
x with respect to the
indeterminate X.
@@ -4069,10 +4115,10 @@ input/output).
void fprint (cl_ostream stream, const cl_UP& x)
cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
x on the stream. The output may
depend on the global printer settings in the variable
cl_default_print_flags.
@@ -4080,7 +4126,7 @@ depend on the global printer settings in the variable
-9.3 Special polynomials
+9.3 Special polynomials
cl_UP_I cl_tschebychev (sintL n)
cl_UP_I cl_hermite (sintL n)
cl_UP_RA cl_legendre (sintL n)
cl_UP_I cl_laguerre (sintL n)
10. Internals
+10. Internals
-10.1 Why C++ ?
+10.1 Why C++ ?
10.2 Memory efficiency
+10.2 Memory efficiency
x+0 returns x withou
it.
10.3 Speed efficiency
+10.3 Speed efficiency
10.4 Garbage collection
+10.4 Garbage collection
11. Using the library
+11. Using the library
11.1 Compiler options
+11.1 Compiler options
-lcln.
-11.2 Include files
+11.2 Include files
11.3 An Example
+11.3 An Example
11.4 Debugging support
+11.4 Debugging support
cl_print, callable from the debugger,
for printing number objects. In order to get this function, you have
to define the macro `CL_DEBUG' and then include all the header files
for which you want cl_print debugging support. For example:
-
+
#define CL_DEBUG
@@ -4669,7 +4715,7 @@ only with number objects and similar. Therefore CLN offers a member function
debug_print() on all CLN types. The same macro `CL_DEBUG'
is needed for this member function to be implemented. Under gdb,
you call it like this:
-
+
(gdb) print s
@@ -4689,14 +4735,14 @@ Unfortunately, this feature does not seem to work under all circumstances.
-
12. Customizing
+12. Customizing
12.1 Error handling
+12.1 Error handling
12.2 Floating-point underflow
+12.2 Floating-point underflow
12.3 Customizing I/O
+12.3 Customizing I/O
fprint may be customized by changing the
value of the global variable cl_default_print_flags.
-
+
-12.4 Customizing the memory allocator
+12.4 Customizing the memory allocator
cl_malloc_hook function must not return a NULL pointer.
@@ -4782,7 +4828,7 @@ global variables.
-Index
+Index