Changeset c14846c in git


Ignore:
Timestamp:
Sep 27, 2011, 6:06:45 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
de7521eef6abc64c1312e46961fc93fb053d9bd5
Parents:
c7aad03a695808dc3f5aaaa108a93dbc905bf922
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-09-27 18:06:45+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:38+01:00
Message:
fix: n?SetMap should return ndCopyMap for equal coeffs
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/standard.lib

    rc7aad0 rc14846c  
    892892  if (charstr(basering)[1]=="i") // either integer or integer,q
    893893  {
    894     if (find(option(),"prot"))  { "calling std for ideals in ring with ring coefficients"; }
     894    if (find(s_opt, option()))  { "calling std for ideals in ring with ring coefficients"; }
    895895    return (std(i));
    896896  }
  • libpolys/coeffs/gnumpfl.cc

    rc7aad0 rc14846c  
    9898}
    9999
     100#if 0
    100101static number ngfCopyMap(number a, const coeffs r1, const coeffs r2)
    101102{
     
    110111  return (number)b;
    111112}
     113#endif
    112114
    113115/*2
     
    463465  if (nCoeff_is_long_R(src))
    464466  {
    465     return ngfCopyMap;
     467    return ndCopyMap; //ngfCopyMap;
    466468  }
    467469  if (nCoeff_is_R(src))
  • libpolys/coeffs/longrat.cc

    rc7aad0 rc14846c  
    19861986  if (nCoeff_is_Q(src))
    19871987  {
    1988     return nlCopyMap;
     1988    return ndCopyMap;
    19891989  }
    19901990  if (nCoeff_is_Zp(src))
  • libpolys/coeffs/rintegers.cc

    rc7aad0 rc14846c  
    112112}
    113113
     114#if 0
    114115number nrzCopyMap(number a, const coeffs /*src*/, const coeffs dst)
    115116{
    116117  return nrzCopy(a,dst);
    117118}
     119#endif
    118120
    119121int nrzSize(number a, const coeffs)
     
    283285  if (nCoeff_is_Ring_Z(src) || nCoeff_is_Ring_ModN(src) || nCoeff_is_Ring_PtoM(src))
    284286  {
    285     return nrzCopyMap;
     287    return ndCopyMap; //nrzCopyMap;
    286288  }
    287289  if (nCoeff_is_Ring_2toM(src))
  • libpolys/polys/ext_fields/algext.cc

    rc7aad0 rc14846c  
    557557}
    558558
     559#if 0
    559560/* assumes that either src = Q(a), dst = Q(a), or
    560561                       src = Z/p(a), dst = Z/p(a)     */
     
    563564  return naCopy(a, dst);
    564565}
     566#endif
    565567
    566568number naCopyExt(number a, const coeffs src, const coeffs dst)
     
    639641    {
    640642      if (src->type==n_algExt)
    641          return naCopyMap;                       /// Q(a)   --> Q(a)
     643         return ndCopyMap; // naCopyMap;         /// Q(a)   --> Q(a)
    642644      else
    643645         return naCopyExt;
     
    652654    {
    653655      if (src->type==n_algExt)
    654         return naCopyMap;                        /// Z/p(a) --> Z/p(a)
     656        return ndCopyMap; // naCopyMap;          /// Z/p(a) --> Z/p(a)
    655657      else
    656658         return naCopyExt;
  • libpolys/polys/ext_fields/transext.cc

    rc7aad0 rc14846c  
    9797
    9898/// forward declarations
    99 BOOLEAN  ntGreaterZero(number a, const coeffs cf); 
     99BOOLEAN  ntGreaterZero(number a, const coeffs cf);
    100100BOOLEAN  ntGreater(number a, number b, const coeffs cf);
    101101BOOLEAN  ntEqual(number a, number b, const coeffs cf);
     
    182182{
    183183  ntTest(a); ntTest(b);
    184  
     184
    185185  /// simple tests
    186186  if (a == b) return TRUE;
    187187  if ((IS0(a)) && (!IS0(b))) return FALSE;
    188188  if ((IS0(b)) && (!IS0(a))) return FALSE;
    189  
    190   /// cheap test if gcd's have been cancelled in both numbers 
     189
     190  /// cheap test if gcd's have been cancelled in both numbers
    191191  fraction fa = (fraction)a;
    192192  fraction fb = (fraction)b;
     
    206206    return TRUE;
    207207  }
    208  
     208
    209209  /* default: the more expensive multiplication test
    210210              a/b = c/d  <==>  a*d = b*c */
     
    383383  const int P = rVar(A);
    384384  assume( P > 0 );
    385  
     385
    386386  Print("//   %d parameter    : ", P);
    387  
     387
    388388  for (int nop=0; nop < P; nop ++)
    389389    Print("%s ", rRingVar(nop, A));
    390390
    391391  assume( A->minideal == NULL );
    392  
     392
    393393  PrintS("\n//   minpoly        : 0\n");
    394394
     
    412412  if (IS0(a)) return ntCopy(b, cf);
    413413  if (IS0(b)) return ntCopy(a, cf);
    414  
     414
    415415  fraction fa = (fraction)a;
    416416  fraction fb = (fraction)b;
    417  
     417
    418418  poly g = p_Copy(NUM(fa), ntRing);
    419419  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
     
    421421  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
    422422  g = p_Add_q(g, h, ntRing);
    423  
     423
    424424  if (g == NULL) return NULL;
    425  
     425
    426426  poly f;
    427427  if      (DENIS1(fa) && DENIS1(fb))  f = NULL;
     
    431431                                                   p_Copy(DEN(fb), ntRing),
    432432                                                   ntRing);
    433  
     433
    434434  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    435435  NUM(result) = g;
     
    445445  if (IS0(a)) return ntNeg(ntCopy(b, cf), cf);
    446446  if (IS0(b)) return ntCopy(a, cf);
    447  
     447
    448448  fraction fa = (fraction)a;
    449449  fraction fb = (fraction)b;
    450  
     450
    451451  poly g = p_Copy(NUM(fa), ntRing);
    452452  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
     
    454454  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
    455455  g = p_Add_q(g, p_Neg(h, ntRing), ntRing);
    456  
     456
    457457  if (g == NULL) return NULL;
    458  
     458
    459459  poly f;
    460460  if      (DENIS1(fa) && DENIS1(fb))  f = NULL;
     
    464464                                                   p_Copy(DEN(fb), ntRing),
    465465                                                   ntRing);
    466  
     466
    467467  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    468468  NUM(result) = g;
     
    477477  ntTest(a); ntTest(b);
    478478  if (IS0(a) || IS0(b)) return NULL;
    479  
     479
    480480  fraction fa = (fraction)a;
    481481  fraction fb = (fraction)b;
    482  
     482
    483483  poly g = p_Copy(NUM(fa), ntRing);
    484484  poly h = p_Copy(NUM(fb), ntRing);
    485485  g = p_Mult_q(g, h, ntRing);
    486  
     486
    487487  if (g == NULL) return NULL;   /* may happen due to zero divisors */
    488  
     488
    489489  poly f;
    490490  if      (DENIS1(fa) && DENIS1(fb))  f = NULL;
     
    494494                                                   p_Copy(DEN(fb), ntRing),
    495495                                                   ntRing);
    496  
     496
    497497  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    498498  NUM(result) = g;
     
    508508  if (IS0(a)) return NULL;
    509509  if (IS0(b)) WerrorS(nDivBy0);
    510  
     510
    511511  fraction fa = (fraction)a;
    512512  fraction fb = (fraction)b;
    513  
     513
    514514  poly g = p_Copy(NUM(fa), ntRing);
    515515  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
    516  
     516
    517517  if (g == NULL) return NULL;   /* may happen due to zero divisors */
    518  
     518
    519519  poly f = p_Copy(NUM(fb), ntRing);
    520520  if (!DENIS1(fa)) f = p_Mult_q(f, p_Copy(DEN(fa), ntRing), ntRing);
    521  
     521
    522522  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    523523  NUM(result) = g;
     
    539539{
    540540  ntTest(a);
    541  
     541
    542542  /* special cases first */
    543543  if (IS0(a))
     
    549549  else if (exp ==  1) { *b = ntCopy(a, cf); return;}
    550550  else if (exp == -1) { *b = ntInvers(a, cf); return;}
    551  
     551
    552552  int expAbs = exp; if (expAbs < 0) expAbs = -expAbs;
    553  
     553
    554554  /* now compute a^expAbs */
    555555  number pow; number t;
     
    589589    ntDelete(&factor, cf);
    590590  }
    591  
     591
    592592  /* invert if original exponent was negative */
    593593  if (exp < 0)
     
    636636  assume(!IS0(f));
    637637  assume(!DENIS1(f));
    638  
     638
    639639  if (!p_IsConstant(DEN(f), ntRing))
    640640  { /* step (1); see documentation of this procedure above */
     
    715715    DEN(f) = NULL;
    716716  }
    717  
     717
    718718  /* Now, due to the above computations, DEN(f) may have become the
    719719     1-polynomial which needs to be represented by NULL: */
     
    731731  ntTest(a);
    732732  if (IS0(a)) return;
    733  
     733
    734734  fraction f = (fraction)a;
    735735  if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
    736  
     736
    737737  /* check whether NUM(f) = DEN(f), and - if so - replace 'a' by 1 */
    738738  if (p_EqualPolys(NUM(f), DEN(f), ntRing))
     
    743743    return;
    744744  }
    745  
     745
    746746  if (COM(f) <= BOUND_COMPLEXITY) return;
    747747  else definiteGcdCancellation(a, cf, TRUE);
     
    753753{
    754754  ntTest(a);
    755  
     755
    756756  fraction f = (fraction)a;
    757  
     757
    758758  if (!simpleTestsHaveAlreadyBeenPerformed)
    759759  {
    760760    if (IS0(a)) return;
    761761    if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
    762  
     762
    763763    /* check whether NUM(f) = DEN(f), and - if so - replace 'a' by 1 */
    764764    if (p_EqualPolys(NUM(f), DEN(f), ntRing))
     
    770770    }
    771771  }
    772  
    773 #ifdef HAVE_FACTORY 
     772
     773#ifdef HAVE_FACTORY
    774774  /* singclap_gcd destroys its arguments; we hence need copies: */
    775775  poly pNum = p_Copy(NUM(f), ntRing);
    776776  poly pDen = p_Copy(DEN(f), ntRing);
    777  
     777
    778778  /* Note that, over Q, singclap_gcd will remove the denominators in all
    779779     rational coefficients of pNum and pDen, before starting to compute
     
    879879  fraction fb = (fraction)b;
    880880  if ((b==NULL)||(DEN(fb)==NULL)) return ntCopy(a,cf);
    881 #ifdef HAVE_FACTORY 
     881#ifdef HAVE_FACTORY
    882882  fraction fa = (fraction)a;
    883883  /* singclap_gcd destroys its arguments; we hence need copies: */
    884884  poly pa = p_Copy(NUM(fa), ntRing);
    885885  poly pb = p_Copy(DEN(fb), ntRing);
    886  
     886
    887887  /* Note that, over Q, singclap_gcd will remove the denominators in all
    888888     rational coefficients of pa and pb, before starting to compute
     
    918918  if (a==NULL) return ntCopy(b,cf);
    919919  if (b==NULL) return ntCopy(a,cf);
    920 #ifdef HAVE_FACTORY 
     920#ifdef HAVE_FACTORY
    921921  fraction fa = (fraction)a;
    922922  fraction fb = (fraction)b;
     
    924924  poly pa = p_Copy(NUM(fa), ntRing);
    925925  poly pb = p_Copy(NUM(fb), ntRing);
    926  
     926
    927927  /* Note that, over Q, singclap_gcd will remove the denominators in all
    928928     rational coefficients of pa and pb, before starting to compute
     
    10951095  /* dst is expected to be a rational function field */
    10961096  assume(getCoeffType(dst) == ID);
    1097  
     1097
    10981098  int h = 0; /* the height of the extension tower given by dst */
    10991099  coeffs bDst = nCoeff_bottom(dst, h); /* the bottom field in the tower dst */
    11001100  coeffs bSrc = nCoeff_bottom(src, h); /* the bottom field in the tower src */
    1101  
     1101
    11021102  /* for the time being, we only provide maps if h = 1 and if b is Q or
    11031103     some field Z/pZ: */
     
    11181118  if (h != 1) return NULL;
    11191119  if ((!nCoeff_is_Zp(bDst)) && (!nCoeff_is_Q(bDst))) return NULL;
    1120  
     1120
    11211121  /* Let T denote the sequence of transcendental extension variables, i.e.,
    11221122     K[t_1, ..., t_s] =: K[T];
    11231123     Let moreover, for any such sequence T, T' denote any subsequence of T
    11241124     of the form t_1, ..., t_w with w <= s. */
    1125  
     1125
    11261126  if ((!nCoeff_is_Zp(bSrc)) && (!nCoeff_is_Q(bSrc))) return NULL;
    1127  
     1127
    11281128  if (nCoeff_is_Q(bSrc) && nCoeff_is_Q(bDst))
    11291129  {
     
    11331133                 rRingVar(i, dst->extRing)) != 0) return NULL;
    11341134      if (src->type==n_transExt)
    1135         return ntCopyMap;                              /// Q(T')   --> Q(T)
     1135        return ndCopyMap; //ntCopyMap;          /// Q(T')   --> Q(T)
    11361136      else
    11371137        return ntCopyAlg;
    11381138  }
    1139  
     1139
    11401140  if (nCoeff_is_Zp(bSrc) && nCoeff_is_Zp(bDst))
    11411141  {
     
    11451145                 rRingVar(i, dst->extRing)) != 0) return NULL;
    11461146      if (src->type==n_transExt)
    1147         return ntCopyMap;                              /// Z/p(T') --> Z/p(T)
     1147        return ndCopyMap; //ntCopyMap;         /// Z/p(T') --> Z/p(T)
    11481148      else
    11491149        return ntCopyAlg;
    11501150  }
    1151  
    1152   return NULL;                                           /// default
     1151
     1152  return NULL;                                 /// default
    11531153}
    11541154
     
    11631163
    11641164  assume( infoStruct != NULL );
    1165  
     1165
    11661166  TransExtInfo *e = (TransExtInfo *)infoStruct;
    1167  
     1167
    11681168  assume( e->r                != NULL);      // extRing;
    11691169  assume( e->r->cf            != NULL);      // extRing->cf;
    1170   assume( e->r->minideal == NULL ); 
     1170  assume( e->r->minideal == NULL );
    11711171
    11721172  assume( cf != NULL );
     
    11741174
    11751175  cf->extRing           = e->r;
    1176   cf->extRing->ref ++; // increase the ref.counter for the ground poly. ring! 
     1176  cf->extRing->ref ++; // increase the ref.counter for the ground poly. ring!
    11771177
    11781178  /* propagate characteristic up so that it becomes
    11791179     directly accessible in cf: */
    11801180  cf->ch = cf->extRing->cf->ch;
    1181  
     1181
    11821182  cf->cfGreaterZero  = ntGreaterZero;
    11831183  cf->cfGreater      = ntGreater;
     
    12151215  cf->cfIntDiv       = ntDiv;
    12161216  cf->cfKillChar     = ntKillChar;
    1217  
     1217
    12181218#ifndef HAVE_FACTORY
    12191219  PrintS("// Warning: The 'factory' module is not available.\n");
     
    12211221  PrintS("//          computed fraction!\n");
    12221222#endif
    1223  
     1223
    12241224  return FALSE;
    12251225}
     
    12311231
    12321232  const ring R = cf->extRing;
    1233   assume( R != NULL ); 
     1233  assume( R != NULL );
    12341234  assume( 0 < iParameter && iParameter <= rVar(R) );
    12351235
    12361236  poly p = p_One(R); p_SetExp(p, iParameter, 1, R); p_Setm(p, R);
    12371237
    1238 //  return (number) p; 
     1238//  return (number) p;
    12391239
    12401240  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
     
    12471247
    12481248
    1249 /// if m == var(i)/1 => return i, 
     1249/// if m == var(i)/1 => return i,
    12501250int ntIsParam(number m, const coeffs cf)
    12511251{
     
    12601260    return 0;
    12611261
    1262   return p_Var( NUM(f), R ); 
    1263 }
     1262  return p_Var( NUM(f), R );
     1263}
Note: See TracChangeset for help on using the changeset viewer.