 |
My Project
debian-1:4.1.1-p2+ds-4build2
|
Go to the documentation of this file.
9 #if defined(WINNT) && ! defined(__GNUC__)
13 #include <strstream.h>
47 ASSERT( 0,
"ups, why do you initialize an empty poly" );
53 firstTerm =
new term( 0, c, e );
59 ASSERT( 0,
"ups there is something wrong in your code" );
83 cursor = cursor->
next;
159 if ( theCursor->
exp ==
i )
160 return theCursor->
coeff;
161 else if ( theCursor->
exp <
i )
164 theCursor = theCursor->
next;
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 ) )
303 if ( first && first->
exp != 0 )
343 if ( first && first->
exp != 0 )
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 )
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 )
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 )
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 )
709 while (first && ( first->
exp >=
exp ) )
712 newexp = first->
exp -
exp;
719 if ( first && first->
exp != 0 )
742 if ( first && first->
exp != 0 )
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 )
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 )
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 )
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 )
1046 cursor = cursor->
next;
1063 if (
last->exp == 0 )
1066 if (
last->coeff.isZero() )
1070 cursor = cursor->
next;
1120 cursor = cursor->
next;
1143 if (
last->exp == 0 )
1149 if (
last->coeff.isZero() )
1153 cursor = cursor->
next;
1189 else if ( c.
isOne() )
1226 else dummy = dummy->
mulcoeff( cc );
1277 if ( first && first->
exp != 0 )
1320 else dummy = dummy->
mulcoeff( cc );
1372 if ( first && first->
exp != 0 )
1449 if ( first && first->
exp != 0 )
1548 if ( first && first->
exp != 0 )
1626 if ( first && first->
exp != 0 )
1667 if ( quotfirst->
exp == 0 )
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 )
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 )
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;
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;
1896 cursor = cursor->
next;
1909 cursor = cursor->
next;
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 )
2002 theCursor = theCursor->
next;
2023 theCursor = theCursor->
next;
2029 theCursor = theCursor->
next;
2052 theCursor = theCursor->
next;
2058 theCursor = theCursor->
next;
2083 theCursor = theCursor->
next;
2089 theCursor = theCursor->
next;
2112 theCursor = theCursor->
next;
2118 theCursor = theCursor->
next;
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 )
2231 while ( first && ( first->
exp >=
exp ) )
2234 newexp = first->
exp -
exp;
virtual InternalCF * mulsame(InternalCF *) PVIRT_INTCF("mulsame")
void divremcoeff(InternalCF *, InternalCF *&, InternalCF *&, bool)
bool tryDivremsamet(InternalCF *, InternalCF *&, InternalCF *&, const CanonicalForm &, bool &)
InternalPoly * getInternalMipo(const Variable &alpha)
virtual InternalCF * invert()
InternalCF * divsame(InternalCF *)
CanonicalForm tailcoeff()
CanonicalForm InternalPoly::tailcoeff (), int InternalPoly::taildegree ()
InternalCF * modulocoeff(InternalCF *, bool)
#define omGetSpecBin(size)
InternalCF * deepCopyObject() const
InternalCF * subcoeff(InternalCF *, bool)
virtual InternalCF * tryDividecoeff(InternalCF *, bool, const CanonicalForm &, bool &)
bool tryDivremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool, const CanonicalForm &, bool &)
InternalCF * mulcoeff(InternalCF *)
bool isUnivariate() const
InternalCF * tryDividecoeff(InternalCF *, bool, const CanonicalForm &, bool &)
InternalCF * neg()
InternalCF * InternalPoly::neg ()
int comparesame(InternalCF *)
comparesame(), comparecoeff() - compare with an InternalPoly.
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)
bool divremsamet(InternalCF *, InternalCF *&, InternalCF *&)
void print(OSTREAM &, char *)
virtual CanonicalForm coeff(int i)
CanonicalForm InternalCF::coeff ( int i )
static const omBin InternalPoly_bin
int degree()
int InternalPoly::degree ()
InternalCF * dividesame(InternalCF *)
InternalCF * subsame(InternalCF *)
InternalCF * addsame(InternalCF *)
virtual InternalCF * dividecoeff(InternalCF *, bool) PVIRT_INTCF("dividecoeff")
static termList divTermList(termList, const CanonicalForm &, termList &)
gmp_float exp(const gmp_float &a)
InternalCF * tryDivcoeff(InternalCF *, bool, const CanonicalForm &, bool &)
virtual InternalCF * tryMulsame(InternalCF *, const CanonicalForm &)
static termList reduceTermList(termList first, termList redterms, termList &last)
void setReduce(const Variable &alpha, bool reduce)
bool divremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool)
InternalCF * tryMulsame(InternalCF *, const CanonicalForm &)
static long imm2int(const InternalCF *const imm)
factory's class for variables
friend class InternalInteger
void divremsame(InternalCF *, InternalCF *&, InternalCF *&)
InternalCF * modulosame(InternalCF *)
int comparecoeff(InternalCF *)
comparecoeff() always returns 1 since CO is defined to be larger than anything which is a coefficient...
InternalCF * modsame(InternalCF *)
static void freeTermList(termList)
virtual InternalCF * mulcoeff(InternalCF *) PVIRT_INTCF("mulcoeff")
InternalCF * addcoeff(InternalCF *)
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)
InternalCF * modcoeff(InternalCF *, bool)
static const omBin term_bin
bool getReduce(const Variable &alpha)
static termList copyTermList(termList, termList &, bool negate=false)
virtual InternalCF * tryInvert(const CanonicalForm &, bool &)
InternalCF * divcoeff(InternalCF *, bool)
InternalCF * dividecoeff(InternalCF *, bool)
InternalCF * tryDivsame(InternalCF *, const CanonicalForm &, bool &)
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
factory's class for integers
int sign() const
int InternalPoly::sign () const