Ignore:
Timestamp:
Sep 29, 2011, 6:29:37 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
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
Message:
FIX: started fixing fetch & imap for transcendental/alg. extensions: "longalg missing 2"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    rbebd746 r83a1714  
    33023302  return res;
    33033303}
     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 */
     3310poly 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
    33043392/*2
    33053393*returns a re-ordered copy of a polynomial, with permutation of the variables
    33063394*/
    3307 poly p_PermPoly (poly p, int * perm, const ring oldRing, const ring dst,
    3308        nMapFunc nMap, int *par_perm, int OldPar)
    3309 {
     3395poly 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 
    33103403  const int OldpVariables = rVar(oldRing);
    33113404  poly result = NULL;
    33123405  poly result_last = NULL;
    3313   poly aq=NULL; /* the map coefficient */
     3406  poly aq = NULL; /* the map coefficient */
    33143407  poly qq; /* the mapped monomial */
    33153408
     
    33173410  {
    33183411    // map the coefficient
    3319     if ((OldPar==0) || (rField_is_GF(oldRing)))
     3412    if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing)) && (nMap != NULL) )
    33203413    {
    33213414      qq = p_Init(dst);
     3415      assume( nMap != NULL );
    33223416      number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
    33233417       
     
    33313425    else
    33323426    {
    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);
    33403434       
    33413435      if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) )
     
    33433437        p_Normalize(aq,dst);
    33443438         
    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         
    33483443      p_Test(aq, dst);
    33493444    }
     
    33893484              const int par = -perm[i];
    33903485              assume( par > 0 );
     3486
    33913487//              WarnS("longalg missing 3");
    33923488#if 1
     
    34483544    }
    34493545    pIter(p);
     3546     
     3547#if 0
     3548    p_Test(aq,dst);
     3549    PrintS("\naq: "); p_Write(aq, dst, dst); PrintLn();
     3550#endif
     3551     
    34503552
    34513553#if 1
     
    34533555    {
    34543556      p_Setm(qq,dst);
     3557       
    34553558      p_Test(aq,dst);
    34563559      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       
    34583569      aq = qq;
     3570       
    34593571      while (pNext(aq) != NULL) pIter(aq);
     3572       
    34603573      if (result_last==NULL)
    34613574      {
     
    34743587    }
    34753588  }
     3589   
    34763590  result=p_SortAdd(result,dst);
    34773591#else
     
    35043618#endif
    35053619  p_Test(result,dst);
     3620   
     3621#if 0
     3622  p_Test(result,dst);
     3623  PrintS("\nresult: "); p_Write(result,dst,dst); PrintLn();
     3624#endif
    35063625  return result;
    35073626}
Note: See TracChangeset for help on using the changeset viewer.