+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>.
Class Library for Numbers
Copyright (c) Bruno Haible 1988-2002
-Copyright (c) Richard Kreckel 2000-2003
+Copyright (c) Richard Kreckel 2000-2004
GPL
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)
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
@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 ()}
@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}.
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)
{ 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)
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));
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); }
{
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));
{
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));
{
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));
{
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));
{
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));
{
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));
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"
static cl_univpoly_polyops gf2_polyops = {
modint_degree,
+ modint_ldegree,
modint_monomial,
modint_coeff,
modint_create,
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();
static cl_univpoly_polyops modint_polyops = {
modint_degree,
+ modint_ldegree,
modint_monomial,
modint_coeff,
modint_create,
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();
static cl_univpoly_polyops gen_polyops = {
gen_degree,
+ gen_ldegree,
gen_monomial,
gen_coeff,
gen_create,
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;
};
static cl_univpoly_polyops dummy_polyops = {
dummy_degree,
+ dummy_ldegree,
dummy_monomial,
dummy_coeff,
dummy_create,
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();
static cl_univpoly_polyops num_polyops = {
num_degree,
+ num_ldegree,
num_monomial,
num_coeff,
num_create,