My Project
Loading...
Searching...
No Matches
clapconv.cc File Reference
#include "misc/auxiliary.h"
#include "factory/factory.h"
#include "coeffs/coeffs.h"
#include "coeffs/longrat.h"
#include "polys/monomials/p_polys.h"
#include "polys/sbuckets.h"
#include "polys/clapconv.h"
#include "simpleideals.h"
#include "polys/ext_fields/transext.h"

Go to the source code of this file.

Macros

#define TRANSEXT_PRIVATES
 
#define MIN_CONV_LEN   7
 

Functions

void out_cf (const char *s1, const CanonicalForm &f, const char *s2)
 
static void conv_RecPP (const CanonicalForm &f, int *exp, sBucket_pt result, ring r)
 
static void convRecTrP (const CanonicalForm &f, int *exp, poly &result, int offs, const ring r)
 
static number convFactoryNSingAN (const CanonicalForm &f, const ring r)
 
poly convFactoryPSingP (const CanonicalForm &f, const ring r)
 
static void convPhalf (poly p, int l, poly &p1, poly &p2)
 
static poly convPunhalf (poly p1, poly p2)
 
static CanonicalForm convSingPFactoryP_intern (poly p, int l, BOOLEAN &setChar, const ring r)
 
CanonicalForm convSingPFactoryP (poly p, const ring r)
 
int convFactoryISingI (const CanonicalForm &f)
 
CanonicalForm convSingAPFactoryAP (poly p, const Variable &a, const ring r)
 
static void convRecAP_R (const CanonicalForm &f, int *exp, poly &result, int par_start, int var_start, const ring r)
 
poly convFactoryAPSingAP_R (const CanonicalForm &f, int par_start, int var_start, const ring r)
 
poly convFactoryAPSingAP (const CanonicalForm &f, const ring r)
 
CanonicalForm convSingAFactoryA (poly p, const Variable &a, const ring r)
 
poly convFactoryASingA (const CanonicalForm &f, const ring r)
 
CanonicalForm convSingTrPFactoryP (poly p, const ring r)
 
BOOLEAN convSingTrP (poly p, const ring r)
 
poly convFactoryPSingTrP (const CanonicalForm &f, const ring r)
 

Macro Definition Documentation

◆ MIN_CONV_LEN

#define MIN_CONV_LEN   7

Definition at line 103 of file clapconv.cc.

◆ TRANSEXT_PRIVATES

#define TRANSEXT_PRIVATES

Definition at line 27 of file clapconv.cc.

Function Documentation

◆ conv_RecPP()

static void conv_RecPP ( const CanonicalForm & f,
int * exp,
sBucket_pt result,
ring r )
static

Definition at line 54 of file clapconv.cc.

55{
56 // assume f!=0
57 if (LIKELY(! f.inCoeffDomain()))
58 {
59 int l = f.level();
60 for ( CFIterator i = f; i.hasTerms(); i++ )
61 {
62 exp[l] = i.exp();
63 conv_RecPP( i.coeff(), exp, result, r );
64 }
65 exp[l] = 0;
66 }
67 else
68 {
69 coeffs cf=r->cf;
70 number n=cf->convFactoryNSingN(f, cf);
71 if (UNLIKELY( n_IsZero(n, cf) ))
72 {
73 n_Delete(&n,cf);
74 }
75 else
76 {
77 poly term = p_Init(r);
78 //pNext( term ) = NULL; // done by p_Init
79 pGetCoeff(term)=n;
82 }
83 }
84}
#define UNLIKELY(X)
Definition auxiliary.h:405
#define LIKELY(X)
Definition auxiliary.h:404
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
CanonicalForm cf
Definition cfModGcd.cc:4091
FILE * f
Definition checklibs.c:9
static void conv_RecPP(const CanonicalForm &f, int *exp, sBucket_pt result, ring r)
Definition clapconv.cc:54
class to iterate through CanonicalForm's
Definition cf_iter.h:44
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
return result
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
gmp_float exp(const gmp_float &a)
The main handler for Singular numbers which are suitable for Singular polynomials.
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1560
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1336
void sBucket_Merge_m(sBucket_pt bucket, poly p)
Definition sbuckets.cc:127

◆ convFactoryAPSingAP()

poly convFactoryAPSingAP ( const CanonicalForm & f,
const ring r )

Definition at line 207 of file clapconv.cc.

208{
209 return convFactoryAPSingAP_R(f,0,rPar(r),r);
210}
poly convFactoryAPSingAP_R(const CanonicalForm &f, int par_start, int var_start, const ring r)
Definition clapconv.cc:196
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:605

◆ convFactoryAPSingAP_R()

poly convFactoryAPSingAP_R ( const CanonicalForm & f,
int par_start,
int var_start,
const ring r )

Definition at line 196 of file clapconv.cc.

197{
198 if (f.isZero()) return NULL;
199 int n = rVar(r)+rPar(r)+1;
200 int * exp = (int *)omAlloc0(n*sizeof(int));
201 poly result = NULL;
202 convRecAP_R( f, exp, result,par_start, var_start, r );
203 omFreeSize((ADDRESS)exp,n*sizeof(int));
204 return result;
205}
void * ADDRESS
Definition auxiliary.h:120
static void convRecAP_R(const CanonicalForm &f, int *exp, poly &result, int par_start, int var_start, const ring r)
Definition clapconv.cc:212
#define omFreeSize(addr, size)
#define omAlloc0(size)
#define NULL
Definition omList.c:12
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598

◆ convFactoryASingA()

poly convFactoryASingA ( const CanonicalForm & f,
const ring r )

Definition at line 307 of file clapconv.cc.

308{
309 poly a=NULL;
310 for( CFIterator i=f; i.hasTerms(); i++)
311 {
312 number n= convFactoryNSingAN( i.coeff(), r );
313 if (n_IsZero(n,r->cf->extRing->cf))
314 {
315 n_Delete(&n,r->cf->extRing->cf);
316 }
317 else
318 {
319 poly t= p_Init (r->cf->extRing);
320 pGetCoeff(t)=n;
321 p_SetExp(t,1,i.exp(),r->cf->extRing);
322 //p_Setm(t,r->cf->extRing);// not needed for rings with 1 variable
323 a=p_Add_q(a,t,r->cf->extRing);
324 }
325 }
326 if (a!=NULL)
327 {
328 if( r->cf->extRing != NULL )
329 if (r->cf->extRing->qideal->m[0]!=NULL)
330 {
331 poly l=r->cf->extRing->qideal->m[0];
332 if (p_GetExp(a,1,r->cf->extRing) >= p_GetExp(l,1,r->cf->extRing))
333 a = p_PolyDiv (a, l, FALSE, r->cf->extRing); // ???
334 }
335 }
336 return a;
337}
#define FALSE
Definition auxiliary.h:97
static number convFactoryNSingAN(const CanonicalForm &f, const ring r)
Definition clapconv.cc:298
poly p_PolyDiv(poly &p, const poly divisor, const BOOLEAN needResult, const ring r)
assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes div...
Definition p_polys.cc:1874
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
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

◆ convFactoryISingI()

int convFactoryISingI ( const CanonicalForm & f)

Definition at line 165 of file clapconv.cc.

166{
167 if (!f.isImm()) WerrorS("int overflow in det");
168 return f.intval();
169}
void WerrorS(const char *s)
Definition feFopen.cc:24

◆ convFactoryNSingAN()

static number convFactoryNSingAN ( const CanonicalForm & f,
const ring r )
static

Definition at line 298 of file clapconv.cc.

299{
300 assume (r != NULL);
301 assume (r->cf != NULL);
302 assume (r->cf->extRing != NULL);
303 // r->cf->extRing->cf has to be Q or Z/p (the supported types of factory)
304 return n_convFactoryNSingN( f, r->cf->extRing->cf );
305}
static FORCE_INLINE number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition coeffs.h:975
#define assume(x)
Definition mod2.h:389

◆ convFactoryPSingP()

poly convFactoryPSingP ( const CanonicalForm & f,
const ring r )

Definition at line 40 of file clapconv.cc.

41{
42 if (f.isZero()) return NULL;
43 int n = rVar(r)+1;
44 /* ASSERT( level( f ) <= pVariables, "illegal number of variables" ); */
45 int * exp = (int*)omAlloc0(n*sizeof(int));
46 sBucket_pt result_bucket=sBucketCreate(r);
47 conv_RecPP( f, exp, result_bucket, r );
48 poly result; int dummy;
49 sBucketDestroyMerge(result_bucket,&result,&dummy);
50 omFreeSize((ADDRESS)exp,n*sizeof(int));
51 return result;
52}
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
sBucket * sBucket_pt
Definition sbuckets.h:16
void sBucketDestroyMerge(sBucket_pt bucket, poly *p, int *length)
Definition sbuckets.h:61

◆ convFactoryPSingTrP()

poly convFactoryPSingTrP ( const CanonicalForm & f,
const ring r )

Definition at line 389 of file clapconv.cc.

390{
391 if (f.isZero()) return NULL;
392 int n = rVar(r)+1;
393 int * exp = (int*)omAlloc0(n*sizeof(int));
394 poly result = NULL;
395 convRecTrP( f, exp, result , rPar(r), r );
396 omFreeSize((ADDRESS)exp,n*sizeof(int));
397 return result;
398}
static void convRecTrP(const CanonicalForm &f, int *exp, poly &result, int offs, const ring r)
Definition clapconv.cc:401

◆ convPhalf()

static void convPhalf ( poly p,
int l,
poly & p1,
poly & p2 )
inlinestatic

Definition at line 86 of file clapconv.cc.

87{
88 p1=p;
89 l=l/2;
90 while(l>1) { p=pNext(p); l--; }
91 p2=pNext(p);
92 pNext(p)=NULL;
93}
int p
Definition cfModGcd.cc:4086
#define pNext(p)
Definition monomials.h:36

◆ convPunhalf()

static poly convPunhalf ( poly p1,
poly p2 )
inlinestatic

Definition at line 95 of file clapconv.cc.

96{
97 poly p=p1;
98 while(pNext(p1)!=NULL) { p1=pNext(p1);}
99 pNext(p1)=p2;
100 return p;
101}

◆ convRecAP_R()

static void convRecAP_R ( const CanonicalForm & f,
int * exp,
poly & result,
int par_start,
int var_start,
const ring r )
static

Definition at line 212 of file clapconv.cc.

213{
214 // assume f!=0
215 if ( ! f.inCoeffDomain() )
216 {
217 int l = f.level();
218 for ( CFIterator i = f; i.hasTerms(); i++ )
219 {
220 exp[l] = i.exp();
221 convRecAP_R( i.coeff(), exp, result, par_start, var_start, r);
222 }
223 exp[l] = 0;
224 }
225 else
226 {
227 poly z=(poly)convFactoryASingA( f,r );
228 if (z!=NULL)
229 {
230 poly term = p_Init(r);
231 //pNext( term ) = NULL; // done by p_Init
232 int i;
233 for ( i = rVar(r); i>0 ; i-- )
234 p_SetExp( term, i , exp[i+var_start],r);
235 //if (rRing_has_Comp(currRing->extRing)) p_SetComp(term, 0, currRing->extRing); // done by pInit
236 if (par_start==0)
237 {
238 for ( i = 1; i <= var_start; i++ )
239 //z->e[i-1]+=exp[i];
240 p_AddExp(z,i,exp[i],r->cf->extRing);
241 }
242 else
243 {
244 for ( i = par_start+1; i <= var_start+rPar(r); i++ )
245 //z->e[i-1]+=exp[i];
246 p_AddExp(z,i,exp[i-par_start],r->cf->extRing);
247 }
248 p_GetCoeff(term, r->cf->extRing)=(number) z;
249 p_Setm( term,r );
250 result = p_Add_q( result, term, r );
251 }
252 }
253}
poly convFactoryASingA(const CanonicalForm &f, const ring r)
Definition clapconv.cc:307
#define p_GetCoeff(p, r)
Definition monomials.h:50
static long p_AddExp(poly p, int v, long ee, ring r)
Definition p_polys.h:608
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235

◆ convRecTrP()

static void convRecTrP ( const CanonicalForm & f,
int * exp,
poly & result,
int offs,
const ring r )
static

Definition at line 401 of file clapconv.cc.

402{
403 // assume f!= 0
404 if ( f.level() > offs )
405 {
406 int l = f.level();
407 for ( CFIterator i = f; i.hasTerms(); i++ )
408 {
409 exp[l-offs] = i.exp();
410 convRecTrP( i.coeff(), exp, result, offs, r );
411 }
412 exp[l-offs] = 0;
413 }
414 else
415 {
416 poly term = p_Init(r);
417 //pNext( term ) = NULL; // done by p_Init
418 for ( int i = rVar(r); i>0; i-- )
419 p_SetExp( term, i ,exp[i], r);
420 //if (rRing_has_Comp(currRing)) p_SetComp(term, 0, currRing); // done by pInit
421 pGetCoeff(term)=ntInit(convFactoryPSingP( f, r->cf->extRing ), r->cf);
422 p_Setm( term,r );
423 result = p_Add_q( result, term,r );
424 }
425}
poly convFactoryPSingP(const CanonicalForm &f, const ring r)
Definition clapconv.cc:40
number ntInit(long i, const coeffs cf)
Definition transext.cc:704

◆ convSingAFactoryA()

CanonicalForm convSingAFactoryA ( poly p,
const Variable & a,
const ring r )

Definition at line 255 of file clapconv.cc.

256{
258 int e;
259
260 while ( p!=NULL )
261 {
263 if ( rField_is_Zp_a(r) )
264 {
265 term = n_Int( p_GetCoeff( p, r->cf->extRing ), r->cf->extRing->cf );
266 }
267 else
268 {
269 if ( SR_HDL(p_GetCoeff( p, r->cf->extRing )) & SR_INT )
270 term = SR_TO_INT(p_GetCoeff( p, r->cf->extRing )) ;
271 else
272 {
273 if ( p_GetCoeff( p, r->cf->extRing )->s == 3 )
274 {
275 mpz_t dummy;
276 mpz_init_set( dummy, (p_GetCoeff( p,r->cf->extRing )->z) );
277 term = make_cf( dummy );
278 }
279 else
280 {
281 // assume s==0 or s==1
282 mpz_t num, den;
284 mpz_init_set( num, (p_GetCoeff( p, r->cf->extRing )->z) );
285 mpz_init_set( den, (p_GetCoeff( p, r->cf->extRing )->n) );
286 term = make_cf( num, den, ( p_GetCoeff( p, r->cf->extRing )->s != 1 ));
287 }
288 }
289 }
290 if ( (e = p_GetExp( p, 1, r->cf->extRing )) != 0 )
291 term *= power( a , e );
292 result += term;
293 p = pNext( p );
294 }
295 return result;
296}
void On(int sw)
switches
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
CanonicalForm num(const CanonicalForm &f)
CanonicalForm den(const CanonicalForm &f)
static const int SW_RATIONAL
set to 1 for computations over Q
Definition cf_defs.h:31
factory's main class
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:548
CanonicalForm FACTORY_PUBLIC make_cf(const mpz_ptr n)
Definition singext.cc:66
#define SR_INT
Definition longrat.h:67
#define SR_TO_INT(SR)
Definition longrat.h:69
static BOOLEAN rField_is_Zp_a(const ring r)
Definition ring.h:535
#define SR_HDL(A)
Definition tgb.cc:35

◆ convSingAPFactoryAP()

CanonicalForm convSingAPFactoryAP ( poly p,
const Variable & a,
const ring r )

Definition at line 171 of file clapconv.cc.

172{
174 int e, n = r-> N;
175 int off=rPar(r);
176
177 if (!rField_is_Zp_a(r))
179 while ( p!=NULL)
180 {
181 CanonicalForm term=convSingAFactoryA(((poly)p_GetCoeff(p, r->cf->extRing)),a, r);
182 for ( int i = 1; i <= n; i++ )
183 {
184 if ( (e = p_GetExp( p, i, r )) != 0 )
185 term *= CanonicalForm( Variable( i + off), e );
186 }
187 result += term;
188 pIter( p );
189 }
190 return result;
191}
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
CanonicalForm convSingAFactoryA(poly p, const Variable &a, const ring r)
Definition clapconv.cc:255
factory's class for variables
Definition factory.h:127
#define pIter(p)
Definition monomials.h:37

◆ convSingPFactoryP()

CanonicalForm convSingPFactoryP ( poly p,
const ring r )

Definition at line 138 of file clapconv.cc.

139{
140 if (rVar(r)>1)
141 {
142 BOOLEAN setChar=TRUE;
143 return convSingPFactoryP_intern(p,pLength(p),setChar,r);
144 }
145 else
146 {
148 BOOLEAN setChar=TRUE;
149 coeffs cf=r->cf;
150 int e;
151 while ( p!=NULL )
152 {
153 CanonicalForm term=cf->convSingNFactoryN(pGetCoeff( p ),setChar, cf);
154 if (errorreported) break;
155 setChar=FALSE;
156 if (LIKELY( (e = p_GetExp( p, 1, r)) != 0 ))
157 term *= CanonicalForm( Variable( 1 ), e );
158 result += term;
159 pIter( p );
160 }
161 return result;
162 }
163}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
static CanonicalForm convSingPFactoryP_intern(poly p, int l, BOOLEAN &setChar, const ring r)
Definition clapconv.cc:104
VAR short errorreported
Definition feFopen.cc:23
static int pLength(poly a)
Definition p_polys.h:190

◆ convSingPFactoryP_intern()

static CanonicalForm convSingPFactoryP_intern ( poly p,
int l,
BOOLEAN & setChar,
const ring r )
static

Definition at line 104 of file clapconv.cc.

105{
107 int e, n = rVar(r);
108 assume(l==(int)pLength(p));
109
110 if (l>MIN_CONV_LEN)
111 {
112 poly p1,p2;
113 convPhalf(p,l,p1,p2);
114 CanonicalForm P=convSingPFactoryP_intern(p1,l/2,setChar,r);
115 P+=convSingPFactoryP_intern(p2,l-l/2,setChar,r);
116 convPunhalf(p1,p2);
117 return P;
118 }
119 BOOLEAN setChar_loc=setChar;
120 setChar=FALSE;
121 coeffs cf=r->cf;
122 while ( p!=NULL )
123 {
124 CanonicalForm term=cf->convSingNFactoryN(pGetCoeff( p ),setChar_loc, cf);
125 if (errorreported) break;
126 setChar_loc=FALSE;
127 for ( int i = 1; i <=n; i++ )
128 {
129 if (LIKELY( (e = p_GetExp( p, i, r)) != 0 ))
130 term *= CanonicalForm( Variable( i ), e );
131 }
132 result += term;
133 pIter( p );
134 }
135 return result;
136}
static void convPhalf(poly p, int l, poly &p1, poly &p2)
Definition clapconv.cc:86
#define MIN_CONV_LEN
Definition clapconv.cc:103
static poly convPunhalf(poly p1, poly p2)
Definition clapconv.cc:95

◆ convSingTrP()

BOOLEAN convSingTrP ( poly p,
const ring r )

Definition at line 375 of file clapconv.cc.

376{
377 while ( p!=NULL )
378 {
379 n_Normalize(p_GetCoeff(p, r), r->cf);
380
381 // test if denominator is constant
382 if (!p_IsConstant(DEN ((fraction)p_GetCoeff (p,r)),r->cf->extRing))
383 return FALSE;
384 pIter(p);
385 }
386 return TRUE;
387}
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition coeffs.h:579
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition p_polys.h:1980

◆ convSingTrPFactoryP()

CanonicalForm convSingTrPFactoryP ( poly p,
const ring r )

Definition at line 339 of file clapconv.cc.

340{
342 int e, n = rVar(r);
343 int offs = rPar(r);
344
345 while ( p!=NULL )
346 {
347 //n_Normalize(p_GetCoeff(p, r), r->cf);
348
349 // test if denominator is constant
350 if (!errorreported && !p_IsConstant(DEN ((fraction)p_GetCoeff (p,r)),r->cf->extRing))
351 WerrorS("conversion error: denominator!= 1");
352
353 CanonicalForm term=convSingPFactoryP(NUM ((fraction)p_GetCoeff(p, r)),r->cf->extRing);
354
355 // if denominator is not NULL it should be a constant at this point
356 if (DEN ((fraction)p_GetCoeff(p,r)) != NULL)
357 {
358 CanonicalForm den= convSingPFactoryP(DEN ((fraction)p_GetCoeff(p, r)),r->cf->extRing);
359 if (rChar (r) == 0)
360 On (SW_RATIONAL);
361 term /= den;
362 }
363
364 for ( int i = n; i > 0; i-- )
365 {
366 if ( (e = p_GetExp( p, i,r )) != 0 )
367 term = term * power( Variable( i + offs ), e );
368 }
369 result += term;
370 p = pNext( p );
371 }
372 return result;
373}
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition clapconv.cc:138
#define NUM
Definition readcf.cc:180
int rChar(ring r)
Definition ring.cc:718

◆ out_cf()

void out_cf ( const char * s1,
const CanonicalForm & f,
const char * s2 )

Definition at line 103 of file cf_factor.cc.

104{
105 printf("%s",s1);
106 if (f.isZero()) printf("+0");
107 //else if (! f.inCoeffDomain() )
108 else if (! f.inBaseDomain() )
109 {
110 int l = f.level();
111 for ( CFIterator i = f; i.hasTerms(); i++ )
112 {
113 int e=i.exp();
114 if (i.coeff().isOne())
115 {
116 printf("+");
117 if (e==0) printf("1");
118 else
119 {
120 printf("%c",'a'+l-1);
121 if (e!=1) printf("^%d",e);
122 }
123 }
124 else
125 {
126 out_cf("+(",i.coeff(),")");
127 if (e!=0)
128 {
129 printf("*%c",'a'+l-1);
130 if (e!=1) printf("^%d",e);
131 }
132 }
133 }
134 }
135 else
136 {
137 if ( f.isImm() )
138 {
140 {
141 long a= imm2int (f.getval());
142 if ( a == gf_q )
143 printf ("+%ld", a);
144 else if ( a == 0L )
145 printf ("+1");
146 else if ( a == 1L )
147 printf ("+%c",gf_name);
148 else
149 {
150 printf ("+%c",gf_name);
151 printf ("^%ld",a);
152 }
153 }
154 else
155 {
156 long l=f.intval();
157 if (l<0) printf("%ld",l);
158 else printf("+%ld",l);
159 }
160 }
161 else
162 {
163 #ifdef NOSTREAMIO
164 if (f.inZ())
165 {
166 mpz_t m;
168 char * str = new char[mpz_sizeinbase( m, 10 ) + 2];
169 str = mpz_get_str( str, 10, m );
170 puts(str);
171 delete[] str;
172 mpz_clear(m);
173 }
174 else if (f.inQ())
175 {
176 mpz_t m;
178 char * str = new char[mpz_sizeinbase( m, 10 ) + 2];
179 str = mpz_get_str( str, 10, m );
180 while(str[strlen(str)]<' ') { str[strlen(str)]='\0'; }
181 puts(str);putchar('/');
182 delete[] str;
183 mpz_clear(m);
185 str = new char[mpz_sizeinbase( m, 10 ) + 2];
186 str = mpz_get_str( str, 10, m );
187 while(str[strlen(str)]<' ') { str[strlen(str)]='\0'; }
188 puts(str);
189 delete[] str;
190 mpz_clear(m);
191 }
192 #else
193 std::cout << f;
194 #endif
195 }
196 //if (f.inZ()) printf("(Z)");
197 //else if (f.inQ()) printf("(Q)");
198 //else if (f.inFF()) printf("(FF)");
199 //else if (f.inPP()) printf("(PP)");
200 //else if (f.inGF()) printf("(PP)");
201 //else
202 if (f.inExtension()) printf("E(%d)",f.level());
203 }
204 printf("%s",s2);
205}
int m
Definition cfEzgcd.cc:128
#define GaloisFieldDomain
Definition cf_defs.h:18
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
Definition cf_factor.cc:103
static int gettype()
Definition cf_factory.h:28
void FACTORY_PUBLIC gmp_numerator(const CanonicalForm &f, mpz_ptr result)
Definition singext.cc:20
void FACTORY_PUBLIC gmp_denominator(const CanonicalForm &f, mpz_ptr result)
Definition singext.cc:40
VAR int gf_q
Definition gfops.cc:47
VAR char gf_name
Definition gfops.cc:52
static long imm2int(const InternalCF *const imm)
Definition imm.h:70
char * str(leftv arg)
Definition shared.cc:699