My Project
Loading...
Searching...
No Matches
clapconv.h File Reference

Go to the source code of this file.

Functions

poly convFactoryPSingP (const CanonicalForm &f, 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)
 
poly convFactoryAPSingAP (const CanonicalForm &f, const ring r)
 
poly convFactoryAPSingAP_R (const CanonicalForm &f, int par_start, int var_start)
 
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)
 

Function Documentation

◆ 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}
FILE * f
Definition checklibs.c:9
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 )

◆ 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
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
static number convFactoryNSingAN(const CanonicalForm &f, const ring r)
Definition clapconv.cc:298
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
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
#define NULL
Definition omList.c:12
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
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1336

◆ 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

◆ 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}
void * ADDRESS
Definition auxiliary.h:120
static void conv_RecPP(const CanonicalForm &f, int *exp, sBucket_pt result, ring r)
Definition clapconv.cc:54
return result
gmp_float exp(const gmp_float &a)
#define omFreeSize(addr, size)
#define omAlloc0(size)
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
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

◆ 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)
int p
Definition cfModGcd.cc:4086
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
#define pNext(p)
Definition monomials.h:36
#define p_GetCoeff(p, r)
Definition monomials.h:50
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
#define LIKELY(X)
Definition auxiliary.h:404
CanonicalForm cf
Definition cfModGcd.cc:4091
static CanonicalForm convSingPFactoryP_intern(poly p, int l, BOOLEAN &setChar, const ring r)
Definition clapconv.cc:104
VAR short errorreported
Definition feFopen.cc:23
The main handler for Singular numbers which are suitable for Singular polynomials.
static int pLength(poly a)
Definition p_polys.h:190

◆ 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