]> www.ginac.de Git - cln.git/commitdiff
2004-01-01 Richard B. Kreckel <kreckel@ginac.de>
authorRichard Kreckel <kreckel@ginac.de>
Thu, 1 Jan 2004 15:59:30 +0000 (15:59 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Thu, 1 Jan 2004 15:59:30 +0000 (15:59 +0000)
        * include/cln/univpoly.h, include/cln/univpoly_complex.h,
          include/cln//univpoly_integer.h, include/cln/univpoly_modint.h,
          include/cln/univpoly_rational.h, include/cln/univpoly_real.h,
          src/polynomial/elem/cl_UP_GF2.h, src/polynomial/elem/cl_UP_MI.h,
          src/polynomial/elem/cl_UP_gen.h, src/polynomial/elem/cl_UP_no_ring.cc,
          src/polynomial/elem/cl_UP_number.h (ldegree): New function.
        * doc/cln.tex: Document `ldegree'.

16 files changed:
ChangeLog
README
configure.ac
doc/cln.tex
include/cln/univpoly.h
include/cln/univpoly_complex.h
include/cln/univpoly_integer.h
include/cln/univpoly_modint.h
include/cln/univpoly_rational.h
include/cln/univpoly_real.h
src/base/cl_free.cc
src/polynomial/elem/cl_UP_GF2.h
src/polynomial/elem/cl_UP_MI.h
src/polynomial/elem/cl_UP_gen.h
src/polynomial/elem/cl_UP_no_ring.cc
src/polynomial/elem/cl_UP_number.h

index 1cefca2535d10e1bbbf6c4af27f8536182ee4e4f..87d8e0f3a5a3fe48b4febfb119dd5a03fcbef2ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-01  Richard B. Kreckel  <kreckel@ginac.de>
+
+       * include/cln/univpoly.h, include/cln/univpoly_complex.h,
+         include/cln//univpoly_integer.h, include/cln/univpoly_modint.h,
+         include/cln/univpoly_rational.h, include/cln/univpoly_real.h,
+         src/polynomial/elem/cl_UP_GF2.h, src/polynomial/elem/cl_UP_MI.h,
+         src/polynomial/elem/cl_UP_gen.h, src/polynomial/elem/cl_UP_no_ring.cc,
+         src/polynomial/elem/cl_UP_number.h (ldegree): New function.
+       * doc/cln.tex: Document `ldegree'.
+
 2003-12-29  Richard B. Kreckel  <kreckel@ginac.de>
 
        Rework of autoconfiscation infrastructure
 
        * examples/perfnum.cc: update to presumed 40th Mersenne prime.
 
-2003-08-06  Richard Kreckel  <kreckel@ginac.de>
+2003-11-20  Christian Bauer  <cbauer@ginac.de>
+
+       Added pkg-config support
+       * cln.pc.in: New file.
+       * Makefile.in: Take care of cln.pc.
+       * configure.ac: Likewise.
+
+2003-08-06  Richard B. Kreckel  <kreckel@ginac.de>
 
        * src/numtheory/cl_nt_sqrtmodp.cc: #undef _R.
        Reported by Andrew Rechnitzer <A.Rechnitzer@ms.unimelb.edu.au>.
diff --git a/README b/README
index bdc51b471a3a8b2642a44b5214253ac40f1d2440..d043fa041f1b719f4a4d6d1c6c3f2225719e2046 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 Class Library for Numbers
 
 Copyright (c)    Bruno Haible 1988-2002
-Copyright (c) Richard Kreckel 2000-2003
+Copyright (c) Richard Kreckel 2000-2004
 
 GPL
 
index a52b58c6dd53bfb131c9fea02233296db41c869f..d6ba968321cd14f0a521911e449856d187d63fb8 100644 (file)
@@ -78,8 +78,8 @@ dnl * if any functions/classes have been added, removed or changed, increment
 dnl   CL_CURRENT and set CL_REVISION to 0,
 dnl * if any functions/classes have been added, increment CL_AGE,
 dnl * if backwards compatibility has been broken, set CL_AGE to 0.
-CL_CURRENT=2
-CL_REVISION=5
+CL_CURRENT=3
+CL_REVISION=0
 CL_AGE=0
 dnl make substitutions
 AC_SUBST(CL_CURRENT)
index a6c1975b5d3c8ee39efda915995197628dd8c687..63bdd0871eea9941a1a110260cf6ffef0d84b9da 100644 (file)
 This file documents @sc{cln}, a Class Library for Numbers.
 
 Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
-Richard Kreckel, @code{<kreckel@@ginac.de>}.
+Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
 
 Copyright (C)  Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002.
-Copyright (C)  Richard Kreckel 2000, 2001, 2002.
+Copyright (C)  Richard B. Kreckel 2000, 2001, 2002, 2003, 2004.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -3092,7 +3092,7 @@ This returns @code{0 in R}, a polynomial of degree -1.
 
 @item cl_UP R->one()
 @cindex @code{one ()}
-This returns @code{1 in R}, a polynomial of degree <= 0.
+This returns @code{1 in R}, a polynomial of degree == 0.
 
 @item cl_UP R->canonhom (const cl_I& x)
 @cindex @code{canonhom ()}
@@ -3174,6 +3174,11 @@ Returns true if @code{x} is @code{0 in R}.
 @cindex @code{degree ()}
 Returns the degree of the polynomial. The zero polynomial has degree @code{-1}.
 
+@item sintL ldegree (const cl_UP& x)
+@cindex @code{degree ()}
+Returns the low degree of the polynomial. This is the degree of the first
+non-vanishing polynomial coefficient. The zero polynomial has ldegree @code{-1}.
+
 @item cl_ring_element coeff (const cl_UP& x, uintL index)
 @cindex @code{coeff ()}
 Returns the coefficient of @code{X^index} in the polynomial @code{x}.
index 23bd0336c3e48bda57302ca2c517ba3f0f3eb5a7..7547c06e8b1b38e16bd094d884bdbfb8fa97c139 100644 (file)
@@ -147,6 +147,8 @@ struct _cl_univpoly_modulops {
 struct _cl_univpoly_polyops {
        // degree
        sintL (* degree) (cl_heap_univpoly_ring* R, const _cl_UP& x);
+       // low degree
+       sintL (* ldegree) (cl_heap_univpoly_ring* R, const _cl_UP& x);
        // monomial
        const _cl_UP (* monomial) (cl_heap_univpoly_ring* R, const cl_ring_element& x, uintL e);
        // coefficient (0 if index>degree)
@@ -212,6 +214,8 @@ public:
                { return modulops->scalmul(this,x,y); }
        sintL _degree (const _cl_UP& x)
                { return polyops->degree(this,x); }
+       sintL _ldegree (const _cl_UP& x)
+               { return polyops->ldegree(this,x); }
        const _cl_UP _monomial (const cl_ring_element& x, uintL e)
                { return polyops->monomial(this,x,e); }
        const cl_ring_element _coeff (const _cl_UP& x, uintL index)
@@ -296,6 +300,11 @@ public:
                if (!(x.ring() == this)) cl_abort();
                return _degree(x);
        }
+       sintL ldegree (const cl_UP& x)
+       {
+               if (!(x.ring() == this)) cl_abort();
+               return _ldegree(x);
+       }
        const cl_UP monomial (const cl_ring_element& x, uintL e)
        {
                return cl_UP(this,_monomial(x,e));
@@ -415,6 +424,10 @@ inline const cl_UP operator* (const cl_UP& x, const cl_ring_element& y)
 inline sintL degree (const cl_UP& x)
        { return x.ring()->degree(x); }
 
+// Low degree.
+inline sintL ldegree (const cl_UP& x)
+       { return x.ring()->ldegree(x); }
+
 // Coefficient.
 inline const cl_ring_element coeff (const cl_UP& x, uintL index)
        { return x.ring()->coeff(x,index); }
@@ -585,6 +598,10 @@ class cl_heap_univpoly_specialized_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_specialized<T>& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_specialized<T> monomial (const T& x, uintL e)
        {
                return The2(cl_UP_specialized<T>)(cl_heap_univpoly_ring::monomial(cl_ring_element(cl_C_ring??,x),e));
index 5de6dac820637551417f0eaf6646f288a61e3bd5..6b8355b11ada75021e36b8ee6613cc08a7a4b6ce 100644 (file)
@@ -116,6 +116,10 @@ class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_N& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_N monomial (const cl_N& x, uintL e)
        {
                return The2(cl_UP_N)(cl_heap_univpoly_ring::monomial(cl_ring_element(cl_C_ring,x),e));
index d227fa5bc76a4eedf2d0ecd248c9c53c3f42f904..ae9db0e237ea3a88680f4db6a241eaf11236df71 100644 (file)
@@ -115,6 +115,10 @@ class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_I& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_I monomial (const cl_I& x, uintL e)
        {
                return The2(cl_UP_I)(cl_heap_univpoly_ring::monomial(cl_ring_element(cl_I_ring,x),e));
index 4fcd1cdd5bea80c65fa2a64c0c73ffc236714257..e312f062421370c7df59e2adba38579ee39957ee 100644 (file)
@@ -107,6 +107,10 @@ class cl_heap_univpoly_modint_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_MI& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_MI monomial (const cl_MI& x, uintL e)
        {
                return The2(cl_UP_MI)(cl_heap_univpoly_ring::monomial(x,e));
index 0c53590005140725bc56c6ee367bd9291542ec23..1eb1a24033e9a1765ef25f6b797fc473c2902088 100644 (file)
@@ -116,6 +116,10 @@ class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_RA& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_RA monomial (const cl_RA& x, uintL e)
        {
                return The2(cl_UP_RA)(cl_heap_univpoly_ring::monomial(cl_ring_element(cl_RA_ring,x),e));
index 4f2419f2a867c38fbd3de25c5f6c1a820f49616c..8954e0eaa552b0612af2550b56524b40ab7b9a99 100644 (file)
@@ -116,6 +116,10 @@ class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring {
        {
                return cl_heap_univpoly_ring::degree(x);
        }
+       sintL ldegree (const cl_UP_R& x)
+       {
+               return cl_heap_univpoly_ring::ldegree(x);
+       }
        const cl_UP_R monomial (const cl_R& x, uintL e)
        {
                return The2(cl_UP_R)(cl_heap_univpoly_ring::monomial(cl_ring_element(cl_R_ring,x),e));
index d235145e0f21d92b4034257e91a8f1d53fc0a34b..f72c6da6186d9150b5ae118a8c57e8ac9cdc0907 100644 (file)
@@ -34,7 +34,7 @@ void cl_free_heap_object (cl_heap* pointer)
 static const char * copyright_notice[] = {
   "                                                                    \n"
   "Copyright (c)    Bruno Haible 1988-2002                             \n"
-  "Copyright (c) Richard Kreckel 2000-2003                             \n"
+  "Copyright (c) Richard Kreckel 2000-2004                             \n"
   "                                                                    \n"
   "This program is free software; you can redistribute it and/or modify\n"
   "it under the terms of the GNU General Public License as published by\n"
index 71caa2166bd143b15c07d2b3899f3db6a57ff736..8ca6f215bcb7b008417c51911dbae0080c911bd8 100644 (file)
@@ -1028,6 +1028,7 @@ static cl_univpoly_modulops gf2_modulops = {
 
 static cl_univpoly_polyops gf2_polyops = {
        modint_degree,
+       modint_ldegree,
        modint_monomial,
        modint_coeff,
        modint_create,
index 7e4faf330ba17f7b6503c1f2f5605a1d1ffb3b21..0b4d62fca26e5c5b676cf01568e28d02bb32856c 100644 (file)
@@ -353,6 +353,18 @@ static sintL modint_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
        return (sintL) x.length() - 1;
 }}
 
+static sintL modint_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
+{{
+       DeclarePoly(cl_GV_MI,x);
+       var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
+       var sintL xlen = x.length();
+       for (sintL i = 0; i < xlen; i++) {
+               if (!R->_zerop(x[i]))
+                       return i;
+       }
+       return -1;
+}}
+
 static const _cl_UP modint_monomial (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, uintL e)
 {
        if (!(UPR->basering() == x.ring())) cl_abort();
@@ -456,6 +468,7 @@ static cl_univpoly_modulops modint_modulops = {
 
 static cl_univpoly_polyops modint_polyops = {
        modint_degree,
+       modint_ldegree,
        modint_monomial,
        modint_coeff,
        modint_create,
index 6379a4c99d35ddd8049f40d3806511f6233ac3da..1917f5bbb863a3592ed42ae65798976db2842b7f 100644 (file)
@@ -337,6 +337,17 @@ static sintL gen_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
        return (sintL) x.length() - 1;
 }}
 
+static sintL gen_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
+{{     DeclarePoly(cl_SV_ringelt,x);
+       var cl_heap_ring* R = TheRing(UPR->basering());
+       var sintL xlen = x.length();
+       for (sintL i = 0; i < xlen; i++) {
+               if (!R->_zerop(x[i]))
+                       return i;
+       }
+       return -1;
+}}
+
 static const _cl_UP gen_monomial (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, uintL e)
 {
        if (!(UPR->basering() == x.ring())) cl_abort();
@@ -436,6 +447,7 @@ static cl_univpoly_modulops gen_modulops = {
 
 static cl_univpoly_polyops gen_polyops = {
        gen_degree,
+       gen_ldegree,
        gen_monomial,
        gen_coeff,
        gen_create,
index 2e1f543bf1eaff296c25631a85953c2b51a84f62..f04886e9e37e242d68846290dfefb6bdeb66608c 100644 (file)
@@ -109,6 +109,11 @@ static sintL dummy_degree (cl_heap_univpoly_ring* R, const _cl_UP& x)
        unused R;
        uninitialized_error(x); return 0;
 }
+static sintL dummy_ldegree (cl_heap_univpoly_ring* R, const _cl_UP& x)
+{
+       unused R;
+       uninitialized_error(x); return 0;
+}
 static const _cl_UP dummy_monomial (cl_heap_univpoly_ring* R, const cl_ring_element& x, uintL e)
 {
        unused R;
@@ -170,6 +175,7 @@ static cl_univpoly_modulops dummy_modulops = {
 };
 static cl_univpoly_polyops dummy_polyops = {
        dummy_degree,
+       dummy_ldegree,
        dummy_monomial,
        dummy_coeff,
        dummy_create,
index 861e97669aed75c92620271b26c1512e40477982..c5b5183a753d793aa000f1a8b52fea8b2f5b5f64 100644 (file)
@@ -335,6 +335,18 @@ static sintL num_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
        return (sintL) x.length() - 1;
 }}
 
+static sintL num_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
+{{
+       DeclarePoly(cl_SV_number,x);
+       var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
+       var sintL xlen = x.length();
+       for (sintL i = 0; i < xlen; i++) {
+               if (!ops.zerop(x[i]))
+                       return i;
+       }
+       return -1;
+}}
+
 static const _cl_UP num_monomial (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, uintL e)
 {
        if (!(UPR->basering() == x.ring())) cl_abort();
@@ -438,6 +450,7 @@ static cl_univpoly_modulops num_modulops = {
 
 static cl_univpoly_polyops num_polyops = {
        num_degree,
+       num_ldegree,
        num_monomial,
        num_coeff,
        num_create,