14 #include <factory/factory.h> 28 number nAEpMult (number
a, number
b,
const coeffs r);
29 number nAEpSub (number
a, number
b,
const coeffs r);
30 number nAEpAdd (number
a, number
b,
const coeffs r);
31 number nAEpDiv (number
a, number
b,
const coeffs r);
32 number nAEpIntMod (number
a, number
b,
const coeffs r);
33 number nAEpExactDiv (number
a, number
b,
const coeffs r);
34 number nAEpInit (
long i,
const coeffs r);
35 number nAEpInitMPZ (mpz_t
m,
const coeffs r);
36 int nAEpSize (number
a,
const coeffs r);
37 long nAEpInt (number &
a,
const coeffs r);
38 number nAEpMPZ (number
a,
const coeffs r);
39 number nAEpNeg (number c,
const coeffs r);
40 number nAEpCopy (number
a, number
b,
const coeffs r);
41 number nAEpRePart (number
a, number
b,
const coeffs r);
42 number nAEpImPart (number
a, number
b,
const coeffs r);
44 void nAEpWriteLong (number &
a,
const coeffs r);
45 void nAEpWriteShort (number &
a,
const coeffs r);
48 const char * nAEpRead (
const char *
s, number *
a,
const coeffs r);
49 number nAEpNormalize (number
a, number
b,
const coeffs r);
57 number nAEpGetDenom (number &
a,
const coeffs r);
58 number nAEpGetNumerator (number &
a,
const coeffs r);
59 number nAEpGcd (number
a, number
b,
const coeffs r);
60 number nAEpLcm (number
a, number
b,
const coeffs r);
62 void nAEpDelete (number *
a,
const coeffs r);
63 number nAEpSetMap (number
a,
const coeffs r);
64 void nAEpInpMult (number &
a ,number
b,
const coeffs r);
73 number nAEpAdd(number
a, number
b,
const coeffs)
75 p_poly*
f=
reinterpret_cast<p_poly*
> (
a);
76 p_poly*
g=
reinterpret_cast<p_poly*
> (
b);
77 p_poly *
res=
new p_poly;
79 res->p_poly_add_to(*g);
83 number nAEpMult(number a, number b,
const coeffs)
85 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
86 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
87 p_poly *res=
new p_poly;
89 res->p_poly_mult_n_to(*g);
93 number nAEpSub(number a, number b,
const coeffs)
95 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
96 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
97 p_poly *res=
new p_poly;
99 res->p_poly_sub_to(*g);
104 number nAEpDiv(number a, number b,
const coeffs)
106 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
107 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
108 p_poly *res=
new p_poly;
109 p_poly *
s=
new p_poly;
111 res->p_poly_div_to(*res,*s,*g);
116 number nAEpIntMod(number a, number,
const coeffs)
121 number nAEpExactDiv(number a, number b,
const coeffs)
123 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
124 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
125 p_poly *res=
new p_poly;
126 p_poly *s=
new p_poly;
128 res->p_poly_div_to(*res,*s,*g);
134 number nAEpInit(
long i,
const coeffs)
138 mpz_init_set_ui(m, i);
139 p_poly* res=
new p_poly;
140 res->p_poly_set(m, j);
141 number res1=
reinterpret_cast<number
>(
res);
145 number nAEpInitMPZ(mpz_t m,
const coeffs)
148 p_poly* res=
new p_poly;
149 res->p_poly_set(m, j);
150 number res1=
reinterpret_cast<number
>(
res);
155 int nAEpSize (number a,
const coeffs)
157 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
161 long nAEpInt(number &,
const coeffs)
167 number nAEpMPZ(number a,
const coeffs)
173 number nAEpNeg(number c,
const coeffs)
175 p_poly* f=
reinterpret_cast<p_poly*
> (c);
176 p_poly *res=
new p_poly;
182 number nAEpCopy(number c,
const coeffs)
187 number nAEpRePart(number c,
const coeffs)
192 number nAEpImPart(number c,
const coeffs)
197 void nAEpWriteLong (number a,
const coeffs)
199 p_poly* f=reinterpret_cast <p_poly*>(
a);
205 void nAEpWriteShort (number a,
const coeffs)
207 p_poly* f=reinterpret_cast <p_poly*>(
a);
213 const char * nAEpRead (
const char *, number *a,
const coeffs)
215 p_poly& f=reinterpret_cast <p_poly&>(
a);
218 *a=reinterpret_cast <number>(&
f);
224 number nAEpNormalize (number a, number,
const coeffs)
231 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
232 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
233 if (f->deg > g->deg) {
return FALSE;}
239 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
240 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
241 if (f->is_equal(*g) == 1) {
return FALSE;}
247 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
248 if (f->is_zero() == 1) {
return FALSE;}
254 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
255 if (f->is_one() == 1) {
return FALSE;}
261 number b=nAEpNeg(a, r);
262 p_poly* f=
reinterpret_cast<p_poly*
> (
b);
263 if (f->is_one() == 1) {
return FALSE;}
269 if (nAEpIsZero(a, r) ==
FALSE) {
return TRUE; }
270 else {
return FALSE; }
273 void nAEpPower (number,
int, number *,
const coeffs)
278 number nAEpGetDenom (number &,
const coeffs)
283 number nAEpGetNumerator (number &a,
const coeffs)
288 number nAEpGcd (number a, number b,
const coeffs)
290 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
291 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
292 p_poly *res=
new p_poly;
293 res->p_poly_gcd(*f,*g);
297 number nAEpLcm (number a, number b,
const coeffs)
299 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
300 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
301 p_poly *
gcd=
new p_poly;
302 p_poly *res=
new p_poly;
303 p_poly *s=
new p_poly;
304 gcd->p_poly_gcd(*f,*g);
305 res->p_poly_mult_n(*f,*g);
306 res->p_poly_div_to(*res,*s,*gcd);
310 void nAEpDelete (number *,
const coeffs)
322 void nAEpInpMult (number &a, number b,
const coeffs)
324 p_poly* f=
reinterpret_cast<p_poly*
> (
a);
325 p_poly* g=
reinterpret_cast<p_poly*
> (
b);
326 f->p_poly_mult_n_to(*g);
355 const int c = (int) (
long)
p;
361 r->cfMult = nAEpMult;
365 r->cfIntMod= nAEpIntMod;
366 r->cfExactDiv= nAEpExactDiv;
367 r->cfInit = nAEpInit;
368 r->cfSize = nAEpSize;
377 r->cfInpNeg = nAEpNeg;
382 r->cfWriteLong = nAEpWriteLong;
383 r->cfRead = nAEpRead;
385 r->cfGreater = nAEpGreater;
386 r->cfEqual = nAEpEqual;
387 r->cfIsZero = nAEpIsZero;
388 r->cfIsOne = nAEpIsOne;
389 r->cfIsMOne = nAEpIsOne;
390 r->cfGreaterZero = nAEpGreaterZero;
391 r->cfPower = nAEpPower;
392 r->cfGetDenom = nAEpGetDenom;
393 r->cfGetNumerator = nAEpGetNumerator;
396 r->cfDelete= nAEpDelete;
400 r->cfInpMult=nAEpInpMult;
401 r->cfCoeffWrite=nAEpCoeffWrite;
405 r->nNULL = (number) 0;
408 r->has_simple_Alloc=
TRUE;
409 r->has_simple_Inverse=
TRUE;
const CanonicalForm int s
Coefficient rings, fields and other domains suitable for Singular polynomials.
The main handler for Singular numbers which are suitable for Singular polynomials.
nMapFunc npSetMap(const coeffs src, const coeffs dst)