Changeset bcfd11a in git for libpolys


Ignore:
Timestamp:
Mar 20, 2012, 3:33:34 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
7e9f1298826e9e80c154aaa465935c0ba2acad38
Parents:
dd668fd21e0141dd6716d45d63f34e6ca84d230f
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-20 15:33:34+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-23 16:06:34+01:00
Message:
elimination of rMinpolyIsNULL in favour of nCoeff_is_algExt

fix rMinpolyIsNULL (idIs0)

TODO: remove rMinpolyIsNULL it completely!
Location:
libpolys/polys/monomials
Files:
4 edited

Legend:

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

    rdd668f rbcfd11a  
    152152      omFreeSize((ADDRESS)monoms,l*sizeof(poly));
    153153    }
    154     if (!rMinpolyIsNULL(dst_r)) result=p_MinPolyNormalize(result, dst_r);
     154
     155    assume(dst_r != NULL);
     156    assume(dst_r->cf != NULL);
     157   
     158    if (nCoeff_is_algExt(dst_r->cf))
     159      result = p_MinPolyNormalize(result, dst_r);
    155160  }
    156161  return result;
     
    318323poly p_MinPolyNormalize(poly p, const ring r)
    319324{
    320   number one = n_Init(1, r->cf);
     325  const coeffs C = r->cf;
     326  number one = n_Init(1, C);
    321327  spolyrec rp;
    322328
     
    326332  {
    327333    // this returns 0, if p == MinPoly
    328     number product = n_Mult(pGetCoeff(p), one,r->cf);
    329     if ((product == NULL)||(n_IsZero(product,r->cf)))
    330     {
    331       p_LmDelete(&p,r);
     334    number product = n_Mult(p_GetCoeff(p, r), one, C);
     335    if ((product == NULL)||(n_IsZero(product, C)))
     336    {
     337      p_LmDelete(&p, r);
    332338    }
    333339    else
    334340    {
    335       p_SetCoeff(p, product,r);
     341      p_SetCoeff(p, product, r);
    336342      pNext(q) = p;
    337343      q = p;
     
    340346  }
    341347  pNext(q) = NULL;
     348  n_Delete(&one, C);
    342349  return rp.next;
    343350}
  • libpolys/polys/monomials/p_polys.cc

    rdd668f rbcfd11a  
    34573457  poly qq; /* the mapped monomial */
    34583458
     3459  assume(dst != NULL);
     3460  assume(dst->cf != NULL);
     3461 
    34593462  while (p != NULL)
    34603463  {
     
    34663469      number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
    34673470
    3468       if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) )
     3471      if ( nCoeff_is_algExt(dst->cf) )
    34693472        n_Normalize(n, dst->cf);
    34703473
     
    34833486      p_Test(aq, dst);
    34843487
    3485       if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) )
    3486       {
     3488      if ( nCoeff_is_algExt(dst->cf) )
    34873489        p_Normalize(aq,dst);
    3488 
    3489       }
     3490     
    34903491      if (aq == NULL)
    34913492        p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
     
    35863587        }
    35873588      }
    3588       if ( mapped_to_par && (!rMinpolyIsNULL(dst)) )
     3589      if ( mapped_to_par && nCoeff_is_algExt(dst->cf) )
    35893590      {
    35903591        number n = p_GetCoeff(qq, dst);
    3591         n_Normalize(n,dst->cf);
     3592        n_Normalize(n, dst->cf);
    35923593        p_GetCoeff(qq, dst) = n;
    35933594      }
  • libpolys/polys/monomials/ring.cc

    rdd668f rbcfd11a  
    272272  else
    273273    n_CoeffWrite(C, details);
    274  
    275 #if 0
    276   {
    277     PrintS("//   characteristic : ");
    278    
    279     char const * const * const params = rParameter(r);
    280    
    281     if (params!=NULL)
    282     {
    283       Print ("//   %d parameter    : ",rPar(r));
    284      
    285       char const * const * sp= params;
    286       int nop=0;
    287       while (nop<rPar(r))
    288       {
    289         PrintS(*sp);
    290         PrintS(" ");
    291         sp++; nop++;
    292       }
    293       PrintS("\n//   minpoly        : ");
    294       if ( rField_is_long_C(r) )
    295       {
    296         // i^2+1:
    297         Print("(%s^2+1)\n", params[0]);
    298       }
    299       else if (rMinpolyIsNULL(r))
    300       {
    301         PrintS("0\n");
    302       }
    303       else
    304       {
    305         StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringAppendS("\n"));
    306       }
    307       //if (r->qideal!=NULL)
    308       //{
    309       //  iiWriteMatrix((matrix)r->qideal,"//   minpolys",1,r,0);
    310       //  PrintLn();
    311       //}
    312     }
    313   }
    314 #endif
     274//   {
     275//     PrintS("//   characteristic : ");
     276//     
     277//     char const * const * const params = rParameter(r);
     278//     
     279//     if (params!=NULL)
     280//     {
     281//       Print ("//   %d parameter    : ",rPar(r));
     282//       
     283//       char const * const * sp= params;
     284//       int nop=0;
     285//       while (nop<rPar(r))
     286//       {
     287//         PrintS(*sp);
     288//         PrintS(" ");
     289//         sp++; nop++;
     290//       }
     291//       PrintS("\n//   minpoly        : ");
     292//       if ( rField_is_long_C(r) )
     293//       {
     294//         // i^2+1:
     295//         Print("(%s^2+1)\n", params[0]);
     296//       }
     297//       else if (rMinpolyIsNULL(r))
     298//       {
     299//         PrintS("0\n");
     300//       }
     301//       else
     302//       {
     303//         StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringAppendS("\n"));
     304//       }
     305//       //if (r->qideal!=NULL)
     306//       //{
     307//       //  iiWriteMatrix((matrix)r->qideal,"//   minpolys",1,r,0);
     308//       //  PrintLn();
     309//       //}
     310//     }
     311//   }
    315312  Print("//   number of vars : %d",r->N);
    316313
     
    21312128  }
    21322129
    2133   if (!rMinpolyIsNULL(r))
     2130  assume(r != NULL);
     2131  assume(r->cf != NULL);
     2132 
     2133  if (nCoeff_is_algExt(r->cf))
     2134  {
     2135    assume(r->cf->extRing != NULL);
     2136    assume(r->cf->extRing->qideal != NULL);
    21342137    omCheckAddr(r->cf->extRing->qideal->m[0]);
     2138  }
    21352139
    21362140  //assume(r->cf!=NULL);
     
    56315635
    56325636
    5633 BOOLEAN rMinpolyIsNULL(const ring r)
    5634 {
    5635   assume(r != NULL);
    5636   const coeffs C = r->cf;
    5637   assume(C != NULL);
    5638 
    5639   const BOOLEAN ret = nCoeff_is_algExt(C); //  || nCoeff_is_GF(C) || nCoeff_is_long_C(C);
    5640 
    5641   if( ret )
    5642   {
    5643     const ring R = C->extRing;
    5644     assume( R != NULL );
    5645     assume( !idIs0(R->qideal) );
    5646   }
    5647  
    5648   // TODO: it should be "!ret" but it'd lead to test fails (due to rDecompose?)
    5649   return ret;
    5650 }
    5651 
    56525637poly rGetVar(const int varIndex, const ring r)
    56535638{
  • libpolys/polys/monomials/ring.h

    rdd668f rbcfd11a  
    649649
    650650/// Tests whether '(r->cf->minpoly) == NULL'
    651 BOOLEAN rMinpolyIsNULL(const ring r);
     651static inline BOOLEAN rMinpolyIsNULL(const ring r)
     652{
     653  assume(r != NULL);
     654  const coeffs C = r->cf;
     655  assume(C != NULL);
     656
     657  const BOOLEAN ret = nCoeff_is_algExt(C); //  || nCoeff_is_GF(C) || nCoeff_is_long_C(C);
     658
     659  if( ret )
     660  {
     661    const ring R = C->extRing;
     662    assume( R != NULL );
     663    BOOLEAN idIs0 (ideal h);
     664    assume( !idIs0(R->qideal) );
     665  }
     666
     667  // TODO: this leads to test fails (due to rDecompose?)
     668  return !ret;
     669}
     670
    652671
    653672
Note: See TracChangeset for help on using the changeset viewer.