Changeset 83a1714 in git
- Timestamp:
- Sep 29, 2011, 6:29:37 PM (12 years ago)
- Branches:
- (u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
- 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
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/maps_ip.cc
rbebd746 r83a1714 32 32 33 33 /* debug output: Tok2Cmdname in maApplyFetch*/ 34 //#include "ipshell.h"34 #include "ipshell.h" 35 35 36 36 // define this if you want to use the fast_map routine for mapping ideals … … 55 55 int i; 56 56 int N = preimage_r->N; 57 //Print("N=%d what=%s ",N,Tok2Cmdname(what)); 58 //if (perm!=NULL) for(i=1;i<=N;i++) Print("%d -> %d ",i,perm[i]); 59 //PrintS("\n"); 60 //Print("P=%d ",P); 61 //if (par_perm!=NULL) for(i=0;i<P;i++) Print("%d -> %d ",i,par_perm[i]); 62 //PrintS("\n"); 57 #if 0 58 Print("N=%d what=%s ",N,Tok2Cmdname(what)); 59 if (perm!=NULL) for(i=1;i<=N;i++) Print("%d -> %d ",i,perm[i]); 60 PrintS("\n"); 61 Print("P=%d ",P); 62 if (par_perm!=NULL) for(i=0;i<P;i++) Print("%d -> %d ",i,par_perm[i]); 63 PrintS("\n"); 64 #endif 65 63 66 void *data=w->Data(); 64 67 res->rtyp = w->rtyp; … … 68 71 if (P!=0) 69 72 { 70 WerrorS("Sorry 'napPermNumber' was lost in the refactoring process (due to Frank): needs to be fixed"); 71 return TRUE; 72 #if 0 73 res->data=(void *)napPermNumber((number)data,par_perm,P, preimage_r); 73 // WerrorS("Sorry 'napPermNumber' was lost in the refactoring process (due to Frank): needs to be fixed"); 74 // return TRUE; 75 #if 1 76 // poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst); 77 res->data= (void *) n_PermNumber((number)data, par_perm, P, preimage_r, currRing); 74 78 #endif 75 79 res->rtyp=POLY_CMD; … … 80 84 else 81 85 { 82 res->data=(void *)nMap((number)data, preimage_r->cf, currRing->cf); 86 assume( nMap != NULL ); 87 88 number a = nMap((number)data, preimage_r->cf, currRing->cf); 89 90 83 91 if (nCoeff_is_Extension(currRing->cf)) 84 92 { 85 number a=(number)res->data; 86 number one=nInit(1); 87 number product = nMult(a,one ); 93 n_Normalize(a, currRing->cf); // ??? 94 /* 95 number a = (number)res->data; 96 number one = nInit(1); 97 number product = nMult(a, one ); 88 98 nDelete(&one); 89 99 nDelete(&a); 90 100 res->data=(void *)product; 101 */ 91 102 } 92 103 #ifdef LDEBUG 93 n Test((number) res->data);104 n_Test(a, currRing->cf); 94 105 #endif 106 res->data=(void *)a; 107 95 108 } 96 109 break; … … 101 114 else 102 115 if ((what==IMAP_CMD) || ((what==FETCH_CMD) /* && (nMap!=nCopy)*/)) 103 res->data=(void *)p_PermPoly((poly)data,perm,preimage_r,currRing, 104 nMap,par_perm,P); 116 res->data=(void *)p_PermPoly((poly)data,perm,preimage_r,currRing, nMap,par_perm,P); 105 117 else /*if (what==MAP_CMD)*/ 106 118 { -
Tst/New/longalg_missing_2.tst
rbebd746 r83a1714 5 5 6 6 SNB; 7 poly f = x4-2*x+1; 8 f; 7 poly f = x4-2*x+1; f; 8 9 poly ff = 3*a-7; ff; 10 11 poly gg = 11*a; gg; 12 13 poly g = a*f + f + a; g; 9 14 10 15 ring SNR = 0, (x, a), (lp, C); 16 17 option(Imap); 18 11 19 imap(SNB, f);// 20 fetch(SNB, f);// 21 22 23 imap(SNB, ff);// ? 24 fetch(SNB, ff);// 25 26 27 imap(SNB, g);// 28 fetch(SNB, g);// 29 30 imap(SNB, gg);// 31 fetch(SNB, gg);// 12 32 13 33 tst_status(1);$ -
libpolys/polys/ext_fields/transext.cc
rbebd746 r83a1714 61 61 #define BOUND_COMPLEXITY 10 /**< maximum complexity of a number */ 62 62 63 /* some useful accessors for fractions: */ 64 #define IS0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */ 65 66 #define DENIS1(f) (f->denominator == NULL) /**< TRUE iff den. represents 1 */ 67 #define NUMIS1(f) (p_IsConstant(f->numerator, cf->extRing) && \ 68 n_IsOne(p_GetCoeff(f->numerator, cf->extRing), \ 63 #define NUMIS1(f) (p_IsConstant(NUM(f), cf->extRing) && \ 64 n_IsOne(p_GetCoeff(NUM(f), cf->extRing), \ 69 65 cf->extRing->cf)) 70 66 /**< TRUE iff num. represents 1 */ -
libpolys/polys/ext_fields/transext.h
rbebd746 r83a1714 77 77 #define DEN(f) (((fraction)f)->denominator) 78 78 79 /* some useful accessors for fractions: */ 80 #define IS0(f) (f == NULL) 81 /**< TRUE iff n represents 0 in K(t_1, .., t_s) */ 82 83 #define DENIS1(f) (DEN(f) == NULL) 84 /**< TRUE iff den. represents 1 */ 85 86 79 87 number ntInit(poly p, const coeffs cf); 80 88 -
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.