Ignore:
Timestamp:
Sep 29, 2011, 1:12:57 AM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
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
Message:
FIX: p_PermPoly (longalg missing 3)
FIX: mappings between trans. exts.: cannot p_Copy - need prCopy!
File:
1 edited

Legend:

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

    r2c2d03a rb38d70  
    2121
    2222#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"
    2329
    2430#include "weight.h"
     
    32993305       nMapFunc nMap, int *par_perm, int OldPar)
    33003306{
    3301   int OldpVariables = oldRing->N;
     3307  const int OldpVariables = rVar(oldRing);
    33023308  poly result = NULL;
    33033309  poly result_last = NULL;
     
    33073313  while (p != NULL)
    33083314  {
    3309     if ((OldPar==0)||(rField_is_GF(oldRing)))
     3315    // map the coefficient
     3316    if ((OldPar==0) || (rField_is_GF(oldRing)))
    33103317    {
    33113318      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);
    33203327    }
    33213328    else
    33223329    {
    33233330      qq=p_One(dst);
    3324       WerrorS("longalg missing 2");
     3331       
     3332      assume( FALSE ); WerrorS("longalg missing 2");
     3333       
    33253334#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)) )
    33293339      {
    33303340        p_Normalize(aq,dst);
     3341         
    33313342        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) )
    33393352    {
    33403353      p_LmDelete(&qq,dst);
    3341     }
     3354      qq = NULL;
     3355    }     
    33423356    else
    33433357    {
    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)
    33503364        {
    33513365          if (perm==NULL)
    3352           {
    3353             p_SetExp(qq,i, e, dst);
    3354           }
     3366            p_SetExp(qq, i, e, dst);
    33553367          else if (perm[i]>0)
    33563368            p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
    33573369          else if (perm[i]<0)
    33583370          {
     3371            number c = p_GetCoeff(qq, dst);
    33593372            if (rField_is_GF(dst))
    33603373            {
    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);
    33653381              //nfDelete(c,dst);nfDelete(eee,dst);
    33663382              pSetCoeff0(qq,ee);
    33673383            }
    3368             else
     3384            else if (nCoeff_is_Extension(dst->cf))
    33693385            {
    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);
    33753409              else /* more difficult: we have really to multiply: */
    33763410              {
    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);
    33833425              }
     3426               
    33843427              mapped_to_par=1;
    33853428#endif
     
    33893432          {
    33903433            /* this variable maps to 0 !*/
    3391             p_LmDelete(&qq,dst);
     3434            p_LmDelete(&qq, dst);
    33923435            break;
    33933436          }
    33943437        }
    33953438      }
    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);
    34003442        n_Normalize(n,dst->cf);
    3401         pGetCoeff(qq)=n;
     3443        p_GetCoeff(qq, dst) = n;
    34023444      }
    34033445    }
    34043446    pIter(p);
     3447
    34053448#if 1
    34063449    if (qq!=NULL)
Note: See TracChangeset for help on using the changeset viewer.