Changeset b38d70 in git for libpolys/polys/monomials/p_polys.cc
- Timestamp:
- Sep 29, 2011, 1:12:57 AM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 5d18675b2ded38546a705f58d4e8b9d631357571
- Parents:
- 2c2d03af90dd3a99752957403d5f3d55ef9980d5
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-29 01:12:57+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:46+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/p_polys.cc
r2c2d03a rb38d70 21 21 22 22 #include <coeffs/longrat.h> // ??? 23 #include <coeffs/ffields.h> 24 25 #define TRANSEXT_PRIVATES 26 27 #include "ext_fields/transext.h" 28 #include "ext_fields/algext.h" 23 29 24 30 #include "weight.h" … … 3299 3305 nMapFunc nMap, int *par_perm, int OldPar) 3300 3306 { 3301 int OldpVariables = oldRing->N;3307 const int OldpVariables = rVar(oldRing); 3302 3308 poly result = NULL; 3303 3309 poly result_last = NULL; … … 3307 3313 while (p != NULL) 3308 3314 { 3309 if ((OldPar==0)||(rField_is_GF(oldRing))) 3315 // map the coefficient 3316 if ((OldPar==0) || (rField_is_GF(oldRing))) 3310 3317 { 3311 3318 qq = p_Init(dst); 3312 number n =nMap(pGetCoeff(p),oldRing->cf,dst->cf);3313 if ((!rMinpolyIsNULL(dst))3314 && ((rField_is_Zp_a(dst)) || (rField_is_Q_a(dst))))3315 {3316 n_Normalize(n,dst->cf);3317 }3318 pGetCoeff(qq)=n;3319 // coef may be zero: pTest(qq);3319 number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf); 3320 3321 if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) ) 3322 n_Normalize(n, dst->cf); 3323 3324 p_GetCoeff(qq, dst) = n; 3325 // coef may be zero: 3326 p_Test(qq, dst); 3320 3327 } 3321 3328 else 3322 3329 { 3323 3330 qq=p_One(dst); 3324 WerrorS("longalg missing 2"); 3331 3332 assume( FALSE ); WerrorS("longalg missing 2"); 3333 3325 3334 #if 0 3326 aq=naPermNumber(pGetCoeff(p),par_perm,OldPar, oldRing); 3327 if ((!rMinpolyIsNULL(dst)) 3328 && ((rField_is_Zp_a(dst)) || (rField_is_Q_a(dst)))) 3335 aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst??? 3336 #endif 3337 3338 if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) ) 3329 3339 { 3330 3340 p_Normalize(aq,dst); 3341 3331 3342 if (aq==NULL) 3332 p_SetCoeff(qq,n_Init(0,dst->cf),dst); 3333 } 3334 p_Test(aq,dst); 3335 #endif 3336 } 3337 if (rRing_has_Comp(dst)) p_SetComp(qq, p_GetComp(p,oldRing),dst); 3338 if (n_IsZero(pGetCoeff(qq),dst->cf)) 3343 p_SetCoeff(qq, n_Init(0,dst->cf),dst); 3344 } 3345 p_Test(aq, dst); 3346 } 3347 3348 if (rRing_has_Comp(dst)) 3349 p_SetComp(qq, p_GetComp(p, oldRing), dst); 3350 3351 if ( n_IsZero(pGetCoeff(qq), dst->cf) ) 3339 3352 { 3340 3353 p_LmDelete(&qq,dst); 3341 } 3354 qq = NULL; 3355 } 3342 3356 else 3343 3357 { 3344 int i;3345 int mapped_to_par =0;3346 for(i =1; i<=OldpVariables; i++)3347 { 3348 int e =p_GetExp(p,i,oldRing);3349 if (e !=0)3358 // map pars: 3359 int mapped_to_par = 0; 3360 for(int i = 1; i <= OldpVariables; i++) 3361 { 3362 int e = p_GetExp(p, i, oldRing); 3363 if (e != 0) 3350 3364 { 3351 3365 if (perm==NULL) 3352 { 3353 p_SetExp(qq,i, e, dst); 3354 } 3366 p_SetExp(qq, i, e, dst); 3355 3367 else if (perm[i]>0) 3356 3368 p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst); 3357 3369 else if (perm[i]<0) 3358 3370 { 3371 number c = p_GetCoeff(qq, dst); 3359 3372 if (rField_is_GF(dst)) 3360 3373 { 3361 number c=pGetCoeff(qq); 3362 number ee=(number)rGetVar(1, dst->cf->extRing); 3363 number eee;n_Power(ee,e,&eee,dst->cf); //nfDelete(ee,dst); 3364 ee=n_Mult(c,eee,dst->cf); 3374 assume( dst->cf->extRing == NULL ); 3375 number ee = nfPar(1, dst->cf); // NOTE: using nfPar is a BAD thing to do... 3376 3377 number eee; 3378 n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst); 3379 3380 ee = n_Mult(c, eee, dst->cf); 3365 3381 //nfDelete(c,dst);nfDelete(eee,dst); 3366 3382 pSetCoeff0(qq,ee); 3367 3383 } 3368 else 3384 else if (nCoeff_is_Extension(dst->cf)) 3369 3385 { 3370 WerrorS("longalg missing 3"); 3371 #if 0 3372 lnumber c=(lnumber)pGetCoeff(qq); 3373 if (c->z->next==NULL) 3374 p_AddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->extRing); 3386 const int par = -perm[i]; 3387 assume( par > 0 ); 3388 // WarnS("longalg missing 3"); 3389 #if 1 3390 const coeffs C = dst->cf; 3391 assume( C != NULL ); 3392 3393 const ring R = C->extRing; 3394 assume( R != NULL ); 3395 3396 assume( par <= rVar(R) ); 3397 3398 poly pcn; // = (number)c 3399 3400 assume( !n_IsZero(c, C) ); 3401 3402 if( nCoeff_is_algExt(C) ) 3403 pcn = (poly) c; 3404 else // nCoeff_is_transExt(C) 3405 pcn = NUM(c); 3406 3407 if (pNext(pcn) == NULL) // c->z 3408 p_AddExp(pcn, -perm[i], e, R); 3375 3409 else /* more difficult: we have really to multiply: */ 3376 3410 { 3377 lnumber mmc=(lnumber)naInit(1,dst); 3378 p_SetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->extRing); 3379 p_Setm(mmc->z,dst->extRing->cf); 3380 pGetCoeff(qq)=n_Mult((number)c,(number)mmc,dst->cf); 3381 n_Delete((number *)&c,dst->cf); 3382 n_Delete((number *)&mmc,dst->cf); 3411 poly mmc = p_ISet(1, R); 3412 p_SetExp(mmc, -perm[i], e, R); 3413 p_Setm(mmc, R); 3414 3415 number nnc; 3416 // convert back to a number: number nnc = mmc; 3417 if( nCoeff_is_algExt(C) ) 3418 nnc = (number) mmc; 3419 else // nCoeff_is_transExt(C) 3420 nnc = ntInit(mmc, C); 3421 3422 p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C); 3423 n_Delete((number *)&c, C); 3424 n_Delete((number *)&nnc, C); 3383 3425 } 3426 3384 3427 mapped_to_par=1; 3385 3428 #endif … … 3389 3432 { 3390 3433 /* this variable maps to 0 !*/ 3391 p_LmDelete(&qq, dst);3434 p_LmDelete(&qq, dst); 3392 3435 break; 3393 3436 } 3394 3437 } 3395 3438 } 3396 if (mapped_to_par 3397 && (!rMinpolyIsNULL(dst))) 3398 { 3399 number n=pGetCoeff(qq); 3439 if ( mapped_to_par && (!rMinpolyIsNULL(dst)) ) 3440 { 3441 number n = p_GetCoeff(qq, dst); 3400 3442 n_Normalize(n,dst->cf); 3401 p GetCoeff(qq)=n;3443 p_GetCoeff(qq, dst) = n; 3402 3444 } 3403 3445 } 3404 3446 pIter(p); 3447 3405 3448 #if 1 3406 3449 if (qq!=NULL)
Note: See TracChangeset
for help on using the changeset viewer.