Changeset 83a1714 in git


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

Legend:

Unmodified
Added
Removed
  • Singular/maps_ip.cc

    rbebd746 r83a1714  
    3232
    3333/* debug output: Tok2Cmdname in maApplyFetch*/
    34 //#include "ipshell.h"
     34#include "ipshell.h"
    3535
    3636// define this if you want to use the fast_map routine for mapping ideals
     
    5555  int i;
    5656  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
    6366  void *data=w->Data();
    6467  res->rtyp = w->rtyp;
     
    6871      if (P!=0)
    6972      {
    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);
    7478#endif
    7579        res->rtyp=POLY_CMD;
     
    8084      else
    8185      {
    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 
    8391        if (nCoeff_is_Extension(currRing->cf))
    8492        {
    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 );
    8898          nDelete(&one);
    8999          nDelete(&a);
    90100          res->data=(void *)product;
     101 */
    91102        }
    92103        #ifdef LDEBUG
    93         nTest((number) res->data);
     104        n_Test(a, currRing->cf);
    94105        #endif
     106        res->data=(void *)a;
     107
    95108      }
    96109      break;
     
    101114      else
    102115      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);
    105117      else /*if (what==MAP_CMD)*/
    106118      {
  • Tst/New/longalg_missing_2.tst

    rbebd746 r83a1714  
    55
    66SNB;
    7 poly f = x4-2*x+1;
    8 f;
     7poly f = x4-2*x+1; f;
     8
     9poly ff = 3*a-7; ff;
     10
     11poly gg = 11*a; gg;
     12
     13poly g = a*f + f + a; g;
    914
    1015ring SNR = 0, (x, a), (lp, C);
     16
     17option(Imap);
     18
    1119imap(SNB, f);//
     20fetch(SNB, f);//
     21
     22
     23imap(SNB, ff);// ?
     24fetch(SNB, ff);//
     25
     26
     27imap(SNB, g);//
     28fetch(SNB, g);//
     29
     30imap(SNB, gg);//
     31fetch(SNB, gg);//
    1232
    1333tst_status(1);$
  • libpolys/polys/ext_fields/transext.cc

    rbebd746 r83a1714  
    6161#define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
    6262
    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), \
    6965                           cf->extRing->cf))
    7066                   /**< TRUE iff num. represents 1 */
  • libpolys/polys/ext_fields/transext.h

    rbebd746 r83a1714  
    7777#define DEN(f) (((fraction)f)->denominator)
    7878
     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
    7987number ntInit(poly p, const coeffs cf);
    8088
  • 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}
  • libpolys/polys/monomials/p_polys.h

    rbebd746 r83a1714  
    19101910poly p_JetW(poly p, int m, short *w, const ring R);
    19111911
    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);
     1912poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst);
     1913
     1914poly p_PermPoly (poly p, const int * perm,const ring OldRing, const ring dst,
     1915                     nMapFunc nMap, const int *par_perm=NULL, int OldPar=0);
    19151916
    19161917/*----------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.