diff --git a/doc/cln.dvi b/doc/cln.dvi index a1e064d..086cf54 100644 Binary files a/doc/cln.dvi and b/doc/cln.dvi differ diff --git a/doc/cln.html b/doc/cln.html index 9e9c2b8..f464153 100644 --- a/doc/cln.html +++ b/doc/cln.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers @@ -243,8 +243,9 @@ The kernel of CLN has been written in assembly language for some CPUs (i386, m68k, sparc, mips, arm).
  • -On all CPUs, CLN uses the superefficient low-level routines from GNU -GMP version 2. + +On all CPUs, CLN may be configured to use the superefficient low-level +routines from GNU GMP version 3.
  • It uses Karatsuba multiplication, which is significantly faster @@ -253,9 +254,9 @@ for large numbers than the standard multiplication algorithm. For very large numbers (more than 12000 decimal digits), it uses Schönhage-Strassen -multiplication, which is an asymptotically -optimal multiplication algorithm, for multiplication, division and -radix conversion. + +multiplication, which is an asymptotically optimal multiplication +algorithm, for multiplication, division and radix conversion.

    @@ -292,7 +293,7 @@ This section describes how to install the CLN package on your system. To build CLN, you need a C++ compiler. Actually, you need GNU g++ 2.7.0 or newer. On HPPA, you need GNU g++ 2.8.0 or newer. -I recommend GNU egcs 1.1 or newer. +I recommend GNU g++ 2.95 or newer.

    @@ -315,6 +316,8 @@ of static and global variables, a feature which I could implement for GNU g++ only. +

    +

    2.1.2 Make utility

    @@ -323,6 +326,8 @@ implement for GNU g++ only. To build CLN, you also need to have GNU make installed. +

    +

    2.1.3 Sed utility

    @@ -446,11 +451,6 @@ With full `-O2', g++ miscompiles the division routines --enable-shared to work, you need egcs-1.1.2 or newer. -

    -On MIPS (SGI Irix 6), pass option --without-gmp to configure. gmp does -not work when compiled in `n32' binary format on Irix. - -

    By default, only a static library is built. You can build CLN as a shared library too, by calling configure with the option `--enable-shared'. @@ -467,6 +467,9 @@ library.

    2.3 Installing the library

    +

    + +

    As with any autoconfiguring GNU software, installation is as easy as this: @@ -552,6 +555,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 @@ -559,17 +564,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 @@ -577,6 +589,7 @@ to integers.

    + The class cl_F implements floating-point approximations to real numbers. It is an abstract class. @@ -584,6 +597,9 @@ It is an abstract class.

    3.1 Exact numbers

    +

    + +

    Some numbers are represented as exact numbers: there is no loss of information @@ -625,6 +641,9 @@ is completely transparent.

    3.2 Floating-point numbers

    +

    + +

    Not all real numbers can be represented exactly. (There is an easy mathematical @@ -635,6 +654,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 @@ -665,6 +685,7 @@ Floating point numbers come in four flavors:

    diff --git a/doc/cln_10.html b/doc/cln_10.html index 059d504..d858b76 100644 --- a/doc/cln_10.html +++ b/doc/cln_10.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 10. Internals @@ -14,6 +14,9 @@ Go to the first, previous, 10.1 Why C++ ? +

    + +

    Using C++ as an implementation language provides @@ -27,6 +30,7 @@ Efficiency: It compiles to machine code.

  • + Portability: It runs on all platforms supporting a C++ compiler. Because of the availability of GNU C++, this includes all currently used 32-bit and 64-bit platforms, independently of the quality of the vendor's C++ compiler. @@ -36,7 +40,7 @@ of the availability of GNU C++, this includes all currently used 32-bit and Type safety: The C++ compilers knows about the number types and complains if, for example, you try to assign a float to an integer variable. However, a drawback is that C++ doesn't know about generic types, hence a restriction -like that operation+ (const cl_MI&, const cl_MI&) requires that both +like that operator+ (const cl_MI&, const cl_MI&) requires that both arguments belong to the same modular ring cannot be expressed as a compile-time information. @@ -72,6 +76,8 @@ Object sharing: An operation like x+0 returns x withou it.
  • + + Garbage collection: A reference counting mechanism makes sure that any number object's storage is freed immediately when the last reference to the object is gone. @@ -104,8 +110,8 @@ The kernel of CLN has been written in assembly language for some CPUs (i386, m68k, sparc, mips, arm).
  • -On all CPUs, CLN uses the superefficient low-level routines from GNU -GMP version 2. +On all CPUs, CLN may be configured to use the superefficient low-level +routines from GNU GMP version 3.
  • For large numbers, CLN uses, instead of the standard O(N^2) @@ -116,6 +122,7 @@ algorithm. For very large numbers (more than 12000 decimal digits), CLN uses Schönhage-Strassen + multiplication, which is an asymptotically optimal multiplication algorithm.
  • @@ -127,6 +134,9 @@ of division and radix conversion.

    10.4 Garbage collection

    +

    + +

    All the number classes are reference count classes: They only contain a pointer diff --git a/doc/cln_11.html b/doc/cln_11.html index 61ab64b..411c047 100644 --- a/doc/cln_11.html +++ b/doc/cln_11.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 11. Using the library @@ -22,6 +22,9 @@ environment variables, or directly substitute the appropriate values.

    11.1 Compiler options

    +

    + +

    Until you have installed CLN in a public place, the following options are @@ -58,6 +61,10 @@ linking a CLN application it is sufficient to give the flag -lcln.

    11.2 Include files

    +

    + + +

    Here is a summary of the include files and their contents. @@ -253,6 +260,7 @@ Includes all of the above.

    A function which computes the nth Fibonacci number can be written as follows. + @@ -329,9 +337,17 @@ automatically reclaimed (garbage collected). Only the result survives and gets passed to the caller. +

    +The file fibonacci.cc in the subdirectory examples +contains this implementation together with an even faster algorithm. + +

    11.4 Debugging support

    +

    + +

    When debugging a CLN application with GNU gdb, two facilities are @@ -364,6 +380,7 @@ CLN offers a function 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
    @@ -390,6 +407,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
    diff --git a/doc/cln_12.html b/doc/cln_12.html
    index 0070b35..9399348 100644
    --- a/doc/cln_12.html
    +++ b/doc/cln_12.html
    @@ -1,6 +1,6 @@
     
     
    -
    +
     
     CLN, a Class Library for Numbers - 12. Customizing
     
    @@ -10,6 +10,9 @@ Go to the first, previous, 12. Customizing
    +

    + + @@ -28,12 +31,16 @@ void cl_abort (void);

    + This function must not return control to its caller.

    12.2 Floating-point underflow

    +

    + +

    Floating point underflow denotes the situation when a floating-point number @@ -47,9 +54,8 @@ cl_boolean cl_inhibit_floating_point_underflow

    to cl_true, the error will be inhibited, and a floating-point zero -will be generated instead. -The default value of cl_inhibit_floating_point_underflow is -cl_false. +will be generated instead. The default value of +cl_inhibit_floating_point_underflow is cl_false. @@ -59,6 +65,7 @@ The default value of cl_inhibit_floating_point_underflow is

    The output of the function fprint may be customized by changing the value of the global variable cl_default_print_flags. + @@ -82,6 +89,8 @@ void (*cl_free_hook) (void* ptr) = ...;

    + + The cl_malloc_hook function must not return a NULL pointer. diff --git a/doc/cln_13.html b/doc/cln_13.html index 7186cd1..1240d1e 100644 --- a/doc/cln_13.html +++ b/doc/cln_13.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - Index diff --git a/doc/cln_2.html b/doc/cln_2.html index 2a92f22..d9f2136 100644 --- a/doc/cln_2.html +++ b/doc/cln_2.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 2. Installation @@ -27,7 +27,7 @@ This section describes how to install the CLN package on your system. To build CLN, you need a C++ compiler. Actually, you need GNU g++ 2.7.0 or newer. On HPPA, you need GNU g++ 2.8.0 or newer. -I recommend GNU egcs 1.1 or newer. +I recommend GNU g++ 2.95 or newer.

    @@ -50,6 +50,8 @@ of static and global variables, a feature which I could implement for GNU g++ only. +

    +

    2.1.2 Make utility

    @@ -58,6 +60,8 @@ implement for GNU g++ only. To build CLN, you also need to have GNU make installed. +

    +

    2.1.3 Sed utility

    @@ -181,11 +185,6 @@ With full `-O2', g++ miscompiles the division routines --enable-shared to work, you need egcs-1.1.2 or newer. -

    -On MIPS (SGI Irix 6), pass option --without-gmp to configure. gmp does -not work when compiled in `n32' binary format on Irix. - -

    By default, only a static library is built. You can build CLN as a shared library too, by calling configure with the option `--enable-shared'. @@ -202,6 +201,9 @@ library.

    2.3 Installing the library

    +

    + +

    As with any autoconfiguring GNU software, installation is as easy as this: diff --git a/doc/cln_3.html b/doc/cln_3.html index 9db9d05..ed3eae4 100644 --- a/doc/cln_3.html +++ b/doc/cln_3.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 3. Ordinary number types @@ -45,6 +45,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 @@ -52,17 +54,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 @@ -70,6 +79,7 @@ to integers.

    + The class cl_F implements floating-point approximations to real numbers. It is an abstract class. @@ -77,6 +87,9 @@ It is an abstract class.

    3.1 Exact numbers

    +

    + +

    Some numbers are represented as exact numbers: there is no loss of information @@ -118,6 +131,9 @@ is completely transparent.

    3.2 Floating-point numbers

    +

    + +

    Not all real numbers can be represented exactly. (There is an easy mathematical @@ -128,6 +144,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 @@ -158,6 +175,7 @@ Floating point numbers come in four flavors:

    • + Short floats, type cl_SF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 17 mantissa bits (including the "hidden" bit). @@ -165,6 +183,7 @@ They don't consume heap allocation.
    • + Single floats, type cl_FF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 24 mantissa bits (including the "hidden" bit). @@ -173,6 +192,7 @@ This corresponds closely to the C/C++ type `float'.
    • + Double floats, type cl_DF. They have 1 sign bit, 11 exponent bits (including the exponent's sign), and 53 mantissa bits (including the "hidden" bit). @@ -181,6 +201,7 @@ This corresponds closely to the C/C++ type `double'.
    • + Long floats, type 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. @@ -201,6 +222,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 @@ -216,6 +238,9 @@ the floating point contagion rule happened to change in the future.)

      3.3 Complex numbers

      +

      + +

      Complex numbers, as implemented by the class cl_N, have a real @@ -232,6 +257,9 @@ through application of sqrt or transcendental functions.

      3.4 Conversions

      +

      + +

      Conversions from any class to any its superclasses ("base classes" in @@ -289,6 +317,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";
      @@ -308,12 +337,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)
      + Returns x as element of the C type ctype. If x is not representable in the range of ctype, a runtime error occurs. @@ -330,8 +363,10 @@ the functions
      float cl_float_approx (const type& x)
      +
      double cl_double_approx (const type& x)
      + Returns an approximation of 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. @@ -342,8 +377,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. diff --git a/doc/cln_4.html b/doc/cln_4.html index f9ac86e..4bf113f 100644 --- a/doc/cln_4.html +++ b/doc/cln_4.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 4. Functions on numbers @@ -109,10 +109,12 @@ defines the following operations:
      type operator + (const type&, const type&)
      + Addition.
      type operator - (const type&, const type&)
      + Subtraction.
      type operator - (const type&) @@ -121,18 +123,22 @@ Returns the negative of the argument.
      type plus1 (const type& x)
      + Returns x + 1.
      type minus1 (const type& x)
      + Returns x - 1.
      type operator * (const type&, const type&)
      + Multiplication.
      type square (const type& x)
      + Returns x * x. @@ -146,10 +152,12 @@ defines the following operations:
      type operator / (const type&, const type&)
      + Division.
      type recip (const type&)
      + Returns the reciprocal of the argument. @@ -165,6 +173,7 @@ Instead, cl_I defines an "exact quotient" function:
      cl_I exquo (const cl_I& x, const cl_I& y)
      + Checks that y divides x, and returns the quotient x/y. @@ -176,12 +185,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) @@ -199,6 +210,7 @@ defines the following operation:
      type abs (const type& x)
      + Returns the absolute value of x. This is x if x >= 0, and -x if x <= 0. @@ -224,6 +236,7 @@ defines the following operation:
      type signum (const type& x)
      + Returns the sign of 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 @@ -242,10 +255,12 @@ Each of the classes cl_RA, cl_I defines the following
      cl_I numerator (const type& x)
      + Returns the numerator of x.
      cl_I denominator (const type& x)
      + Returns the denominator of x. @@ -266,6 +281,7 @@ The class cl_N defines the following operation:
      cl_N complex (const cl_R& a, const cl_R& b)
      + Returns the complex number a+bi, that is, the complex number with real part a and imaginary part b. @@ -278,14 +294,17 @@ Each of the classes cl_N, cl_R defines the following o
      cl_R realpart (const type& x)
      + Returns the real part of x.
      cl_R imagpart (const type& x)
      + Returns the imaginary part of x.
      type conjugate (const type& x)
      + Returns the complex conjugate of x. @@ -306,6 +325,9 @@ We have the relations

      4.5 Comparisons

      +

      + +

      Each of the classes cl_N, cl_R, cl_RA, cl_I, @@ -317,18 +339,22 @@ defines the following operations:

      bool operator == (const type&, const type&)
      +
      bool operator != (const type&, const type&)
      + Comparison, as in C and C++.
      uint32 cl_equal_hashcode (const type&)
      + Returns a 32-bit hash code that is the same for any two numbers which are the same according to ==. This hash code depends on the number's value, not its type or precision.
      cl_boolean zerop (const type& x)
      + Compare against zero: x == 0 @@ -342,33 +368,42 @@ defines the following operations:
      cl_signean cl_compare (const type& x, const type& y)
      + Compares 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&)
      + Comparison, as in C and C++.
      cl_boolean minusp (const type& x)
      + Compare against zero: x < 0
      cl_boolean plusp (const type& x)
      + Compare against zero: x > 0
      type max (const type& x, const type& y)
      + Return the maximum of x and y.
      type min (const type& x, const type& y)
      + Return the minimum of x and y. @@ -384,6 +419,9 @@ there is no floating point number whose value is exactly 1/3.

      4.6 Rounding functions

      +

      + +

      When a real number is to be converted to an integer, there is no "best" @@ -453,15 +491,19 @@ defines the following operations:

      cl_I floor1 (const type& x)
      + Returns floor(x).
      cl_I ceiling1 (const type& x)
      + Returns ceiling(x).
      cl_I truncate1 (const type& x)
      + Returns truncate(x).
      cl_I round1 (const type& x)
      + Returns round(x). @@ -550,12 +592,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)
      +

      @@ -574,12 +620,16 @@ defines the following operations:

      type ffloor (const type& x)
      +
      type fceiling (const type& x)
      +
      type ftruncate (const type& x)
      +
      type fround (const type& x)
      +

      @@ -619,12 +669,16 @@ 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)
      +

      and similarly for class cl_R, but with quotient type cl_F. @@ -679,8 +733,10 @@ The classes cl_R, cl_I define the following operations

      type mod (const type& x, const type& y)
      +
      type rem (const type& x, const type& y)
      + @@ -697,6 +753,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 @@ -711,6 +768,7 @@ The classes cl_RA, cl_I define the following operation
      cl_boolean sqrtp (const type& x, type* root)
      + This tests whether x is a perfect square. If so, it returns true and the exact square root in *root, else it returns false. @@ -723,6 +781,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). @@ -737,6 +796,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 @@ -752,6 +812,7 @@ for class cl_N:
      cl_N sqrt (const cl_N& z)
      + Returns the square root of 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 @@ -764,6 +825,9 @@ The result is an exact number only if z is an exact number.

      4.8 Transcendental functions

      +

      + +

      The transcendental functions return an exact result if the argument @@ -780,6 +844,7 @@ For example, cos(0) = 1 returns the rational number 1.

      cl_R exp (const cl_R& x)
      +
      cl_N exp (const cl_N& x)
      Returns the exponential function of x. This is e^x where @@ -788,10 +853,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)
      + Returns the (natural) logarithm of x. If 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 @@ -799,6 +866,7 @@ The range of the result is the strip in the complex plane
      cl_R phase (const cl_N& x)
      + Returns the angle part of 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). @@ -820,6 +888,7 @@ Returns the logarithm of a with respect to base b.
      cl_N expt (const cl_N& x, const cl_N& y)
      + Exponentiation: Returns x^y = exp(y*log(x)). @@ -831,6 +900,7 @@ The constant e = exp(1) = 2.71828... is returned by the following functions:
      cl_F cl_exp1 (cl_float_format_t f)
      + Returns e as a float of format f.
      cl_F cl_exp1 (const cl_F& y) @@ -850,6 +920,7 @@ Returns e as a float of format cl_default_float_format.
      cl_R sin (const cl_R& x)
      + Returns sin(x). The range of the result is the interval -1 <= sin(x) <= 1. @@ -859,6 +930,7 @@ Returns sin(z). The range of the result is the entire complex plane
      cl_R cos (const cl_R& x)
      + Returns cos(x). The range of the result is the interval -1 <= cos(x) <= 1. @@ -868,25 +940,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)
      Returns both 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)
      Returns tan(x) = sin(x)/cos(x).
      cl_N cis (const cl_R& x)
      +
      cl_N cis (const cl_N& x)
      Returns 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)
      Returns arcsin(z). This is defined as @@ -899,6 +977,7 @@ with realpart = pi/2 and imagpart > 0.
      cl_N acos (const cl_N& z)
      + Returns 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). @@ -907,6 +986,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)
      Returns the angle of the polar representation of the complex number @@ -935,13 +1016,16 @@ with realpart = pi/2 and imagpart <= 0.

      -The constant pi = 3.14... is returned by the following functions: + + +Archimedes' constant pi = 3.14... is returned by the following functions:

      cl_F cl_pi (cl_float_format_t f)
      + Returns pi as a float of format f.
      cl_F cl_pi (const cl_F& y) @@ -961,6 +1045,7 @@ Returns pi as a float of format cl_default_float_format.
      cl_R sinh (const cl_R& x)
      + Returns sinh(x).
      cl_N sinh (const cl_N& z) @@ -969,6 +1054,7 @@ Returns sinh(z). The range of the result is the entire complex plan
      cl_R cosh (const cl_R& x)
      + Returns cosh(x). The range of the result is the interval cosh(x) >= 1. @@ -978,20 +1064,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)
      + Returns both 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)
      Returns tanh(x) = sinh(x)/cosh(x).
      cl_N asinh (const cl_N& z)
      + Returns arsinh(z). This is defined as arsinh(z) = log(z+sqrt(1+z^2)) and satisfies arsinh(-z) = -arsinh(z). @@ -1002,6 +1092,7 @@ with imagpart = pi/2 and realpart < 0.
      cl_N acosh (const cl_N& z)
      + Returns 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 @@ -1010,6 +1101,7 @@ excluding the numbers with realpart = 0 and -pi < imagpar
      cl_N atanh (const cl_N& z)
      + Returns 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 @@ -1022,6 +1114,9 @@ with imagpart = pi/2 and realpart >= 0.

      4.8.4 Euler gamma

      +

      + +

      Euler's constant C = 0.577... is returned by the following functions: @@ -1031,6 +1126,7 @@ Euler's constant C = 0.577... is returned by the following functions:

      cl_F cl_eulerconst (cl_float_format_t f)
      + Returns Euler's constant as a float of format f.
      cl_F cl_eulerconst (const cl_F& y) @@ -1044,12 +1140,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: +
      cl_F cl_catalanconst (cl_float_format_t f)
      + Returns Catalan's constant as a float of format f.
      cl_F cl_catalanconst (const cl_F& y) @@ -1064,6 +1162,9 @@ Returns Catalan's constant as a float of format cl_default_float_format4.8.5 Riemann zeta +

      + +

      Riemann's zeta function at an integral point s>1 is returned by the @@ -1074,6 +1175,7 @@ following functions:

      cl_F cl_zeta (int s, cl_float_format_t f)
      + Returns Riemann's zeta function at s as a float of format f.
      cl_F cl_zeta (int s, const cl_F& y) @@ -1113,54 +1215,69 @@ on each of the bit positions in parallel.
      cl_I lognot (const cl_I& x)
      +
      cl_I operator ~ (const cl_I& x)
      + Logical not, like ~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)
      + Logical and, like 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)
      + Logical (inclusive) or, like 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)
      + Exclusive or, like x ^ y in C.
      cl_I logeqv (const cl_I& x, const cl_I& y)
      + Bitwise equivalence, like ~(x ^ y) in C.
      cl_I lognand (const cl_I& x, const cl_I& y)
      + Bitwise not and, like ~(x & y) in C.
      cl_I lognor (const cl_I& x, const cl_I& y)
      + Bitwise not or, like ~(x | y) in C.
      cl_I logandc1 (const cl_I& x, const cl_I& y)
      + Logical and, complementing the first argument, like ~x & y in C.
      cl_I logandc2 (const cl_I& x, const cl_I& y)
      + Logical and, complementing the second argument, like x & ~y in C.
      cl_I logorc1 (const cl_I& x, const cl_I& y)
      + Logical or, complementing the first argument, like ~x | y in C.
      cl_I logorc2 (const cl_I& x, const cl_I& y)
      + Logical or, complementing the second argument, like x | ~y in C.
      @@ -1170,6 +1287,7 @@ These operations are all available though the function
      cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)
      +

      where op must have one of the 16 values (each one stands for a function @@ -1178,6 +1296,21 @@ which combines two bits into one bit): boole_clr, boole_setboole_and, boole_ior, boole_xor, boole_eqv, boole_nand, boole_nor, boole_andc1, boole_andc2, boole_orc1, boole_orc2. + + + + + + + + + + + + + + +

      @@ -1188,16 +1321,19 @@ Other functions that view integers as bit strings:

      cl_boolean logtest (const cl_I& x, const cl_I& y)
      + Returns true if some bit is set in both x and y, i.e. if logand(x,y) != 0.
      cl_boolean logbitp (const cl_I& n, const cl_I& x)
      + Returns true if the nth bit (from the right) of x is set. Bit 0 is the least significant bit.
      uintL logcount (const cl_I& x)
      + Returns the number of one bits in x, if x >= 0, or the number of zero bits in x, if x < 0. @@ -1211,6 +1347,7 @@ struct cl_byte { uintL size; uintL position; };

      + represents the bit interval containing the bits position...position+size-1 of an integer. The constructor cl_byte(size,position) constructs a cl_byte. @@ -1220,16 +1357,19 @@ The constructor cl_byte(size,position) constructs a cl_bytecl_I ldb (const cl_I& n, const cl_byte& b)

      + extracts the bits of 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)
      + Returns true if some bit described by the bit interval b is set in n.
      cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
      + Returns n, with the bits described by the bit interval b replaced by newbyte. Only the lowest b.size bits of newbyte are relevant. @@ -1244,11 +1384,13 @@ functions are their counterparts without shifting:
      cl_I mask_field (const cl_I& n, const cl_byte& b)
      + returns an integer with the bits described by the bit interval 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)
      + returns an integer where the bits described by the bit interval b come from newbyte and the other bits come from n. @@ -1279,33 +1421,39 @@ for common arithmetic operations:
      cl_boolean oddp (const cl_I& x)
      + Returns true if the least significant bit of x is 1. Equivalent to mod(x,2) != 0.
      cl_boolean evenp (const cl_I& x)
      + Returns true if the least significant bit of x is 0. Equivalent to mod(x,2) == 0.
      cl_I operator << (const cl_I& x, const cl_I& n)
      + Shifts 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)
      + Shifts 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)
      + Shifts 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)
      + Returns the number of bits (excluding the sign bit) needed to represent 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 @@ -1313,12 +1461,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.) @@ -1332,6 +1482,7 @@ If x = 2^(n-1), it returns n. Else it returns 0.
      uint32 gcd (uint32 a, uint32 b)
      +
      cl_I gcd (const cl_I& a, const cl_I& b)
      This function returns the greatest common divisor of a and b, @@ -1339,6 +1490,7 @@ normalized to be >= 0.
      cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)
      + This function ("extended gcd") returns the greatest common divisor g of a and b and at the same time the representation of g as an integral linear combination of a and b: @@ -1350,11 +1502,13 @@ value, in the following sense: If a and b are non-zero
      cl_I lcm (const cl_I& a, const cl_I& b)
      + This function returns the least common multiple of 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 @@ -1370,17 +1524,20 @@ it returns false.
      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)! @@ -1407,6 +1564,7 @@ defines the following operations.
      type scale_float (const type& x, sintL delta)
      +
      type scale_float (const type& x, const cl_I& delta)
      Returns x*2^delta. This is more efficient than an explicit multiplication @@ -1422,27 +1580,32 @@ representation of floating-point numbers.
      sintL float_exponent (const type& x)
      + Returns the exponent 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)
      + Returns the base of the floating-point representation. This is always 2.
      type float_sign (const type& x)
      + Returns the sign s of x as a float. The value is 1 for x >= 0, -1 for x < 0.
      uintL float_digits (const type& x)
      + Returns the number of mantissa bits in the floating-point representation of x, including the hidden bit. The value only depends on the type of x, not on its value.
      uintL float_precision (const type& x)
      + Returns the number of significant mantissa bits in the floating-point representation of x. Since denormalized numbers are not supported, this is the same as float_digits(x) if x is non-zero, and @@ -1451,6 +1614,11 @@ this is the same as float_digits(x) if x is non-zero,

      The complete internal representation of a float is encoded in the type + + + + + cl_decoded_float (or cl_decoded_sfloat, cl_decoded_ffloat, cl_decoded_dfloat, cl_decoded_lfloat, respectively), defined by @@ -1468,6 +1636,7 @@ and returned by the function

      cl_decoded_typefloat decode_float (const type& x)
      + For 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. @@ -1478,7 +1647,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;
       };
       
      @@ -1491,6 +1660,7 @@ by the following function:
      cl_idecoded_float integer_decode_float (const type& x)
      + For 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. @@ -1506,6 +1676,7 @@ Some other function, implemented only for class cl_F:
      cl_F float_sign (const cl_F& x, const cl_F& y)
      + This returns a floating point number whose precision and absolute value is that of y and whose sign is that of x. If x is zero, it is treated as positive. Same for y. @@ -1514,6 +1685,9 @@ zero, it is treated as positive. Same for y.

      4.11 Conversion functions

      +

      + + @@ -1527,6 +1701,7 @@ The type cl_float_format_t describes a floating-point format.

      cl_float_format_t cl_float_format (uintL n)
      + Returns the smallest float format which guarantees at least n decimal digits in the mantissa (after the decimal point). @@ -1536,6 +1711,7 @@ Returns the floating point format of x.
      cl_float_format_t cl_default_float_format
      + Global variable: the default float format used when converting rational numbers to floats. @@ -1551,6 +1727,7 @@ defines the following operations:
      cl_F cl_float (const type&x, cl_float_format_t f)
      + Returns x as a float of format f.
      cl_F cl_float (const type&x, const cl_F& y)
      @@ -1573,28 +1750,34 @@ Every floating-point format has some characteristic numbers:
      cl_F most_positive_float (cl_float_format_t f)
      + Returns the largest (most positive) floating point number in float format f.
      cl_F most_negative_float (cl_float_format_t f)
      + Returns the smallest (most negative) floating point number in float format f.
      cl_F least_positive_float (cl_float_format_t f)
      + Returns the least positive floating point number (i.e. > 0 but closest to 0) in float format f.
      cl_F least_negative_float (cl_float_format_t f)
      + Returns the least negative floating point number (i.e. < 0 but closest to 0) in float format f.
      cl_F float_epsilon (cl_float_format_t f)
      + Returns the smallest floating point number e > 0 such that 1+e != 1.
      cl_F float_negative_epsilon (cl_float_format_t f)
      + Returns the smallest floating point number e > 0 such that 1-e != 1. @@ -1611,6 +1794,7 @@ defines the following operation:
      cl_RA rational (const type& x)
      + Returns the value of 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. @@ -1625,6 +1809,7 @@ the function
      cl_RA rationalize (const cl_R& x)
      + If 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) @@ -1666,6 +1851,7 @@ a complicated but deterministic way.

      The global variable +

       cl_random_state cl_default_random_state
      @@ -1682,12 +1868,14 @@ below are called without cl_random_state argument.
       
      uint32 random32 ()
      + Returns a random unsigned 32-bit number. All bits are equally random.
      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. @@ -1695,6 +1883,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. @@ -1702,6 +1891,7 @@ number of the same format as n in the range 0 <= x <
      cl_R random_R (const cl_R& n)
      + Behaves like random_I if n is an integer and like random_F if n is a float. @@ -1709,6 +1899,9 @@ if n is a float.

      4.13 Obfuscating operators

      +

      + +

      The modifying C/C++ operators +=, -=, *=, /=, @@ -1723,6 +1916,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: @@ -1736,12 +1930,16 @@ For the classes 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&)
      +

      @@ -1758,14 +1956,19 @@ For the class 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&)
      +

      @@ -1777,6 +1980,7 @@ For the classes cl_N, cl_R, cl_RA,

      type& operator ++ (type& x)
      + The prefix operator ++x.
      void operator ++ (type& x, int) @@ -1785,6 +1989,7 @@ The postfix operator x++.
      type& operator -- (type& x)
      + The prefix operator --x.
      void operator -- (type& x, int) diff --git a/doc/cln_5.html b/doc/cln_5.html index 4df2aed..7f83961 100644 --- a/doc/cln_5.html +++ b/doc/cln_5.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 5. Input/Output @@ -10,10 +10,16 @@ Go to the first, previous, 5. Input/Output +

      + +

      5.1 Internal and printed representation

      +

      + +

      All computations deal with the internal representations of the numbers. @@ -27,8 +33,10 @@ 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, is it always true that conversion of an internal to an external + +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: read(print(x)) == x. This is called "print-read consistency". @@ -409,7 +417,7 @@ using this variable name. Default is "x".

      The global variable cl_default_print_flags contains the default values, -used by the function fprint, +used by the function fprint.


      diff --git a/doc/cln_6.html b/doc/cln_6.html index 4d9413f..4ccf7aa 100644 --- a/doc/cln_6.html +++ b/doc/cln_6.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 6. Rings diff --git a/doc/cln_7.html b/doc/cln_7.html index e065b2b..007ae5a 100644 --- a/doc/cln_7.html +++ b/doc/cln_7.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 7. Modular integers @@ -10,10 +10,16 @@ Go to the first, previous, 7. Modular integers +

      + +

      7.1 Modular integer rings

      +

      + +

      CLN implements modular integers, i.e. integers modulo a fixed integer N. @@ -59,9 +65,11 @@ Modular integer rings are constructed using the function

      cl_modint_ring cl_find_modint_ring (const cl_I& N)
      + This function returns the modular ring `Z/NZ'. It takes care of finding out about special cases of 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 @@ -76,8 +84,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&)
      + These compare two modular integer rings for equality. Two different calls to cl_find_modint_ring with the same argument necessarily return the same ring because it is memoized in the cache table. @@ -95,22 +105,27 @@ Given a modular integer ring R, the following members can be used.
      cl_I R->modulus
      + This is the ring's modulus, normalized to be nonnegative: abs(N).
      cl_MI R->zero()
      + This returns 0 mod N.
      cl_MI R->one()
      + This returns 1 mod N.
      cl_MI R->canonhom (const cl_I& x)
      + This returns x mod N.
      cl_I R->retract (const cl_MI& x)
      + This is a partial inverse function to R->canonhom. It returns the standard representative (>=0, <N) of x. @@ -118,6 +133,7 @@ standard representative (>=0, <N) of x
      cl_MI R->random()
      + This returns a random integer modulo N. @@ -129,15 +145,18 @@ The following operations are defined on modular integers.
      cl_modint_ring x.ring ()
      + Returns the ring to which the modular integer x belongs.
      cl_MI operator+ (const cl_MI&, const cl_MI&)
      + Returns the sum of two modular integers. One of the arguments may also be a plain integer.
      cl_MI operator- (const cl_MI&, const cl_MI&)
      + Returns the difference of two modular integers. One of the arguments may also be a plain integer. @@ -147,50 +166,61 @@ Returns the negative of a modular integer.
      cl_MI operator* (const cl_MI&, const cl_MI&)
      + Returns the product of two modular integers. One of the arguments may also be a plain integer.
      cl_MI square (const cl_MI&)
      + Returns the square of a modular integer.
      cl_MI recip (const cl_MI& x)
      + Returns the reciprocal 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)
      + Returns the quotient 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)
      + Returns 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)
      + Returns x*2^y.
      cl_MI operator>> (const cl_MI& x, const cl_I& y)
      + Returns 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&)
      + Compares two modular integers, belonging to the same modular integer ring, for equality.
      cl_boolean zerop (const cl_MI& x)
      + Returns true if x is 0 mod N. @@ -203,8 +233,10 @@ input/output).
      void fprint (cl_ostream stream, const cl_MI& x)
      +
      cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
      + Prints the modular integer x on the stream. The output may depend on the global printer settings in the variable cl_default_print_flags. diff --git a/doc/cln_8.html b/doc/cln_8.html index a0381f6..3dd2018 100644 --- a/doc/cln_8.html +++ b/doc/cln_8.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 8. Symbolic data types @@ -10,6 +10,9 @@ Go to the first, previous, 8. Symbolic data types +

      + +

      CLN implements two symbolic (non-numeric) data types: strings and symbols. @@ -18,6 +21,9 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols.

      8.1 Strings

      +

      + +

      The class @@ -42,6 +48,7 @@ Strings are constructed through the following constructors:

      cl_string (const char * s)
      + Returns an immutable copy of the (zero-terminated) C string s.
      cl_string (const char * ptr, unsigned long len) @@ -62,17 +69,21 @@ Assignment from cl_string and const char *.
      s.length()
      +
      strlen(s)
      + Returns the length of the string s.
      s[i]
      + Returns the 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)
      + Compares two strings for equality. One of the arguments may also be a plain const char *. @@ -80,6 +91,9 @@ plain const char *.

      8.2 Symbols

      +

      + +

      Symbols are uniquified strings: all symbols with the same name are shared. @@ -98,6 +112,7 @@ Symbols are constructed through the following constructor:

      cl_symbol (const cl_string& s)
      + Looks up or creates a new symbol with a given name. @@ -114,6 +129,7 @@ Conversion to cl_string: Returns the string which names the symbol
      bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
      + Compares two symbols for equality. This is very fast. diff --git a/doc/cln_9.html b/doc/cln_9.html index be510a2..08c8bfe 100644 --- a/doc/cln_9.html +++ b/doc/cln_9.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 9. Univariate polynomials @@ -10,6 +10,10 @@ Go to the first, previous, 9. Univariate polynomials +

      + + + @@ -121,6 +125,7 @@ return the same polynomial ring.

      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) @@ -155,27 +160,33 @@ Given a univariate polynomial ring R, the following members can be
      cl_ring R->basering()
      + This returns the base ring, as passed to `cl_find_univpoly_ring'.
      cl_UP R->zero()
      + This returns 0 in R, a polynomial of degree -1.
      cl_UP R->one()
      + This returns 1 in R, a polynomial of degree <= 0.
      cl_UP R->canonhom (const cl_I& x)
      + This returns x in R, a polynomial of degree <= 0.
      cl_UP R->monomial (const cl_ring_element& x, uintL e)
      + This returns a sparse polynomial: x * X^e, where X is the indeterminate.
      cl_UP R->create (sintL degree)
      + Creates a new polynomial with a given degree. The zero polynomial has degree -1. After creating the polynomial, you should put in the coefficients, using the set_coeff member function, and then call the finalize @@ -190,12 +201,14 @@ The following are the only destructive operations on univariate polynomials.
      void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)
      + This changes the coefficient of 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)
      + This function marks the endpoint of destructive modifications of a polynomial. It normalizes the internal representation so that subsequent computations have less overhead. Doing normal computations on unnormalized polynomials may @@ -210,14 +223,17 @@ The following operations are defined on univariate polynomials.
      cl_univpoly_ring x.ring ()
      + Returns the ring to which the univariate polynomial x belongs.
      cl_UP operator+ (const cl_UP&, const cl_UP&)
      + Returns the sum of two univariate polynomials.
      cl_UP operator- (const cl_UP&, const cl_UP&)
      + Returns the difference of two univariate polynomials.
      cl_UP operator- (const cl_UP&) @@ -226,44 +242,54 @@ Returns the negative of a univariate polynomial.
      cl_UP operator* (const cl_UP&, const cl_UP&)
      + Returns the product of two univariate polynomials. One of the arguments may also be a plain integer or an element of the base ring.
      cl_UP square (const cl_UP&)
      + Returns the square of a univariate polynomial.
      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&)
      + Compares two univariate polynomials, belonging to the same univariate polynomial ring, for equality.
      cl_boolean zerop (const cl_UP& x)
      + Returns true if x is 0 in R.
      sintL degree (const cl_UP& x)
      + Returns the degree of the polynomial. The zero polynomial has degree -1.
      cl_ring_element coeff (const cl_UP& x, uintL index)
      + Returns the coefficient of X^index in the polynomial x.
      cl_ring_element x (const cl_ring_element& y)
      + Evaluation: If 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)
      + Returns the derivative of the polynomial x with respect to the indeterminate X. @@ -277,8 +303,10 @@ input/output).
      void fprint (cl_ostream stream, const cl_UP& x)
      +
      cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
      + Prints the univariate polynomial x on the stream. The output may depend on the global printer settings in the variable cl_default_print_flags. @@ -296,18 +324,26 @@ The following functions return special polynomials.
      cl_UP_I cl_tschebychev (sintL n)
      + + Returns the n-th Tchebychev polynomial (n >= 0).
      cl_UP_I cl_hermite (sintL n)
      + + Returns the n-th Hermite polynomial (n >= 0).
      cl_UP_RA cl_legendre (sintL n)
      + + Returns the n-th Legendre polynomial (n >= 0).
      cl_UP_I cl_laguerre (sintL n)
      + + Returns the n-th Laguerre polynomial (n >= 0). diff --git a/doc/cln_toc.html b/doc/cln_toc.html index ecf7ce9..5dd7415 100644 --- a/doc/cln_toc.html +++ b/doc/cln_toc.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - Table of Contents @@ -115,7 +115,7 @@
    • Index


    -This document was generated on 14 January 2000 using +This document was generated on 4 May 2000 using texi2html 1.56k.