Changeset 83a1714 in git for libpolys/polys/monomials
- Timestamp:
- Sep 29, 2011, 6:29:37 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 172bbb269fb8ec8ad467f6d62ee5ea9c0151b3ba
- Parents:
- bebd746739b98e1580e2d7b75cf326c9350f2a7b
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-29 18:29:37+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:49+01:00
- Location:
- libpolys/polys/monomials
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/p_polys.cc
rbebd746 r83a1714 3302 3302 return res; 3303 3303 } 3304 3305 /*2 3306 * returns a re-ordered convertion of a number as a polynomial, 3307 * with permutation of parameters 3308 * NOTE: this only works for Frank's alg. & trans. fields 3309 */ 3310 poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst) 3311 { 3312 #if 0 3313 PrintS("\nSource Ring: \n"); 3314 rWrite(src); 3315 3316 if(0) 3317 { 3318 number zz = n_Copy(z, src->cf); 3319 PrintS("z: "); n_Write(zz, src->cf); 3320 n_Delete(&zz, src->cf); 3321 } 3322 3323 PrintS("\nDestination Ring: \n"); 3324 rWrite(dst); 3325 3326 Print("\nOldPar: %d\n", OldPar); 3327 for( int i = 1; i <= OldPar; i++ ) 3328 { 3329 Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]); 3330 } 3331 #endif 3332 if( z == NULL ) 3333 return NULL; 3334 3335 const coeffs srcCf = src->cf; 3336 assume( srcCf != NULL ); 3337 3338 assume( !nCoeff_is_GF(srcCf) ); 3339 assume( rField_is_Extension(src) ); 3340 3341 poly zz = NULL; 3342 3343 const ring srcExtRing = srcCf->extRing; 3344 assume( srcExtRing != NULL ); 3345 3346 const coeffs dstCf = dst->cf; 3347 assume( dstCf != NULL ); 3348 3349 if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)? 3350 { 3351 zz = (poly) z; 3352 3353 if( zz == NULL ) 3354 return NULL; 3355 3356 } else if (nCoeff_is_transExt(srcCf)) 3357 { 3358 assume( !IS0(z) ); 3359 3360 zz = NUM(z); 3361 p_Test (zz, srcExtRing); 3362 3363 if( zz == NULL ) 3364 return NULL; 3365 3366 if( !DENIS1(z) ) 3367 WarnS("Not implemented yet: Cannot permute a rational fraction and make a polynomial out of it! Ignorring the denumerator."); 3368 } else 3369 { 3370 assume (FALSE); 3371 Werror("Number permutation is not implemented for this data yet!"); 3372 return NULL; 3373 } 3374 3375 assume( zz != NULL ); 3376 p_Test (zz, srcExtRing); 3377 3378 3379 nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf); 3380 3381 assume( nMap != NULL ); 3382 3383 poly qq = p_PermPoly(zz, par_perm - 1, srcExtRing, dst, nMap, NULL, rVar(srcExtRing) ); 3384 // poly p_PermPoly (poly p, int * perm, const ring oldRing, const ring dst, nMapFunc nMap, int *par_perm, int OldPar) 3385 3386 // assume( FALSE ); WarnS("longalg missing 2"); 3387 3388 return qq; 3389 } 3390 3391 3304 3392 /*2 3305 3393 *returns a re-ordered copy of a polynomial, with permutation of the variables 3306 3394 */ 3307 poly p_PermPoly (poly p, int * perm, const ring oldRing, const ring dst, 3308 nMapFunc nMap, int *par_perm, int OldPar) 3309 { 3395 poly p_PermPoly (poly p, const int * perm, const ring oldRing, const ring dst, 3396 nMapFunc nMap, const int *par_perm, int OldPar) 3397 { 3398 #if 0 3399 p_Test(p, oldRing); 3400 PrintS("\np_PermPoly::p: "); p_Write(p, oldRing, oldRing); PrintLn(); 3401 #endif 3402 3310 3403 const int OldpVariables = rVar(oldRing); 3311 3404 poly result = NULL; 3312 3405 poly result_last = NULL; 3313 poly aq =NULL; /* the map coefficient */3406 poly aq = NULL; /* the map coefficient */ 3314 3407 poly qq; /* the mapped monomial */ 3315 3408 … … 3317 3410 { 3318 3411 // map the coefficient 3319 if ( (OldPar==0) || (rField_is_GF(oldRing)))3412 if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing)) && (nMap != NULL) ) 3320 3413 { 3321 3414 qq = p_Init(dst); 3415 assume( nMap != NULL ); 3322 3416 number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf); 3323 3417 … … 3331 3425 else 3332 3426 { 3333 qq =p_One(dst);3334 3335 assume( FALSE ); WerrorS("longalg missing 2"); 3336 3337 #if 0 3338 aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst??? 3339 #endif 3427 qq = p_One(dst); 3428 3429 // aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst??? 3430 // poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst) 3431 aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst); 3432 3433 p_Test(aq, dst); 3340 3434 3341 3435 if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) ) … … 3343 3437 p_Normalize(aq,dst); 3344 3438 3345 if (aq==NULL) 3346 p_SetCoeff(qq, n_Init(0,dst->cf),dst); 3347 } 3439 } 3440 if (aq == NULL) 3441 p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!! 3442 3348 3443 p_Test(aq, dst); 3349 3444 } … … 3389 3484 const int par = -perm[i]; 3390 3485 assume( par > 0 ); 3486 3391 3487 // WarnS("longalg missing 3"); 3392 3488 #if 1 … … 3448 3544 } 3449 3545 pIter(p); 3546 3547 #if 0 3548 p_Test(aq,dst); 3549 PrintS("\naq: "); p_Write(aq, dst, dst); PrintLn(); 3550 #endif 3551 3450 3552 3451 3553 #if 1 … … 3453 3555 { 3454 3556 p_Setm(qq,dst); 3557 3455 3558 p_Test(aq,dst); 3456 3559 p_Test(qq,dst); 3457 if (aq!=NULL) qq=p_Mult_q(aq,qq,dst); 3560 3561 #if 0 3562 p_Test(qq,dst); 3563 PrintS("\nqq: "); p_Write(qq, dst, dst); PrintLn(); 3564 #endif 3565 3566 if (aq!=NULL) 3567 qq=p_Mult_q(aq,qq,dst); 3568 3458 3569 aq = qq; 3570 3459 3571 while (pNext(aq) != NULL) pIter(aq); 3572 3460 3573 if (result_last==NULL) 3461 3574 { … … 3474 3587 } 3475 3588 } 3589 3476 3590 result=p_SortAdd(result,dst); 3477 3591 #else … … 3504 3618 #endif 3505 3619 p_Test(result,dst); 3620 3621 #if 0 3622 p_Test(result,dst); 3623 PrintS("\nresult: "); p_Write(result,dst,dst); PrintLn(); 3624 #endif 3506 3625 return result; 3507 3626 } -
libpolys/polys/monomials/p_polys.h
rbebd746 r83a1714 1910 1910 poly p_JetW(poly p, int m, short *w, const ring R); 1911 1911 1912 1913 poly p_PermPoly (poly p, int * perm,const ring OldRing, const ring dst, 1914 nMapFunc nMap, int *par_perm=NULL, int OldPar=0); 1912 poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst); 1913 1914 poly p_PermPoly (poly p, const int * perm,const ring OldRing, const ring dst, 1915 nMapFunc nMap, const int *par_perm=NULL, int OldPar=0); 1915 1916 1916 1917 /*----------------------------------------------------*/
Note: See TracChangeset
for help on using the changeset viewer.