Browse Source

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'.
master
Richard Kreckel 21 years ago
parent
commit
251c2a8ca1
  1. 19
      ChangeLog
  2. 2
      README
  3. 4
      configure.ac
  4. 11
      doc/cln.tex
  5. 17
      include/cln/univpoly.h
  6. 4
      include/cln/univpoly_complex.h
  7. 4
      include/cln/univpoly_integer.h
  8. 4
      include/cln/univpoly_modint.h
  9. 4
      include/cln/univpoly_rational.h
  10. 4
      include/cln/univpoly_real.h
  11. 2
      src/base/cl_free.cc
  12. 1
      src/polynomial/elem/cl_UP_GF2.h
  13. 13
      src/polynomial/elem/cl_UP_MI.h
  14. 12
      src/polynomial/elem/cl_UP_gen.h
  15. 6
      src/polynomial/elem/cl_UP_no_ring.cc
  16. 13
      src/polynomial/elem/cl_UP_number.h

19
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
@ -34,7 +44,14 @@
* 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>.

2
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

4
configure.ac

@ -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)

11
doc/cln.tex

@ -32,10 +32,10 @@
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}.

17
include/cln/univpoly.h

@ -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));

4
include/cln/univpoly_complex.h

@ -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));

4
include/cln/univpoly_integer.h

@ -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));

4
include/cln/univpoly_modint.h

@ -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));

4
include/cln/univpoly_rational.h

@ -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));

4
include/cln/univpoly_real.h

@ -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));

2
src/base/cl_free.cc

@ -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"

1
src/polynomial/elem/cl_UP_GF2.h

@ -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,

13
src/polynomial/elem/cl_UP_MI.h

@ -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,

12
src/polynomial/elem/cl_UP_gen.h

@ -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,

6
src/polynomial/elem/cl_UP_no_ring.cc

@ -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,

13
src/polynomial/elem/cl_UP_number.h

@ -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,

Loading…
Cancel
Save