My Project
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
PolyImpl Class Reference

#include <Poly.h>

Public Member Functions

ring getRing () const
 
Number leadCoef ()
 
PolyImploperator= (const PolyImpl &p2)
 
PolyImpl operator- ()
 
PolyImploperator+= (const PolyImpl &p2)
 
PolyImploperator*= (const PolyImpl &p2)
 
PolyImploperator*= (const Number &n)
 
PolyImploperator-= (const PolyImpl &p2)
 
PolyImploperator= (int n)
 
 PolyImpl ()
 
 PolyImpl (const PolyImpl &p)
 
 PolyImpl (poly p, intrusive_ptr< ip_sring > r)
 
 PolyImpl (poly p, intrusive_ptr< ip_sring > r, int)
 
 PolyImpl (int n, intrusive_ptr< ip_sring > r)
 
 PolyImpl (const Number &n)
 
 PolyImpl (int n)
 
void print ()
 
virtual ~PolyImpl ()
 

Protected Member Functions

poly getInternalReference () const
 

Protected Attributes

poly p
 
intrusive_ptr< ip_sringr
 

Friends

template<poly_variant , class , class >
class PolyBase
 
class Poly
 
class Vector
 
bool operator== (const Poly &p1, const Poly &p2)
 
bool operator== (const Vector &p1, const Vector &p2)
 
PolyImpl operator+ (const PolyImpl &p1, const PolyImpl &n2)
 
PolyImpl operator- (const PolyImpl &p1, const PolyImpl &n2)
 
PolyImpl operator/ (const PolyImpl &p1, const PolyImpl &n2)
 
PolyImpl operator* (const PolyImpl &p1, const PolyImpl &n2)
 
bool operator== (const PolyImpl &p1, const PolyImpl &n2)
 
PolyImpl operator+ (const PolyImpl &p1, int n2)
 
PolyImpl operator- (const PolyImpl &p1, int n2)
 
PolyImpl operator/ (const PolyImpl &p1, int n2)
 
PolyImpl operator* (const PolyImpl &p1, int n2)
 
bool operator== (const PolyImpl &p1, int n2)
 

Detailed Description

Definition at line 44 of file Poly.h.

Constructor & Destructor Documentation

◆ PolyImpl() [1/7]

PolyImpl::PolyImpl ( )
inline

Definition at line 164 of file Poly.h.

165 {
166 r=currRing;
167 p=NULL;
168 }
intrusive_ptr< ip_sring > r
Definition: Poly.h:210
poly p
Definition: Poly.h:209
#define NULL
Definition: omList.c:12
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ PolyImpl() [2/7]

PolyImpl::PolyImpl ( const PolyImpl p)
inline

Definition at line 169 of file Poly.h.

170 {
171 r=p.r;
172 this->p=p_Copy(p.p,r.get());
173 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844

◆ PolyImpl() [3/7]

PolyImpl::PolyImpl ( poly  p,
intrusive_ptr< ip_sring r 
)
inline

Definition at line 174 of file Poly.h.

175 {
176 this->p=p_Copy(p,r.get());
177 this->r=r;
178 }

◆ PolyImpl() [4/7]

PolyImpl::PolyImpl ( poly  p,
intrusive_ptr< ip_sring r,
int   
)
inline

Definition at line 179 of file Poly.h.

180 {
181 this->p=p;
182 this->r=r;
183 }

◆ PolyImpl() [5/7]

PolyImpl::PolyImpl ( int  n,
intrusive_ptr< ip_sring r 
)
inline

Definition at line 184 of file Poly.h.

185 {
186 this->p=p_ISet(n,r.get());
187 this->r=r;
188 }
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

◆ PolyImpl() [6/7]

PolyImpl::PolyImpl ( const Number n)
inline

Definition at line 189 of file Poly.h.

190 {
191 r=n.r.get();
192 this->p=p_NSet(n_Copy(n.n,r.get()->cf),r.get());
193 }
intrusive_ptr< ip_sring > r
Definition: Number.h:218
number n
Definition: Number.h:217
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1473

◆ PolyImpl() [7/7]

PolyImpl::PolyImpl ( int  n)
inlineexplicit

Definition at line 194 of file Poly.h.

195 {
196 r=currRing;
197 this->p=p_ISet(n,r.get());
198 }

◆ ~PolyImpl()

virtual PolyImpl::~PolyImpl ( )
inlinevirtual

Definition at line 203 of file Poly.h.

204 {
205 if (r!=NULL)
206 p_Delete(&p,r.get());
207 }
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899

Member Function Documentation

◆ getInternalReference()

poly PolyImpl::getInternalReference ( ) const
inlineprotected

Definition at line 54 of file Poly.h.

55 {
56 return p;
57 }

◆ getRing()

ring PolyImpl::getRing ( ) const
inline

Definition at line 59 of file Poly.h.

60 {
61 return r.get();
62 }

◆ leadCoef()

Number PolyImpl::leadCoef ( )
inline

Definition at line 75 of file Poly.h.

76 {
77 return Number(p->coef,r.get());
78 }
Definition: Number.h:34

◆ operator*=() [1/2]

PolyImpl & PolyImpl::operator*= ( const Number n)
inline

Definition at line 130 of file Poly.h.

131 {
132 if (r!=n.r)
133 {
134 WerrorS("not the same ring");
135 return *this;
136 }
137 p=p_Mult_nn(p,n.n,r.get());
138 return *this;
139 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:956

◆ operator*=() [2/2]

PolyImpl & PolyImpl::operator*= ( const PolyImpl p2)
inline

Definition at line 114 of file Poly.h.

115 {
116 if (r!=p2.r)
117 {
118 WerrorS("not the same ring");
119 return *this;
120 }
121 if (this==&p2)
122 {
123 poly pc=p_Copy(p,r.get());
124 p=p_Mult_q(p,p2.p,r.get());
125 return *this;
126 }
127 p=p_Mult_q(p,p_Copy(p2.p,p2.r.get()),r.get());
128 return *this;
129 }
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1112

◆ operator+=()

PolyImpl & PolyImpl::operator+= ( const PolyImpl p2)
inline

Definition at line 97 of file Poly.h.

98 {
99 if (r!=p2.r)
100 {
101 WerrorS("not the same ring");
102 return *this;
103 }
104 if (this==&p2)
105 {
106 number two=n_Init(2,r.get()->cf);
107 p_Mult_nn(p,two,r.get());
108 return *this;
109 }
110 p=p_Add_q(p,p_Copy(p2.p,p2.r.get()),r.get());
111
112 return *this;
113 }
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:535
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934

◆ operator-()

PolyImpl PolyImpl::operator- ( )
inline

Definition at line 90 of file Poly.h.

91 {
92 PolyImpl t(*this);
93 t.p=p_Copy(p,r.get());
94 t.p=p_Neg(t.p,r.get());
95 return t;
96 }
Definition: Poly.h:45
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1105

◆ operator-=()

PolyImpl & PolyImpl::operator-= ( const PolyImpl p2)
inline

Definition at line 140 of file Poly.h.

141 {
142 if (r!=p2.r)
143 {
144 WerrorS("not the same ring");
145 return *this;
146 }
147 if (this==&p2)
148 {
149 p_Delete(&p,r.get());
150 p=NULL;
151 return *this;
152 }
153 poly pc=p_Copy(p2.p,p2.r.get());
154 pc=p_Neg(pc,r.get());
155 p=p_Add_q(p,pc,r.get());
156 return *this;
157 }

◆ operator=() [1/2]

PolyImpl & PolyImpl::operator= ( const PolyImpl p2)
inline

Definition at line 79 of file Poly.h.

80 {
81 //durch Reihenfolge Selbstzuweisungen berücksichtigt
82 if (this==&p2) return *this;
83 poly pc=p_Copy(p2.p,p2.r.get());
84 if(r!=NULL)
85 p_Delete(&p,r.get());
86 r=p2.r;
87 p=pc;
88 return *this;
89 }

◆ operator=() [2/2]

PolyImpl & PolyImpl::operator= ( int  n)
inline

Definition at line 158 of file Poly.h.

159 {
160 p_Delete(&p,r.get());
161 p=p_ISet(n,r.get());
162 return *this;
163 }

◆ print()

void PolyImpl::print ( )
inline

Definition at line 199 of file Poly.h.

200 {
201 p_Write(p,r.get(),r.get());
202 }
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:342

Friends And Related Function Documentation

◆ operator* [1/2]

PolyImpl operator* ( const PolyImpl p1,
const PolyImpl n2 
)
friend

Definition at line 219 of file Poly.h.

220{
221 PolyImpl erg(p1);
222 erg*=p2;
223 return erg;
224}

◆ operator* [2/2]

PolyImpl operator* ( const PolyImpl p1,
int  n2 
)
friend

Definition at line 237 of file Poly.h.

238{
239 PolyImpl erg(p1);
240 erg*=PolyImpl(p2,p1.r.get());
241 return erg;
242}
PolyImpl()
Definition: Poly.h:164

◆ operator+ [1/2]

PolyImpl operator+ ( const PolyImpl p1,
const PolyImpl n2 
)
friend

Definition at line 213 of file Poly.h.

214{
215 PolyImpl erg(p1);
216 erg+=p2;
217 return erg;
218}

◆ operator+ [2/2]

PolyImpl operator+ ( const PolyImpl p1,
int  n2 
)
friend

Definition at line 231 of file Poly.h.

232{
233 PolyImpl erg(p1);
234 erg+=PolyImpl(p2,p1.r.get());
235 return erg;
236}

◆ operator- [1/2]

PolyImpl operator- ( const PolyImpl p1,
const PolyImpl n2 
)
friend

Definition at line 225 of file Poly.h.

226{
227 PolyImpl erg(p1);
228 erg-=p2;
229 return erg;
230}

◆ operator- [2/2]

PolyImpl operator- ( const PolyImpl p1,
int  n2 
)
friend

Definition at line 243 of file Poly.h.

244{
245 PolyImpl erg(p1);
246 erg-=PolyImpl(p2,p1.r);
247 return erg;
248}

◆ operator/ [1/2]

PolyImpl operator/ ( const PolyImpl p1,
const PolyImpl n2 
)
friend

◆ operator/ [2/2]

PolyImpl operator/ ( const PolyImpl p1,
int  n2 
)
friend

◆ operator== [1/4]

bool operator== ( const Poly p1,
const Poly p2 
)
friend

Definition at line 608 of file Poly.h.

608 {
609 ring r1=p1.getRing();
610 ring r2=p2.getRing();
611 if (r1!=r2) return false;
612 return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
613}
ring getRing() const
Definition: Poly.h:427
shared_ptr< PolyImpl > ptr
Definition: Poly.h:451
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4512

◆ operator== [2/4]

bool operator== ( const PolyImpl p1,
const PolyImpl n2 
)
friend

◆ operator== [3/4]

bool operator== ( const PolyImpl p1,
int  n2 
)
friend

◆ operator== [4/4]

bool operator== ( const Vector p1,
const Vector p2 
)
friend

Definition at line 614 of file Poly.h.

614 {
615 ring r1=p1.getRing();
616 ring r2=p2.getRing();
617 if (r1!=r2) return false;
618 return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
619}

◆ Poly

friend class Poly
friend

Definition at line 50 of file Poly.h.

◆ PolyBase

template<poly_variant , class , class >
friend class PolyBase
friend

Definition at line 46 of file Poly.h.

◆ Vector

friend class Vector
friend

Definition at line 51 of file Poly.h.

Field Documentation

◆ p

poly PolyImpl::p
protected

Definition at line 209 of file Poly.h.

◆ r

intrusive_ptr<ip_sring> PolyImpl::r
protected

Definition at line 210 of file Poly.h.


The documentation for this class was generated from the following file: