 |
My Project
debian-1:4.1.1-p2+ds-4build3
|
factory's class for polynomials
More...
#include <int_poly.h>
|
| InternalPoly () |
|
| InternalPoly (const Variable &v, const int e, const CanonicalForm &c) |
|
| InternalPoly (const InternalPoly &) |
|
| ~InternalPoly () |
|
InternalCF * | deepCopyObject () const |
|
const char * | classname () const |
|
int | level () const |
|
Variable | variable () const |
|
int | degree () |
| int InternalPoly::degree () More...
|
|
CanonicalForm | lc () |
|
CanonicalForm | Lc () |
|
CanonicalForm | LC () |
|
int | taildegree () |
|
CanonicalForm | tailcoeff () |
| CanonicalForm InternalPoly::tailcoeff (), int InternalPoly::taildegree () More...
|
|
CanonicalForm | coeff (int i) |
| CanonicalForm InternalPoly::coeff ( int i ) More...
|
|
void | print (OSTREAM &, char *) |
|
bool | inBaseDomain () const |
|
bool | inExtension () const |
|
bool | inCoeffDomain () const |
|
bool | inPolyDomain () const |
|
bool | inQuotDomain () const |
|
InternalCF * | genZero () |
|
InternalCF * | genOne () |
|
bool | isUnivariate () const |
|
InternalCF * | neg () |
| InternalCF * InternalPoly::neg () More...
|
|
InternalCF * | invert () |
|
InternalCF * | tryInvert (const CanonicalForm &, bool &) |
|
int | comparesame (InternalCF *) |
| comparesame(), comparecoeff() - compare with an InternalPoly. More...
|
|
InternalCF * | addsame (InternalCF *) |
|
InternalCF * | subsame (InternalCF *) |
|
InternalCF * | mulsame (InternalCF *) |
|
InternalCF * | tryMulsame (InternalCF *, const CanonicalForm &) |
|
InternalCF * | dividesame (InternalCF *) |
|
InternalCF * | modulosame (InternalCF *) |
|
InternalCF * | divsame (InternalCF *) |
|
InternalCF * | tryDivsame (InternalCF *, const CanonicalForm &, bool &) |
|
InternalCF * | modsame (InternalCF *) |
|
void | divremsame (InternalCF *, InternalCF *&, InternalCF *&) |
|
bool | divremsamet (InternalCF *, InternalCF *&, InternalCF *&) |
|
bool | tryDivremsamet (InternalCF *, InternalCF *&, InternalCF *&, const CanonicalForm &, bool &) |
|
int | comparecoeff (InternalCF *) |
| comparecoeff() always returns 1 since CO is defined to be larger than anything which is a coefficient w.r.t. More...
|
|
InternalCF * | addcoeff (InternalCF *) |
|
InternalCF * | subcoeff (InternalCF *, bool) |
|
InternalCF * | mulcoeff (InternalCF *) |
|
InternalCF * | dividecoeff (InternalCF *, bool) |
|
InternalCF * | tryDividecoeff (InternalCF *, bool, const CanonicalForm &, bool &) |
|
InternalCF * | modulocoeff (InternalCF *, bool) |
|
InternalCF * | divcoeff (InternalCF *, bool) |
|
InternalCF * | tryDivcoeff (InternalCF *, bool, const CanonicalForm &, bool &) |
|
InternalCF * | modcoeff (InternalCF *, bool) |
|
void | divremcoeff (InternalCF *, InternalCF *&, InternalCF *&, bool) |
|
bool | divremcoefft (InternalCF *, InternalCF *&, InternalCF *&, bool) |
|
bool | tryDivremcoefft (InternalCF *, InternalCF *&, InternalCF *&, bool, const CanonicalForm &, bool &) |
|
int | sign () const |
| int InternalPoly::sign () const More...
|
|
void * | operator new (size_t) |
|
void | operator delete (void *addr, size_t) |
|
| InternalCF () |
|
| InternalCF (const InternalCF &) |
|
virtual | ~InternalCF () |
|
int | deleteObject () |
|
InternalCF * | copyObject () |
|
virtual int | levelcoeff () const |
|
virtual int | type () const |
|
virtual bool | isZero () const |
|
virtual bool | isOne () const |
| bool InternalCF::isOne, isZero () const More...
|
|
virtual long | intval () const |
|
virtual int | intmod (int) const |
|
virtual InternalCF * | num () |
| InternalCF * InternalCF::num (), den () More...
|
|
virtual InternalCF * | den () |
|
virtual InternalCF * | bgcdsame (const InternalCF *const) const |
| InternalCF * InternalCF::bgcdsame, bgcdcoeff ( const InternalCF * const ) More...
|
|
virtual InternalCF * | bgcdcoeff (const InternalCF *const) |
|
virtual InternalCF * | bextgcdsame (InternalCF *, CanonicalForm &, CanonicalForm &) |
| InternalCF * InternalCF::bextgcdsame ( InternalCF *, CanonicalForm & a, CanonicalForm & b ) More...
|
|
virtual InternalCF * | bextgcdcoeff (InternalCF *, CanonicalForm &, CanonicalForm &) |
|
virtual InternalCF * | sqrt () |
| InternalCF * InternalCF::sqrt () More...
|
|
virtual int | ilog2 () |
| int InternalCF::ilog2 () More...
|
|
void * | operator new (size_t size) throw (std::bad_alloc) |
|
void | operator delete (void *block) throw () |
|
void * | operator new[] (size_t size) throw (std::bad_alloc) |
|
void | operator delete[] (void *block) throw () |
|
void * | operator new (size_t size, const std::nothrow_t &) throw () |
|
void * | operator new[] (size_t size, const std::nothrow_t &) throw () |
|
|
static termList | copyTermList (termList, termList &, bool negate=false) |
|
static termList | deepCopyTermList (termList, termList &) |
|
static void | freeTermList (termList) |
|
static void | negateTermList (termList) |
|
static termList | addTermList (termList, termList, termList &, bool negate) |
|
static void | mulTermList (termList, const CanonicalForm &, const int) |
|
static termList | divideTermList (termList, const CanonicalForm &, termList &) |
|
static termList | divTermList (termList, const CanonicalForm &, termList &) |
|
static termList | tryDivTermList (termList, const CanonicalForm &, termList &, const CanonicalForm &, bool &) |
|
static termList | modTermList (termList, const CanonicalForm &, termList &) |
|
static void | appendTermList (termList &, termList &, const CanonicalForm &, const int) |
|
static termList | mulAddTermList (termList theList, termList aList, const CanonicalForm &c, const int exp, termList &lastTerm, bool negate) |
|
static termList | reduceTermList (termList first, termList redterms, termList &last) |
|
factory's class for polynomials
polynomials are represented as a linked list termList, factory uses a sparse distributive representation of polynomials, i.e. each poly is viewed as a univariate poly in its main variable CanonicalForm::mvar() over a (polynomial) ring
Definition at line 71 of file int_poly.h.
◆ InternalPoly() [1/4]
◆ InternalPoly() [2/4]
InternalPoly::InternalPoly |
( |
| ) |
|
Definition at line 45 of file int_poly.cc.
47 ASSERT( 0,
"ups, why do you initialize an empty poly" );
◆ InternalPoly() [3/4]
◆ InternalPoly() [4/4]
Definition at line 57 of file int_poly.cc.
59 ASSERT( 0,
"ups there is something wrong in your code" );
◆ ~InternalPoly()
InternalPoly::~InternalPoly |
( |
| ) |
|
◆ addcoeff()
◆ addsame()
◆ addTermList()
Definition at line 1914 of file int_poly.cc.
1920 while ( theCursor && aCursor )
1922 if ( theCursor->
exp == aCursor->
exp )
1932 predCursor->
next = theCursor->
next;
1934 theCursor = predCursor->
next;
1938 theList = theList->
next;
1940 theCursor = theList;
1945 predCursor = theCursor;
1946 theCursor = theCursor->
next;
1948 aCursor = aCursor->
next;
1950 else if ( theCursor->
exp < aCursor->
exp )
1956 predCursor = predCursor->
next;
1960 theList =
new term( theCursor, -aCursor->
coeff, aCursor->
exp );
1961 predCursor = theList;
1967 predCursor = predCursor->
next;
1971 theList =
new term( theCursor, aCursor->
coeff, aCursor->
exp );
1972 predCursor = theList;
1974 aCursor = aCursor->
next;
1978 predCursor = theCursor;
1979 theCursor = theCursor->
next;
1989 else if ( ! theCursor )
◆ appendTermList()
◆ classname()
const char* InternalPoly::classname |
( |
| ) |
const |
|
inlinevirtual |
◆ coeff()
◆ comparecoeff()
◆ comparesame()
int InternalPoly::comparesame |
( |
InternalCF * |
acoeff | ) |
|
|
virtual |
comparesame(), comparecoeff() - compare with an InternalPoly.
comparesame() compares the coefficient vectors of f=CO and g=acoeff w.r.t to a lexicographic order in the following way: f < g iff there exists an 0 <= i <= max(deg(f),deg(g)) s.t. i) f[j] = g[j] for all i < j <= max(deg(f),deg(g)) and ii) g[i] occurs in g (i.e. is not equal to zero) and f[i] does not occur in f or f[i] < g[i] if f[i] occurs where f[i] denotes the coefficient to the power x^i of f.
As usual, comparesame() returns 1 if CO is larger than c, 0 if CO equals c, and -1 if CO is less than c. However, this function is optimized to test on equality since this is its most important and frequent usage.
See the respective ‘CanonicalForm’-methods for an explanation why we define such a strange (but total) ordering on polynomials.
- See also
- CanonicalForm::operator <(), CanonicalForm::operator ==()
Reimplemented from InternalCF.
Definition at line 982 of file int_poly.cc.
993 for ( ; cursor1 && cursor2; cursor1 = cursor1->
next, cursor2 = cursor2->
next )
998 if ( (cursor1->
exp != cursor2->exp) || (cursor1->
coeff != cursor2->coeff) )
1000 if ( cursor1->
exp > cursor2->exp )
1002 else if ( cursor1->
exp < cursor2->exp )
1004 else if ( cursor1->
coeff > cursor2->coeff )
1010 if ( cursor1 == cursor2 )
1012 else if ( cursor1 != 0 )
◆ copyTermList()
Definition at line 1822 of file int_poly.cc.
1824 if ( aTermList == 0 )
1832 while ( sourceCursor )
1834 targetCursor->
next =
new term( 0, -sourceCursor->
coeff, sourceCursor->
exp );
1835 targetCursor = targetCursor->
next;
1836 sourceCursor = sourceCursor->
next;
1838 targetCursor->
next = 0;
1839 theLastTerm = targetCursor;
1840 targetCursor = dummy->
next;
1842 return targetCursor;
1850 while ( sourceCursor )
1852 targetCursor->
next =
new term( 0, sourceCursor->
coeff, sourceCursor->
exp );
1853 targetCursor = targetCursor->
next;
1854 sourceCursor = sourceCursor->
next;
1856 targetCursor->
next = 0;
1857 theLastTerm = targetCursor;
1858 targetCursor = dummy->
next;
1860 return targetCursor;
◆ deepCopyObject()
InternalCF * InternalPoly::deepCopyObject |
( |
| ) |
const |
|
virtual |
◆ deepCopyTermList()
Definition at line 1865 of file int_poly.cc.
1867 if ( aTermList == 0 )
1875 while ( sourceCursor )
1878 targetCursor = targetCursor->
next;
1879 sourceCursor = sourceCursor->
next;
1881 targetCursor->
next = 0;
1882 theLastTerm = targetCursor;
1883 targetCursor = dummy->
next;
1885 return targetCursor;
◆ degree()
int InternalPoly::degree |
( |
| ) |
|
|
virtual |
◆ divcoeff()
◆ dividecoeff()
◆ dividesame()
◆ divideTermList()
◆ divremcoeff()
◆ divremcoefft()
Reimplemented from InternalCF.
Definition at line 1681 of file int_poly.cc.
1700 ASSERT( ! c.isZero(),
"divide by zero!" );
1704 bool divideok =
true;
1707 quotcursor = quotfirst =
new term;
1709 while ( cursor && divideok )
1712 divideok = divideok && crem.
isZero();
1717 quotcursor->
next =
new term( 0, cquot, cursor->
exp );
1718 quotcursor = quotcursor->
next;
1720 cursor = cursor->
next;
1723 quotcursor->
next = 0;
1726 cursor = quotfirst; quotfirst = quotfirst->
next;
delete cursor;
1728 if ( quotfirst->
exp == 0 )
◆ divremsame()
Reimplemented from InternalCF.
Definition at line 757 of file int_poly.cc.
768 termList dummy, first,
last, resultfirst = 0, resultlast = 0;
776 while (first && ( first->
exp >=
exp ) )
779 newexp = first->
exp -
exp;
786 if ( resultfirst->
exp == 0 )
796 if ( first->
exp == 0 )
◆ divremsamet()
Reimplemented from InternalCF.
Definition at line 809 of file int_poly.cc.
817 termList dummy, first,
last, resultfirst = 0, resultlast = 0;
820 bool divideok =
true;
829 while (first && ( first->
exp >=
exp ) && divideok )
832 if ( divideok && dummycoeff.
isZero() )
834 newexp = first->
exp -
exp;
846 if ( resultfirst->
exp == 0 )
856 if ( first->
exp == 0 )
◆ divsame()
Reimplemented from InternalCF.
Definition at line 490 of file int_poly.cc.
496 else dummy = dummy->
mulsame(
this );
509 termList dummy, first,
last, resultfirst = 0, resultlast = 0;
525 while (first && ( first->
exp >=
exp ) )
528 newexp = first->
exp -
exp;
537 if ( resultfirst && resultfirst->
exp != 0 )
543 else if ( resultfirst )
554 ASSERT( 0,
"FATAL ERROR, PLEASE INFORM THE AUTHOR" );
562 if ( resultfirst && resultfirst->
exp != 0 )
564 else if ( resultfirst )
◆ divTermList()
◆ freeTermList()
void InternalPoly::freeTermList |
( |
termList |
aTermList | ) |
|
|
staticprivate |
◆ genOne()
◆ genZero()
◆ inBaseDomain()
bool InternalPoly::inBaseDomain |
( |
| ) |
const |
|
inlinevirtual |
◆ inCoeffDomain()
bool InternalPoly::inCoeffDomain |
( |
| ) |
const |
|
inlinevirtual |
◆ inExtension()
bool InternalPoly::inExtension |
( |
| ) |
const |
|
inlinevirtual |
◆ inPolyDomain()
bool InternalPoly::inPolyDomain |
( |
| ) |
const |
|
inlinevirtual |
◆ inQuotDomain()
bool InternalPoly::inQuotDomain |
( |
| ) |
const |
|
inlinevirtual |
◆ invert()
◆ isUnivariate()
bool InternalPoly::isUnivariate |
( |
| ) |
const |
|
virtual |
◆ lc()
◆ Lc()
◆ LC()
◆ level()
int InternalPoly::level |
( |
| ) |
const |
|
inlinevirtual |
◆ modcoeff()
◆ modsame()
Reimplemented from InternalCF.
Definition at line 685 of file int_poly.cc.
709 while (first && ( first->
exp >=
exp ) )
712 newexp = first->
exp -
exp;
719 if ( first && first->
exp != 0 )
742 if ( first && first->
exp != 0 )
◆ modTermList()
◆ modulocoeff()
◆ modulosame()
◆ mulAddTermList()
Definition at line 2140 of file int_poly.cc.
2152 while ( theCursor && aCursor )
2154 if ( theCursor->
exp == aCursor->
exp +
exp )
2161 predCursor->
next = theCursor->
next;
2163 theCursor = predCursor->
next;
2167 theList = theList->
next;
2169 theCursor = theList;
2174 predCursor = theCursor;
2175 theCursor = theCursor->
next;
2177 aCursor = aCursor->
next;
2179 else if ( theCursor->
exp < aCursor->
exp +
exp )
2184 predCursor = predCursor->
next;
2189 predCursor = theList;
2191 aCursor = aCursor->
next;
2195 predCursor = theCursor;
2196 theCursor = theCursor->
next;
2204 predCursor = predCursor->
next;
2209 predCursor = theList;
2211 while ( predCursor )
2215 predCursor = predCursor->
next;
2218 else if ( ! theCursor )
◆ mulcoeff()
◆ mulsame()
Reimplemented from InternalCF.
Definition at line 358 of file int_poly.cc.
362 termList resultFirst = 0, resultLast = 0;
368 theCursor->
coeff, theCursor->
exp, resultLast,
false );
369 theCursor = theCursor->
next;
374 if ( resultFirst == 0 )
387 else if ( resultFirst->
exp == 0 )
◆ mulTermList()
◆ neg()
◆ negateTermList()
void InternalPoly::negateTermList |
( |
termList |
terms | ) |
|
|
staticprivate |
◆ operator delete()
void InternalPoly::operator delete |
( |
void * |
addr, |
|
|
size_t |
|
|
) |
| |
|
inline |
◆ operator new()
void* InternalPoly::operator new |
( |
size_t |
| ) |
|
|
inline |
◆ print()
void InternalPoly::print |
( |
OSTREAM & |
aStream, |
|
|
char * |
aString |
|
) |
| |
|
virtual |
Reimplemented from InternalCF.
Definition at line 171 of file int_poly.cc.
174 aStream << 0 << aString;
181 ostrstream theStream;
182 if ( theCursor->
exp == 0 )
187 if ( theCursor->
exp != 1 )
188 aStream <<
'^' << theCursor->
exp << aString;
192 else if ( theCursor->
coeff.
sign() < 0 && (-theCursor->
coeff).isOne() )
194 aStream <<
'-' <<
var;
195 if ( theCursor->
exp != 1 )
196 aStream <<
'^' << theCursor->
exp << aString;
202 theStream <<
'*' <<
var;
203 if ( theCursor->
exp != 1 )
204 theStream <<
'^' << theCursor->
exp << aString << ends;
206 theStream << aString << ends;
207 theString = theStream.str();
211 theCursor = theCursor->
next;
212 if ( theCursor && ( theCursor->
coeff.
sign() >= 0 ) )
◆ reduceTermList()
◆ sign()
int InternalPoly::sign |
( |
| ) |
const |
|
virtual |
◆ subcoeff()
◆ subsame()
◆ tailcoeff()
◆ taildegree()
int InternalPoly::taildegree |
( |
| ) |
|
|
virtual |
◆ tryDivcoeff()
◆ tryDividecoeff()
◆ tryDivremcoefft()
Reimplemented from InternalCF.
Definition at line 1747 of file int_poly.cc.
1768 ASSERT( ! c.isZero(),
"divide by zero!" );
1772 bool divideok =
true;
1775 quotcursor = quotfirst =
new term;
1777 while ( cursor && divideok )
1785 divideok = divideok && crem.
isZero();
1790 quotcursor->
next =
new term( 0, cquot, cursor->
exp );
1791 quotcursor = quotcursor->
next;
1793 cursor = cursor->
next;
1796 quotcursor->
next = 0;
1799 cursor = quotfirst; quotfirst = quotfirst->
next;
delete cursor;
1801 if ( quotfirst->
exp == 0 )
◆ tryDivremsamet()
Reimplemented from InternalCF.
Definition at line 875 of file int_poly.cc.
889 termList dummy, first,
last, resultfirst = 0, resultlast = 0;
892 bool divideok =
true;
898 while (first && ( first->
exp >=
exp ) && divideok )
906 if ( divideok && dummycoeff.
isZero() )
908 newexp = first->
exp -
exp;
921 if ( resultfirst->
exp == 0 )
931 if ( first->
exp == 0 )
◆ tryDivsame()
Reimplemented from InternalCF.
Definition at line 576 of file int_poly.cc.
605 termList dummy, first,
last, resultfirst = 0, resultlast = 0;
621 while (first && ( first->
exp >=
exp ) )
629 newcoeff=
reduce (newcoeff,
M);
630 newexp = first->
exp -
exp;
640 if ( resultfirst && resultfirst->
exp != 0 )
646 else if ( resultfirst )
657 ASSERT( 0,
"FATAL ERROR, PLEASE INFORM THE AUTHOR" );
665 if ( resultfirst && resultfirst->
exp != 0 )
667 else if ( resultfirst )
◆ tryDivTermList()
◆ tryInvert()
◆ tryMulsame()
Reimplemented from InternalCF.
Definition at line 420 of file int_poly.cc.
425 termList resultFirst = 0, resultLast = 0;
431 theCursor->
coeff, theCursor->
exp, resultLast,
false );
432 theCursor = theCursor->
next;
437 if ( resultFirst == 0 )
450 else if ( resultFirst->
exp == 0 )
◆ variable()
Variable InternalPoly::variable |
( |
| ) |
const |
|
inlinevirtual |
◆ CFIterator
◆ firstTerm
◆ InternalPoly_bin
◆ lastTerm
◆ var
The documentation for this class was generated from the following files:
virtual InternalCF * mulsame(InternalCF *) PVIRT_INTCF("mulsame")
InternalPoly * getInternalMipo(const Variable &alpha)
virtual InternalCF * invert()
InternalCF * divsame(InternalCF *)
virtual InternalCF * tryDividecoeff(InternalCF *, bool, const CanonicalForm &, bool &)
InternalCF * mulcoeff(InternalCF *)
InternalCF * tryInvert(const CanonicalForm &, bool &)
InternalCF * mulsame(InternalCF *)
CanonicalForm coeff(int i)
CanonicalForm InternalPoly::coeff ( int i )
static termList deepCopyTermList(termList, termList &)
virtual class for internal CanonicalForm's
static termList modTermList(termList, const CanonicalForm &, termList &)
CanonicalForm extgcd(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &a, CanonicalForm &b)
CanonicalForm extgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a,...
static void appendTermList(termList &, termList &, const CanonicalForm &, const int)
static termList addTermList(termList, termList, termList &, bool negate)
InternalCF * copyObject()
virtual int level() const
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
#define ASSERT(expression, message)
static termList divideTermList(termList, const CanonicalForm &, termList &)
factory's class for polynomials
static termList mulAddTermList(termList theList, termList aList, const CanonicalForm &c, const int exp, termList &lastTerm, bool negate)
static InternalCF * basic(long value)
#define omTypeAllocBin(type, addr, bin)
static const omBin InternalPoly_bin
virtual InternalCF * dividecoeff(InternalCF *, bool) PVIRT_INTCF("dividecoeff")
static termList divTermList(termList, const CanonicalForm &, termList &)
gmp_float exp(const gmp_float &a)
virtual InternalCF * tryMulsame(InternalCF *, const CanonicalForm &)
static termList reduceTermList(termList first, termList redterms, termList &last)
void setReduce(const Variable &alpha, bool reduce)
InternalCF * tryMulsame(InternalCF *, const CanonicalForm &)
static long imm2int(const InternalCF *const imm)
factory's class for variables
void divremsame(InternalCF *, InternalCF *&, InternalCF *&)
InternalCF * modsame(InternalCF *)
static void freeTermList(termList)
virtual InternalCF * mulcoeff(InternalCF *) PVIRT_INTCF("mulcoeff")
const Variable & v
< [in] a sqrfree bivariate poly
static termList tryDivTermList(termList, const CanonicalForm &, termList &, const CanonicalForm &, bool &)
static void negateTermList(termList)
static void mulTermList(termList, const CanonicalForm &, const int)
bool getReduce(const Variable &alpha)
static termList copyTermList(termList, termList &, bool negate=false)
virtual InternalCF * tryInvert(const CanonicalForm &, bool &)
#define omFreeBin(addr, bin)
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
factory's class for integers