Loading...
Searching...
No Matches
Poly.h
Go to the documentation of this file.
#ifndef POLYCPP_HEADER
#define POLYCPP_HEADER
#include "kernel/mod2.h"
#include "IIntvec.h"
#include "coeffs/numbers.h"
#include "Number.h"
#include "kernel/polys.h"
#include "polys/monomials/ring.h"
#include <boost/shared_ptr.hpp>
#include <vector>
#include <exception>
using std::exception;
#define BOOST_DISABLE_THREADS
class DifferentDomainException: public std::exception
{
};
class ExceptionBasedErrorHandler
{
public:
static const bool handleErrors=true;
static void handleDifferentRing(ring r, ring s)
{
PrintS("throwing");
throw DifferentDomainException();
}
};
//PolyImpl is a 08/15 poly wrapper
//Poly wraps around PolyImpl with reference counting using boost
class TrivialErrorHandler
{
public:
static const bool handleErrors=false;
static void handleDifferentRing(ring r, ring s)
{}
};
typedef TrivialErrorHandler MyErrorHandler;
class PolyImpl
{
template <poly_variant,class,class> friend class PolyBase;
//friend class PolyBase<POLY_VARIANT_RING,Poly,TrivialErrorHandler>;
//friend class PolyBase<POLY_VARIANT_MODUL,Vector, TrivialErrorHandler>;
//friend class PolyBase<POLY_VARIANT_MODUL>;
friend class Poly;
friend class Vector;
//friend class Number;
protected:
poly getInternalReference() const
{
return p;
}
public:
ring getRing() const
{
return r.get();
}
friend inline bool operator==(const Poly& p1, const Poly& p2);
friend inline bool operator==(const Vector& p1, const Vector& p2);
friend PolyImpl operator+(const PolyImpl& p1, const PolyImpl& n2);
friend PolyImpl operator-(const PolyImpl& p1, const PolyImpl& n2);
friend PolyImpl operator/(const PolyImpl& p1, const PolyImpl& n2);
friend PolyImpl operator*(const PolyImpl& p1, const PolyImpl& n2);
friend bool operator==(const PolyImpl& p1, const PolyImpl& n2);
friend PolyImpl operator+(const PolyImpl& p1, int n2);
friend PolyImpl operator-(const PolyImpl& p1, int n2);
friend PolyImpl operator/(const PolyImpl& p1, int n2);
friend PolyImpl operator*(const PolyImpl& p1, int n2);
friend bool operator==(const PolyImpl& p1, int n2);
Number leadCoef()
{
return Number(p->coef,r.get());
}
PolyImpl& operator=(const PolyImpl& p2)
{
//durch Reihenfolge Selbstzuweisungen berücksichtigt
if (this==&p2) return *this;
poly pc=p_Copy(p2.p,p2.r.get());
if(r!=NULL)
p_Delete(&p,r.get());
r=p2.r;
p=pc;
return *this;
}
PolyImpl operator-()
{
PolyImpl t(*this);
t.p=p_Copy(p,r.get());
t.p=p_Neg(t.p,r.get());
return t;
}
PolyImpl& operator+=(const PolyImpl & p2)
{
if (r!=p2.r)
{
WerrorS("not the same ring");
return *this;
}
if (this==&p2)
{
number two=n_Init(2,r.get()->cf);
p_Mult_nn(p,two,r.get());
return *this;
}
p=p_Add_q(p,p_Copy(p2.p,p2.r.get()),r.get());
return *this;
}
PolyImpl& operator*=(const PolyImpl & p2)
{
if (r!=p2.r)
{
WerrorS("not the same ring");
return *this;
}
if (this==&p2)
{
poly pc=p_Copy(p,r.get());
p=p_Mult_q(p,p2.p,r.get());
return *this;
}
p=p_Mult_q(p,p_Copy(p2.p,p2.r.get()),r.get());
return *this;
}
PolyImpl& operator*=(const Number & n)
{
if (r!=n.r)
{
WerrorS("not the same ring");
return *this;
}
p=p_Mult_nn(p,n.n,r.get());
return *this;
}
PolyImpl& operator-=(const PolyImpl & p2)
{
if (r!=p2.r)
{
WerrorS("not the same ring");
return *this;
}
if (this==&p2)
{
p_Delete(&p,r.get());
p=NULL;
return *this;
}
poly pc=p_Copy(p2.p,p2.r.get());
pc=p_Neg(pc,r.get());
p=p_Add_q(p,pc,r.get());
return *this;
}
PolyImpl& operator=(int n)
{
p_Delete(&p,r.get());
p=p_ISet(n,r.get());
return *this;
}
PolyImpl()
{
r=currRing;
p=NULL;
}
PolyImpl(const PolyImpl & p)
{
r=p.r;
this->p=p_Copy(p.p,r.get());
}
PolyImpl(poly p, intrusive_ptr<ip_sring> r)
{
this->p=p_Copy(p,r.get());
this->r=r;
}
PolyImpl(poly p, intrusive_ptr<ip_sring> r,int)
{
this->p=p;
this->r=r;
}
PolyImpl(int n, intrusive_ptr<ip_sring> r)
{
this->p=p_ISet(n,r.get());
this->r=r;
}
PolyImpl(const Number & n)
{
r=n.r.get();
this->p=p_NSet(n_Copy(n.n,r.get()->cf),r.get());
}
explicit PolyImpl(int n)
{
r=currRing;
this->p=p_ISet(n,r.get());
}
void print()
{
p_Write(p,r.get(),r.get());
}
virtual ~PolyImpl()
{
if (r!=NULL)
p_Delete(&p,r.get());
}
protected:
poly p;
intrusive_ptr<ip_sring> r;
};
inline PolyImpl operator+(const PolyImpl &p1, const PolyImpl& p2)
{
PolyImpl erg(p1);
erg+=p2;
return erg;
}
inline PolyImpl operator*(const PolyImpl &p1, const PolyImpl& p2)
{
PolyImpl erg(p1);
erg*=p2;
return erg;
}
inline PolyImpl operator-(const PolyImpl &p1, const PolyImpl& p2)
{
PolyImpl erg(p1);
erg-=p2;
return erg;
}
inline PolyImpl operator+(const PolyImpl &p1, int p2)
{
PolyImpl erg(p1);
erg+=PolyImpl(p2,p1.r.get());
return erg;
}
inline PolyImpl operator*(const PolyImpl &p1, int p2)
{
PolyImpl erg(p1);
erg*=PolyImpl(p2,p1.r.get());
return erg;
}
inline PolyImpl operator-(const PolyImpl &p1, int p2)
{
PolyImpl erg(p1);
erg-=PolyImpl(p2,p1.r);
return erg;
}
inline PolyImpl operator+(int p1, const PolyImpl& p2)
{
PolyImpl erg(p2);
return erg+=PolyImpl(p1,p2.getRing());
}
inline PolyImpl operator*(int p1, const PolyImpl& p2)
{
PolyImpl erg(p2);
return erg*=PolyImpl(p1,p2.getRing());
}
using namespace boost;
template<class T> class ConstTermReference
{
private:
ring r;
poly t;
public:
operator T() const
{
return T(p_Head(t,r),r);
}
ConstTermReference(poly p, ring r)
{
this->t=p;
this->r=r;
}
bool isConstant() const
{
return p_LmIsConstant(t,r);
}
};
template<class T> class PolyInputIterator:
public std::iterator<std::input_iterator_tag,T,int, shared_ptr<const T>,ConstTermReference<T> >
{
private:
poly t;
ring r;
public:
bool operator==(const PolyInputIterator& t2)
{
return t2.t==t;
}
bool operator!=(const PolyInputIterator& t2)
{
return t2.t!=t;
}
PolyInputIterator(poly p, ring r)
{
t=p;
this->r=r;
}
PolyInputIterator(const PolyInputIterator& it)
{
t=it.t;
r=it.r;
}
PolyInputIterator& operator++()
{
t=t->next;
return *this;
}
PolyInputIterator operator++(int)
{
PolyInputIterator it(*this);
++(*this);
return it;
}
const ConstTermReference<T> operator*()
{
return ConstTermReference<T> (t,r);
}
shared_ptr<const T> operator->()
{
return shared_ptr<const T>(new T(p_Head(t,r),r,0));
}
};
template<poly_variant variant, class create_type_input, class error_handle_traits> class PolyBase
{
private:
typedef PolyBase<variant,create_type_input,error_handle_traits> ThisType;
public:
poly as_poly() const
{
return p_Copy(ptr->p,ptr->getRing());
}
template<class T> void checkIsSameRing(T& p)
{
if (error_handle_traits::handleErrors)
{
if (p.getRing()!=this->getRing())
{
error_handle_traits::handleDifferentRing(this->getRing(),
p.getRing()
);
}
}
}
typedef create_type_input create_type;
typedef PolyInputIterator<create_type> iterator;
Intvec leadExp()
{
int nvars=rVar(ptr->r.get());
Intvec res(nvars);
for(int i=0;i<nvars;i++)
{
res[i]=p_GetExp(ptr->p,i+1,ptr->getRing());
}
return res;
}
void copy_on_write()
{
if (!ptr.unique())
{
ptr.reset(new PolyImpl(*ptr));
}
}
void print() const
{
ptr->print();
}
//* resource managed by Singular
char* c_string() const
{
return p_String(ptr->p,ptr->getRing(),ptr->getRing());
}
PolyBase(ring r=currRing):ptr(new PolyImpl((poly) NULL,r))
{ }
PolyBase(const char* c, ring r=currRing):ptr(new PolyImpl((poly)NULL,r))
{
//p_Read takes no const so do
char* cp=(char*) omAlloc((strlen(c)+1)*sizeof(char));
strcpy(cp,c);
p_Read(cp,ptr->p,r);
omfree(cp);
}
PolyBase(const PolyBase&p):ptr(p.ptr){
}
PolyBase& operator+=(const PolyBase& p2){
checkIsSameRing(p2);
copy_on_write();
*ptr += *p2.ptr;
return *this;
}
PolyBase& operator*=(const Poly & p2);
PolyBase& operator*=(Number n){
copy_on_write();
*ptr *=n;
return *this;
}
/* void print(){
StringSetS("");
write();
PrintS(StringAppendS(""));
}*/
virtual ~PolyBase(){}
PolyBase(poly p, ring r):ptr(new PolyImpl(p_Copy(p,r),r)){
}
PolyBase(poly p, ring r,int):ptr(new PolyImpl(p,r,0)){
}
/*Poly(Poly& p){
ptr=p.ptr;
}*/
PolyInputIterator<create_type> begin(){
return PolyInputIterator<create_type>(ptr->p,ptr->getRing());
}
PolyInputIterator<create_type> end(){
return PolyInputIterator<create_type>(NULL, ptr->getRing());
}
ring getRing() const{
return ptr->getRing();
}
int lmTotalDegree() const{
return pTotaldegree(ptr->p);
}
Number leadCoef(){
return ptr->leadCoef();
}
create_type operator-(){
create_type erg(*this);
erg*=Number(-1,ptr->getRing());
return erg;
}
protected:
PolyBase(PolyImpl& impl):ptr(&impl){
}
poly getInternalReference(){
return ptr->getInternalReference();
}
protected:
shared_ptr<PolyImpl> ptr;
};
class Poly: public PolyBase<POLY_VARIANT_RING, Poly, MyErrorHandler>{
private:
typedef PolyBase<POLY_VARIANT_RING, Poly,MyErrorHandler> Base;
friend class Vector;
friend class PolyBase<POLY_VARIANT_MODUL,Vector,MyErrorHandler>;
public:
Poly(ring r=currRing):Base ((poly)NULL,r,0){
}
Poly(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){
}
Poly(const char* c, ring r=currRing):Base(c,r){
}
Poly(const Base& p):Base(p){
}
Poly(const Number& n):Base(*(new PolyImpl(n))){
}
Poly(poly p, ring r):Base(p,r){
}
Poly(poly p, ring r, int):Base(p,r,0){
}
Poly(const std::vector<int>& v, ring r=currRing):Base(*(new PolyImpl((poly) NULL,r))){
unsigned int i;
int s=v.size();
poly p=p_ISet(1,r);
for(i=0;i<v.size();i++){
pSetExp(p,i+1,v[i]);
}
pSetm(p);
ptr.reset(new PolyImpl(p,r));
}
/* Poly& operator+=(const Number& n){
Poly p2(n);
((PolyBase<POLY_VARIANT_RING, Poly>&) (*this))+=p2;
return *this;
}*/
Poly& operator+=(const Poly& p ){
((Base&)*this)+=p;
return *this;
}
Poly& operator+=(const Base& p ){
((Base&)*this)+=p;
return *this;
}
friend inline bool operator==(const Poly& p1, const Poly& p2);
};
class Vector: public PolyBase<POLY_VARIANT_MODUL, Vector, MyErrorHandler>{
private:
typedef PolyBase<POLY_VARIANT_MODUL, Vector, MyErrorHandler> Base;
public:
Vector(ring r=currRing):Base ((poly)NULL,r,0){
}
Vector(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){
}
Vector(const char* c, ring r=currRing):Base(c,r){
}
Vector(const Base& p):Base(p){
}
Vector(poly p, ring r):Base(p,r){
}
Vector(poly p, ring r, int):Base(p,r,0){
}
Vector(std::vector<int> v, ring r=currRing):Base(*(new PolyImpl((poly) NULL,r))){
unsigned int i;
int s=v.size();
poly p=p_ISet(1,r);
for(i=0;i<v.size();i++){
pSetExp(p,i+1,v[i]);
}
pSetm(p);
ptr.reset(new PolyImpl(p,r));
}
/* Poly& operator+=(const Number& n){
Poly p2(n);
((PolyBase<POLY_VARIANT_MODUL, Poly>&) (*this))+=p2;
return *this;
}*/
Vector& operator+=(const Vector& p ){
((Base&)*this)+=p;
return *this;
}
Vector& operator+=(const Base& p ){
((Base&)*this)+=p;
return *this;
}
friend inline bool operator==(const Vector& p1, const Vector& p2);
};
//typedef Poly PolyBase<POLY_VARIANT_RING>::create_type;
/*template <poly_variant v, class c> inline PolyBase<v> operator+(const PolyBase<v,c>& p1, const PolyBase<v,c>& p2){
PolyImpl* res=new PolyImpl(*p1.ptr);
*res+=*p2.ptr;
return(PolyBase<v,c>(*res));
}*/
/*template <poly_variant v> inline PolyBase<v> operator*(const PolyBase<v>& p1, const PolyBase<v>& p2){
PolyImpl* res=new PolyImpl(*p1.ptr);
*res *= *p2.ptr;
return(PolyBase<v> (*res));
}*/
/*template <class c> inline PolyBase<POLY_VARIANT_MODUL> operator*(const PolyBase<POLY_VARIANT_MODUL>& p1, const Number& n){
PolyBase<POLY_VARIANT_MODUL> erg(p1);
erg*=n;
return erg;
}*/
inline Poly operator*(const Poly& p, const Poly& p2){
Poly erg=p;
erg*=p2;
return erg;
}
inline Vector operator*(const Number& n, const Vector& v){
Vector res=v;
res*=n;
return res;
}
//assumes monomials commute with numbers
template <poly_variant variant, class create_type, class error_traits>
inline typename PolyBase<variant,create_type, error_traits>::create_type
operator*
(const Number& n,
const PolyBase<variant,create_type, class error_tratis>& p)
{
typename PolyBase<variant, create_type,error_traits>::create_type erg(p);
erg*=n;
return erg;
}
inline Vector operator*(const Poly& p, const Vector& v){
Vector res(v);
res*=p;
return res;
}
inline Poly operator+(const Poly& p1, const Number& n){
Poly f(p1);
f+=n;
return f;
}
inline bool operator==(const Poly& p1, const Poly& p2){
ring r1=p1.getRing();
ring r2=p2.getRing();
if (r1!=r2) return false;
return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
}
inline bool operator==(const Vector& p1, const Vector& p2){
ring r1=p1.getRing();
ring r2=p2.getRing();
if (r1!=r2) return false;
return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
}
template <poly_variant variant, class create_type,class error_traits>
inline typename PolyBase<variant,create_type,error_traits>::create_type
operator+
(const PolyBase<variant,create_type,error_traits>& b1,
const PolyBase<variant,create_type,error_traits>& b2)
{
typename PolyBase<variant, create_type, error_traits>::create_type erg(b1);
erg+=b2;
return erg;
}
inline Vector unitVector(int i,ring r=currRing){
poly p=p_ISet(1,r);
p_SetComp(p,i,r);
return Vector(p,r,0);
}
inline Poly operator*(const Number& n, const Poly & p){
Poly res=p;
res*=n;
return res;
}
template <poly_variant variant, class create_type, class error_traits>
inline PolyBase<variant, create_type, error_traits>&
PolyBase<variant, create_type, error_traits>::operator*=(const Poly & p2){
copy_on_write();
*ptr *= *p2.ptr;
return *this;
}
#endif
IIntvec.h
Number.h
POLY_VARIANT_MODUL
@ POLY_VARIANT_MODUL
Definition Number.h:27
MyErrorHandler
TrivialErrorHandler MyErrorHandler
Definition Poly.h:43
operator-
PolyImpl operator-(const PolyImpl &p1, const PolyImpl &p2)
Definition Poly.h:225
operator==
bool operator==(const Poly &p1, const Poly &p2)
Definition Poly.h:608
unitVector
Vector unitVector(int i, ring r=currRing)
Definition Poly.h:630
operator+
PolyImpl operator+(const PolyImpl &p1, const PolyImpl &p2)
Definition Poly.h:213
operator*
PolyImpl operator*(const PolyImpl &p1, const PolyImpl &p2)
Definition Poly.h:219
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
f
FILE * f
Definition checklibs.c:9
ConstTermReference
Definition Poly.h:263
ConstTermReference::r
ring r
Definition Poly.h:265
ConstTermReference::isConstant
bool isConstant() const
Definition Poly.h:277
ConstTermReference::ConstTermReference
ConstTermReference(poly p, ring r)
Definition Poly.h:272
ConstTermReference::t
poly t
Definition Poly.h:266
DifferentDomainException
Definition Poly.h:20
ExceptionBasedErrorHandler
Definition Poly.h:24
ExceptionBasedErrorHandler::handleDifferentRing
static void handleDifferentRing(ring r, ring s)
Definition Poly.h:27
ExceptionBasedErrorHandler::handleErrors
static const bool handleErrors
Definition Poly.h:26
Intvec
Definition IIntvec.h:6
Number
Definition Number.h:34
Number::r
intrusive_ptr< ip_sring > r
Definition Number.h:218
Number::n
number n
Definition Number.h:217
PolyBase
Definition Poly.h:330
PolyBase::PolyBase
PolyBase(PolyImpl &impl)
Definition Poly.h:443
PolyBase::checkIsSameRing
void checkIsSameRing(T &p)
Definition Poly.h:338
PolyBase::operator*=
PolyBase & operator*=(Number n)
Definition Poly.h:401
PolyBase::PolyBase
PolyBase(poly p, ring r)
Definition Poly.h:413
PolyBase::leadExp
Intvec leadExp()
Definition Poly.h:352
PolyBase::getRing
ring getRing() const
Definition Poly.h:427
PolyBase::lmTotalDegree
int lmTotalDegree() const
Definition Poly.h:430
PolyBase::operator-
create_type operator-()
Definition Poly.h:436
PolyBase::end
PolyInputIterator< create_type > end()
Definition Poly.h:424
PolyBase::getInternalReference
poly getInternalReference()
Definition Poly.h:446
PolyBase::PolyBase
PolyBase(poly p, ring r, int)
Definition Poly.h:415
PolyBase::~PolyBase
virtual ~PolyBase()
Definition Poly.h:412
PolyBase::operator+=
PolyBase & operator+=(const PolyBase &p2)
Definition Poly.h:393
PolyBase::PolyBase
PolyBase(ring r=currRing)
Definition Poly.h:378
PolyBase::create_type
create_type_input create_type
Definition Poly.h:350
PolyBase::ThisType
PolyBase< variant, create_type_input, error_handle_traits > ThisType
Definition Poly.h:332
PolyBase::as_poly
poly as_poly() const
Definition Poly.h:334
PolyBase::copy_on_write
void copy_on_write()
Definition Poly.h:362
PolyBase::leadCoef
Number leadCoef()
Definition Poly.h:433
PolyBase::operator*=
PolyBase & operator*=(const Poly &p2)
Definition Poly.h:643
PolyBase::print
void print() const
Definition Poly.h:369
PolyBase::c_string
char * c_string() const
Definition Poly.h:374
PolyBase::PolyBase
PolyBase(const PolyBase &p)
Definition Poly.h:388
PolyBase::begin
PolyInputIterator< create_type > begin()
Definition Poly.h:421
PolyBase::iterator
PolyInputIterator< create_type > iterator
Definition Poly.h:351
PolyBase< POLY_VARIANT_RING, Poly, MyErrorHandler >::ptr
shared_ptr< PolyImpl > ptr
Definition Poly.h:451
PolyBase::PolyBase
PolyBase(const char *c, ring r=currRing)
Definition Poly.h:380
PolyImpl
Definition Poly.h:45
PolyImpl::PolyBase
friend class PolyBase
Definition Poly.h:46
PolyImpl::PolyImpl
PolyImpl(int n, intrusive_ptr< ip_sring > r)
Definition Poly.h:184
PolyImpl::operator=
PolyImpl & operator=(int n)
Definition Poly.h:158
PolyImpl::PolyImpl
PolyImpl(int n)
Definition Poly.h:194
PolyImpl::r
intrusive_ptr< ip_sring > r
Definition Poly.h:210
PolyImpl::PolyImpl
PolyImpl(const Number &n)
Definition Poly.h:189
PolyImpl::leadCoef
Number leadCoef()
Definition Poly.h:75
PolyImpl::getRing
ring getRing() const
Definition Poly.h:59
PolyImpl::operator==
friend bool operator==(const PolyImpl &p1, int n2)
PolyImpl::operator*=
PolyImpl & operator*=(const Number &n)
Definition Poly.h:130
PolyImpl::PolyImpl
PolyImpl(poly p, intrusive_ptr< ip_sring > r)
Definition Poly.h:174
PolyImpl::operator+
friend PolyImpl operator+(const PolyImpl &p1, const PolyImpl &n2)
Definition Poly.h:213
PolyImpl::operator==
friend bool operator==(const Poly &p1, const Poly &p2)
Definition Poly.h:608
PolyImpl::PolyImpl
PolyImpl(const PolyImpl &p)
Definition Poly.h:169
PolyImpl::operator=
PolyImpl & operator=(const PolyImpl &p2)
Definition Poly.h:79
PolyImpl::operator*
friend PolyImpl operator*(const PolyImpl &p1, const PolyImpl &n2)
Definition Poly.h:219
PolyImpl::print
void print()
Definition Poly.h:199
PolyImpl::Vector
friend class Vector
Definition Poly.h:51
PolyImpl::p
poly p
Definition Poly.h:209
PolyImpl::PolyImpl
PolyImpl()
Definition Poly.h:164
PolyImpl::operator+=
PolyImpl & operator+=(const PolyImpl &p2)
Definition Poly.h:97
PolyImpl::operator/
friend PolyImpl operator/(const PolyImpl &p1, const PolyImpl &n2)
PolyImpl::operator-=
PolyImpl & operator-=(const PolyImpl &p2)
Definition Poly.h:140
PolyImpl::operator*=
PolyImpl & operator*=(const PolyImpl &p2)
Definition Poly.h:114
PolyImpl::operator==
friend bool operator==(const PolyImpl &p1, const PolyImpl &n2)
PolyImpl::Poly
friend class Poly
Definition Poly.h:50
PolyImpl::~PolyImpl
virtual ~PolyImpl()
Definition Poly.h:203
PolyImpl::operator-
PolyImpl operator-()
Definition Poly.h:90
PolyImpl::PolyImpl
PolyImpl(poly p, intrusive_ptr< ip_sring > r, int)
Definition Poly.h:179
PolyImpl::getInternalReference
poly getInternalReference() const
Definition Poly.h:54
PolyImpl::operator/
friend PolyImpl operator/(const PolyImpl &p1, int n2)
PolyInputIterator
Definition Poly.h:285
PolyInputIterator::operator==
bool operator==(const PolyInputIterator &t2)
Definition Poly.h:290
PolyInputIterator::operator++
PolyInputIterator operator++(int)
Definition Poly.h:313
PolyInputIterator::operator*
const ConstTermReference< T > operator*()
Definition Poly.h:319
PolyInputIterator::PolyInputIterator
PolyInputIterator(const PolyInputIterator &it)
Definition Poly.h:303
PolyInputIterator::operator!=
bool operator!=(const PolyInputIterator &t2)
Definition Poly.h:294
PolyInputIterator::operator++
PolyInputIterator & operator++()
Definition Poly.h:308
PolyInputIterator< create_type >::r
ring r
Definition Poly.h:288
PolyInputIterator< create_type >::t
poly t
Definition Poly.h:287
PolyInputIterator::PolyInputIterator
PolyInputIterator(poly p, ring r)
Definition Poly.h:298
PolyInputIterator::operator->
shared_ptr< const T > operator->()
Definition Poly.h:323
TrivialErrorHandler
Definition Poly.h:37
TrivialErrorHandler::handleDifferentRing
static void handleDifferentRing(ring r, ring s)
Definition Poly.h:40
TrivialErrorHandler::handleErrors
static const bool handleErrors
Definition Poly.h:39
Vector
Definition Poly.h:509
Vector::Vector
Vector(poly p, ring r)
Definition Poly.h:526
Vector::Vector
Vector(int n, ring r=currRing)
Definition Poly.h:516
Vector::Vector
Vector(const char *c, ring r=currRing)
Definition Poly.h:519
Vector::operator==
friend bool operator==(const Vector &p1, const Vector &p2)
Definition Poly.h:614
Vector::Vector
Vector(const Base &p)
Definition Poly.h:522
Vector::Vector
Vector(ring r=currRing)
Definition Poly.h:514
Vector::operator+=
Vector & operator+=(const Base &p)
Definition Poly.h:551
Vector::Base
PolyBase< POLY_VARIANT_MODUL, Vector, MyErrorHandler > Base
Definition Poly.h:511
Vector::Vector
Vector(poly p, ring r, int)
Definition Poly.h:529
Vector::Vector
Vector(std::vector< int > v, ring r=currRing)
Definition Poly.h:531
Vector::operator+=
Vector & operator+=(const Vector &p)
Definition Poly.h:546
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
s
const CanonicalForm int s
Definition facAbsFact.cc:51
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
T
STATIC_VAR jList * T
Definition janet.cc:30
mod2.h
numbers.h
omfree
#define omfree(addr)
Definition omAllocDecl.h:237
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
NULL
#define NULL
Definition omList.c:12
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
p_NSet
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition p_polys.cc:1474
p_Read
const char * p_Read(const char *st, poly &rc, const ring r)
Definition p_polys.cc:1371
p_EqualPolys
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition p_polys.cc:4666
p_Neg
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1114
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
p_String
char * p_String(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:322
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
p_Head
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition p_polys.h:1025
p_Mult_nn
static poly p_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:960
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
polys.h
Compatibility layer for legacy polynomial operations (over currRing).
pTotaldegree
static long pTotaldegree(poly p)
Definition polys.h:283
pSetm
#define pSetm(p)
Definition polys.h:272
pSetExp
#define pSetExp(p, i, v)
Definition polys.h:43
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
ring.h
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
Poly
Definition janet.h:15
Poly::Poly
Poly(const Number &n)
Definition Poly.h:473
Poly::Poly
Poly(const char *c, ring r=currRing)
Definition Poly.h:467
Poly::Poly
Poly(int n, ring r=currRing)
Definition Poly.h:464
Poly::Poly
Poly(ring r=currRing)
Definition Poly.h:462
Poly::operator==
friend bool operator==(const Poly &p1, const Poly &p2)
Definition Poly.h:608
Poly::Poly
Poly(poly p, ring r, int)
Definition Poly.h:479
Poly::Vector
friend class Vector
Definition Poly.h:458
Poly::Poly
Poly(const std::vector< int > &v, ring r=currRing)
Definition Poly.h:481
Poly::Poly
Poly(poly p, ring r)
Definition Poly.h:476
Poly::Poly
Poly(const Base &p)
Definition Poly.h:470
Poly::Base
PolyBase< POLY_VARIANT_RING, Poly, MyErrorHandler > Base
Definition Poly.h:457
Poly::operator+=
Poly & operator+=(const Base &p)
Definition Poly.h:501
Poly::operator+=
Poly & operator+=(const Poly &p)
Definition Poly.h:496