Loading...
Searching...
No Matches
int_poly.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#ifndef INCL_INT_POLY_H
#define INCL_INT_POLY_H
/**
* @file int_poly.h
*
* Factory's internal polynomials
**/
// #include "config.h"
#ifndef NOSTREAMIO
#ifdef HAVE_IOSTREAM
#include <iostream>
#define OSTREAM std::ostream
#elif defined(HAVE_IOSTREAM_H)
#include <iostream.h>
#define OSTREAM ostream
#endif
#endif /* NOSTREAMIO */
#include "cf_defs.h"
#include "int_cf.h"
#include "variable.h"
#include "canonicalform.h"
#ifdef HAVE_OMALLOC
# include "omalloc/omalloc.h"
#endif
class term {
private:
term * next;
CanonicalForm coeff;
int exp;
#ifdef HAVE_OMALLOC
static const omBin term_bin;
#endif
public:
term() : next(0), coeff(0), exp(0) {}
term( term * n, const CanonicalForm & c, int e ) : next(n), coeff(c), exp(e) {}
friend class InternalPoly;
friend class CFIterator;
#ifdef HAVE_OMALLOC
void* operator new(size_t)
{
void* addr;
omTypeAllocBin(void*, addr, term_bin);
return addr;
}
void operator delete(void* addr, size_t)
{
omFreeBin(addr, term_bin);
}
#endif
};
typedef term * termList;
/**
* 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
**/
class InternalPoly : public InternalCF {
private:
termList firstTerm, lastTerm;
Variable var;
InternalPoly( termList, termList, const Variable & );
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 );
public:
InternalPoly();
InternalPoly( const Variable & v, const int e, const CanonicalForm& c );
InternalPoly( const InternalPoly& );
~InternalPoly();
InternalCF* deepCopyObject() const;
const char * classname() const { return "InternalPoly"; }
int level() const { return var.level(); }
Variable variable() const { return var; }
int degree();
CanonicalForm lc();
CanonicalForm Lc();
CanonicalForm LC();
int taildegree();
CanonicalForm tailcoeff();
CanonicalForm coeff( int i );
#ifndef NOSTREAMIO
void print( OSTREAM&, char* );
#endif /* NOSTREAMIO */
bool inBaseDomain() const { return false; }
bool inExtension() const { return var.level() < 0; }
bool inCoeffDomain() const { return var.level() < 0; }
bool inPolyDomain() const { return var.level() > 0; }
bool inQuotDomain() const { return false; }
InternalCF* genZero()
{ return firstTerm->coeff.genZero().getval(); }
InternalCF* genOne()
{ return firstTerm->coeff.genOne().getval(); }
bool isUnivariate() const;
InternalCF* neg();
InternalCF* invert();
InternalCF* tryInvert( const CanonicalForm&, bool& );
int comparesame ( InternalCF* );
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* );
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;
#ifdef HAVE_OMALLOC
static const omBin InternalPoly_bin;
void* operator new(size_t)
{
void* addr;
omTypeAllocBin(void*, addr, InternalPoly_bin);
return addr;
}
void operator delete(void* addr, size_t)
{
omFreeBin(addr, InternalPoly_bin);
}
#endif
friend class CFIterator;
};
#endif /* ! INCL_INT_POLY_H */
canonicalform.h
Header for factory's main class CanonicalForm.
OSTREAM
#define OSTREAM
Definition canonicalform.h:16
i
int i
Definition cfEzgcd.cc:132
cf_defs.h
factory switches.
termList
term * termList
Definition cf_iter.h:36
CanonicalForm
factory's main class
Definition canonicalform.h:86
InternalCF
virtual class for internal CanonicalForm's
Definition int_cf.h:47
InternalCF::InternalCF
InternalCF()
Definition int_cf.h:55
InternalPoly::addsame
InternalCF * addsame(InternalCF *)
Definition int_poly.cc:286
InternalPoly::divideTermList
static termList divideTermList(termList, const CanonicalForm &, termList &)
Definition int_poly.cc:2051
InternalPoly::~InternalPoly
~InternalPoly()
Definition int_poly.cc:70
InternalPoly::CFIterator
friend class CFIterator
Definition int_poly.h:171
InternalPoly::taildegree
int taildegree()
Definition int_poly.cc:153
InternalPoly::addTermList
static termList addTermList(termList, termList, termList &, bool negate)
Definition int_poly.cc:1924
InternalPoly::mulcoeff
InternalCF * mulcoeff(InternalCF *)
Definition int_poly.cc:1183
InternalPoly::var
Variable var
Definition int_poly.h:74
InternalPoly::print
void print(OSTREAM &, char *)
Definition int_poly.cc:179
InternalPoly::reduceTermList
static termList reduceTermList(termList first, termList redterms, termList &last)
Definition int_poly.cc:2268
InternalPoly::LC
CanonicalForm LC()
Definition int_poly.cc:138
InternalPoly::modsame
InternalCF * modsame(InternalCF *)
Definition int_poly.cc:693
InternalPoly::degree
int degree()
int InternalPoly::degree ()
Definition int_poly.cc:100
InternalPoly::freeTermList
static void freeTermList(termList)
Definition int_poly.cc:1900
InternalPoly::deepCopyObject
InternalCF * deepCopyObject() const
Definition int_poly.cc:76
InternalPoly::divremsamet
bool divremsamet(InternalCF *, InternalCF *&, InternalCF *&)
Definition int_poly.cc:817
InternalPoly::neg
InternalCF * neg()
InternalCF * InternalPoly::neg ().
Definition int_poly.cc:231
InternalPoly::tryDivcoeff
InternalCF * tryDivcoeff(InternalCF *, bool, const CanonicalForm &, bool &)
Definition int_poly.cc:1477
InternalPoly::InternalPoly_bin
static const omBin InternalPoly_bin
Definition int_poly.h:159
InternalPoly::mulTermList
static void mulTermList(termList, const CanonicalForm &, const int)
Definition int_poly.cc:2040
InternalPoly::inQuotDomain
bool inQuotDomain() const
Definition int_poly.h:113
InternalPoly::isUnivariate
bool isUnivariate() const
Definition int_poly.cc:84
InternalPoly::divremcoeff
void divremcoeff(InternalCF *, InternalCF *&, InternalCF *&, bool)
Definition int_poly.cc:1654
InternalPoly::comparesame
int comparesame(InternalCF *)
InternalPoly::inBaseDomain
bool inBaseDomain() const
Definition int_poly.h:109
InternalPoly::genZero
InternalCF * genZero()
Definition int_poly.h:115
InternalPoly::invert
InternalCF * invert()
Definition int_poly.cc:247
InternalPoly::tryDividecoeff
InternalCF * tryDividecoeff(InternalCF *, bool, const CanonicalForm &, bool &)
Definition int_poly.cc:1305
InternalPoly::modulocoeff
InternalCF * modulocoeff(InternalCF *, bool)
Definition int_poly.cc:1576
InternalPoly::variable
Variable variable() const
Definition int_poly.h:98
InternalPoly::subsame
InternalCF * subsame(InternalCF *)
Definition int_poly.cc:326
InternalPoly::firstTerm
termList firstTerm
Definition int_poly.h:73
InternalPoly::divcoeff
InternalCF * divcoeff(InternalCF *, bool)
Definition int_poly.cc:1401
InternalPoly::modcoeff
InternalCF * modcoeff(InternalCF *, bool)
Definition int_poly.cc:1590
InternalPoly::inCoeffDomain
bool inCoeffDomain() const
Definition int_poly.h:111
InternalPoly::inExtension
bool inExtension() const
Definition int_poly.h:110
InternalPoly::modulosame
InternalCF * modulosame(InternalCF *)
Definition int_poly.cc:687
InternalPoly::negateTermList
static void negateTermList(termList)
Definition int_poly.cc:1913
InternalPoly::tryDivTermList
static termList tryDivTermList(termList, const CanonicalForm &, termList &, const CanonicalForm &, bool &)
Definition int_poly.cc:2109
InternalPoly::mulAddTermList
static termList mulAddTermList(termList theList, termList aList, const CanonicalForm &c, const int exp, termList &lastTerm, bool negate)
Definition int_poly.cc:2184
InternalPoly::tryDivremcoefft
bool tryDivremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool, const CanonicalForm &, bool &)
Definition int_poly.cc:1757
InternalPoly::level
int level() const
Definition int_poly.h:97
InternalPoly::lastTerm
termList lastTerm
Definition int_poly.h:73
InternalPoly::divremsame
void divremsame(InternalCF *, InternalCF *&, InternalCF *&)
Definition int_poly.cc:765
InternalPoly::dividesame
InternalCF * dividesame(InternalCF *)
Definition int_poly.cc:491
InternalPoly::divremcoefft
bool divremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool)
Definition int_poly.cc:1691
InternalPoly::coeff
CanonicalForm coeff(int i)
CanonicalForm InternalPoly::coeff ( int i ).
Definition int_poly.cc:162
InternalPoly::dividecoeff
InternalCF * dividecoeff(InternalCF *, bool)
Definition int_poly.cc:1219
InternalPoly::comparecoeff
int comparecoeff(InternalCF *)
comparesame(), comparecoeff() - compare with an InternalPoly.
Definition int_poly.cc:1034
InternalPoly::tailcoeff
CanonicalForm tailcoeff()
CanonicalForm InternalPoly::tailcoeff (), int InternalPoly::taildegree ().
Definition int_poly.cc:147
InternalPoly::deepCopyTermList
static termList deepCopyTermList(termList, termList &)
Definition int_poly.cc:1875
InternalPoly::divsame
InternalCF * divsame(InternalCF *)
Definition int_poly.cc:498
InternalPoly::InternalPoly
InternalPoly()
Definition int_poly.cc:53
InternalPoly::addcoeff
InternalCF * addcoeff(InternalCF *)
Definition int_poly.cc:1040
InternalPoly::subcoeff
InternalCF * subcoeff(InternalCF *, bool)
Definition int_poly.cc:1097
InternalPoly::classname
const char * classname() const
Definition int_poly.h:96
InternalPoly::InternalPoly
InternalPoly(termList, termList, const Variable &)
Definition int_poly.cc:46
InternalPoly::tryDivremsamet
bool tryDivremsamet(InternalCF *, InternalCF *&, InternalCF *&, const CanonicalForm &, bool &)
Definition int_poly.cc:883
InternalPoly::lc
CanonicalForm lc()
Definition int_poly.cc:120
InternalPoly::modTermList
static termList modTermList(termList, const CanonicalForm &, termList &)
Definition int_poly.cc:2140
InternalPoly::copyTermList
static termList copyTermList(termList, termList &, bool negate=false)
Definition int_poly.cc:1832
InternalPoly::genOne
InternalCF * genOne()
Definition int_poly.h:118
InternalPoly::appendTermList
static void appendTermList(termList &, termList &, const CanonicalForm &, const int)
Definition int_poly.cc:2169
InternalPoly::Lc
CanonicalForm Lc()
Definition int_poly.cc:129
InternalPoly::divTermList
static termList divTermList(termList, const CanonicalForm &, termList &)
Definition int_poly.cc:2080
InternalPoly::mulsame
InternalCF * mulsame(InternalCF *)
Definition int_poly.cc:366
InternalPoly::tryInvert
InternalCF * tryInvert(const CanonicalForm &, bool &)
Definition int_poly.cc:264
InternalPoly::tryMulsame
InternalCF * tryMulsame(InternalCF *, const CanonicalForm &)
Definition int_poly.cc:428
InternalPoly::sign
int sign() const
int InternalPoly::sign () const
Definition int_poly.cc:110
InternalPoly::tryDivsame
InternalCF * tryDivsame(InternalCF *, const CanonicalForm &, bool &)
Definition int_poly.cc:584
InternalPoly::inPolyDomain
bool inPolyDomain() const
Definition int_poly.h:112
Variable
factory's class for variables
Definition factory.h:127
term
Definition int_poly.h:33
term::term
term(term *n, const CanonicalForm &c, int e)
Definition int_poly.h:43
term::CFIterator
friend class CFIterator
Definition int_poly.h:45
term::term_bin
static const omBin term_bin
Definition int_poly.h:39
term::InternalPoly
friend class InternalPoly
Definition int_poly.h:44
term::next
term * next
Definition int_poly.h:35
term::coeff
CanonicalForm coeff
Definition int_poly.h:36
term::term
term()
Definition int_poly.h:42
term::exp
int exp
Definition int_poly.h:37
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
last
STATIC_VAR poly last
Definition hdegree.cc:1138
int_cf.h
Factory's internal CanonicalForm's.
termList
term * termList
Definition int_poly.h:60
exp
gmp_float exp(const gmp_float &a)
Definition mpr_complex.cc:349
omTypeAllocBin
#define omTypeAllocBin(type, addr, bin)
Definition omAllocDecl.h:203
omFreeBin
#define omFreeBin(addr, bin)
Definition omAllocDecl.h:259
omBin
omBin_t * omBin
Definition omStructs.h:12
omalloc.h
variable.h
operations on variables