Changeset 04cdf06 in git


Ignore:
Timestamp:
Dec 14, 2010, 1:53:42 PM (13 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3da413f2c6332c298e7f4115ffffdc526d5e914a
Parents:
ab5b77f9e4845c4931341d1ae2da855f56b7b706
Message:
factorization now uses 'gcd'


git-svn-id: file:///usr/local/Singular/svn/trunk@13770 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
factory
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqBivar.cc

    rab5b77 r04cdf06  
    860860  else
    861861  {
    862     if (GF)
    863       gcdDerivX= GCD_GF (A, derivX);
    864     else if (alpha == x)
    865       gcdDerivX= GCD_small_p (A, derivX);
    866     else
    867       gcdDerivX= GCD_Fp_extension (A, derivX, alpha);
     862    gcdDerivX= gcd (A, derivX);
    868863    if (degree (gcdDerivX) > 0)
    869864    {
     
    885880  else
    886881  {
    887     if (GF)
    888       gcdDerivY= GCD_GF (A, derivY);
    889     else if (alpha == x)
    890       gcdDerivY= GCD_small_p (A, derivY);
    891     else
    892       gcdDerivY= GCD_Fp_extension (A, derivY, alpha);
     882    gcdDerivY= gcd (A, derivY);
    893883    if (degree (gcdDerivY) > 0)
    894884    {
  • factory/facFqFactorize.cc

    rab5b77 r04cdf06  
    4949  CanonicalForm G= swapvar (F, F.mvar(), Variable (1));
    5050  CFList L;
    51   Variable alpha;
    52   bool algExt= hasFirstAlgVar (G, alpha);
    5351  for (CFIterator i= G; i.hasTerms(); i++)
    5452    L.append (i.coeff());
    5553  if (L.length() == 2)
    56   {
    57     bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    58     if (GF)
    59     {
    60       return swapvar (GCD_GF (L.getFirst(), L.getLast()), F.mvar(),
    61                       Variable (1));
    62     }
    63     else if (!GF && algExt)
    64     {
    65       return swapvar (GCD_Fp_extension (L.getFirst(), L.getLast(), alpha),
    66                                        F.mvar(), Variable (1));
    67     }
    68     else
    69       return swapvar (GCD_small_p (L.getFirst(), L.getLast()), F.mvar(),
    70                      Variable (1));
    71   }
     54    return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), Variable (1));
    7255  if (L.length() == 1)
    73   {
    7456    return LC (F, Variable (1));
    75   }
    7657  return swapvar (listGCD (L), F.mvar(), Variable (1));
    7758}
     
    8364  if (L.length() == 1)
    8465    return L.getFirst();
    85   Variable alpha;
    8666  if (L.length() == 2)
    87   {
    88     bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    89     if (GF)
    90     {
    91       return GCD_GF (L.getFirst(), L.getLast());
    92     }
    93     else if (!GF && (hasFirstAlgVar (L.getFirst(), alpha) ||
    94                      hasFirstAlgVar (L.getLast(), alpha)))
    95     {
    96       return GCD_Fp_extension (L.getFirst(), L.getLast(), alpha);
    97     }
    98     else
    99       return GCD_small_p (L.getFirst(), L.getLast());
    100   }
     67    return gcd (L.getFirst(), L.getLast());
    10168  else
    10269  {
     
    10471    CanonicalForm resultHi, resultLo;
    10572    int length= L.length()/2;
    106     bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    10773    int j= 0;
    10874    for (CFListIterator i= L; j < length; i++, j++)
     
    11379    if (resultHi.isOne() || resultLo.isOne())
    11480      return 1;
    115     if (GF)
    116     {
    117       return GCD_GF (resultHi, resultLo);
    118     }
    119     else if (!GF && (hasFirstAlgVar (resultHi, alpha) ||
    120                      hasFirstAlgVar (resultLo, alpha)))
    121     {
    122       return GCD_Fp_extension (resultHi, resultLo, alpha);
    123     }
    124     else
    125       return GCD_small_p (resultHi, resultLo);
     81    return gcd (resultHi, resultLo);
    12682  }
    12783}
     
    147103  if (L.length() == 2)
    148104  {
    149     bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    150     if (GF)
    151     {
    152       if (swap)
    153         return swapvar(GCD_GF (L.getFirst(), L.getLast()), F.mvar(), x);
    154       else
    155         return GCD_GF (L.getFirst(), L.getLast());
    156     }
    157     else if (!GF && algExt)
    158     {
    159       if (swap)
    160         return swapvar(GCD_Fp_extension (L.getFirst(), L.getLast(), alpha),
    161                                          F.mvar(), x);
    162       else
    163         return GCD_Fp_extension (L.getFirst(), L.getLast(), alpha);
    164     }
     105    if (swap)
     106      return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), x);
    165107    else
    166     {
    167       if (swap)
    168         return swapvar (GCD_small_p (L.getFirst(), L.getLast()), F.mvar(),
    169                         x);
    170       else
    171         return GCD_small_p (L.getFirst(), L.getLast());
    172     }
     108      return gcd (L.getFirst(), L.getLast());
    173109  }
    174110  if (L.length() == 1)
     
    181117    return listGCD (L);
    182118}
    183 
    184 static inline
    185 CanonicalForm
    186 myLcm (const CanonicalForm& F, const CanonicalForm& G)
    187 {
    188   if ( F.isZero() || G.isZero() )
    189     return 0;
    190   else
    191   {
    192     Variable alpha;
    193     bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    194     if (GF)
    195       return (F/GCD_GF (F, G))*G;
    196     else if (!GF && (hasFirstAlgVar (F, alpha) ||
    197                      hasFirstAlgVar (G, alpha)))
    198       return (F/GCD_Fp_extension (F, G, alpha))*G;
    199     else
    200       return (F/GCD_small_p (F, G))*G;
    201   }
    202 }
    203 
    204119
    205120static inline
     
    13461261  contentAi.append (myContent (A, i));
    13471262  contentAi.append (myContent (A, i - 1));
    1348   CanonicalForm result= myLcm (contentAi.getFirst(), contentAi.getLast());
     1263  CanonicalForm result= lcm (contentAi.getFirst(), contentAi.getLast());
    13491264  for (i= i - 2; i > 0; i--)
    13501265  {
    13511266    contentAi.append (content (A, i));
    1352     result= myLcm (result, contentAi.getLast());
     1267    result= lcm (result, contentAi.getLast());
    13531268  }
    13541269  return result;
     
    17501665        A= swapvar (A, x, z);
    17511666      }
    1752       if (GF)
    1753         gcdDerivZ= GCD_GF (bufA, derivZ);
    1754       else if (alpha == Variable (1))
    1755         gcdDerivZ= GCD_small_p (bufA, derivZ);
    1756       else
    1757         gcdDerivZ= GCD_Fp_extension (bufA, derivZ, alpha);
     1667      gcdDerivZ= gcd (bufA, derivZ);
    17581668      if (degree (gcdDerivZ) > 0 && !derivZ.isZero())
    17591669      {
  • factory/facFqSquarefree.cc

    rab5b77 r04cdf06  
    7777  Variable buf= alpha;
    7878  CanonicalForm b= deriv (F, x);
    79   bool GF= (CFFactory::gettype() == GaloisFieldDomain);
    80   if (GF)
    81     c= GCD_GF (F, b);
    82   else if (GF == false && k != 1)
    83     c= GCD_Fp_extension (F, b, buf);
    84   else
    85     c= GCD_small_p (F, b);
     79  c= gcd (F, b);
    8680  CanonicalForm w= F/c;
    8781  CanonicalForm v= b/c;
     
    9387  while (j < p - 1 && degree(u) >= 0)
    9488  {
    95     if (GF)
    96       g= GCD_GF (w, u);
    97     else if (GF == false && k != 1)
    98       g= GCD_Fp_extension (w, u, buf);
    99     else
    100       g= GCD_small_p (w, u);
     89    g= gcd (w, u);
    10190    if (degree(g) > 0)
    10291      result.append (CFFactor (g, j));
     
    190179    for (CFFListIterator j= tmp1; j.hasItem(); j++)
    191180    {
    192       if (GF)
    193         tmp= GCD_GF (i.getItem().factor(), j.getItem().factor());
    194       else if (GF == false && buf == Variable (1))
    195         tmp= GCD_small_p (i.getItem().factor(), j.getItem().factor());
    196       else
    197         tmp= GCD_Fp_extension (i.getItem().factor(),j.getItem().factor(),buf);
     181      tmp= gcd (i.getItem().factor(), j.getItem().factor());
    198182      i.getItem()= CFFactor (i.getItem().factor()/tmp, i.getItem().exp());
    199183      j.getItem()= CFFactor (j.getItem().factor()/tmp, j.getItem().exp());
     
    243227    return 1;
    244228  }
    245   if (GF)
    246     w= GCD_GF (A, deriv (A, Variable (i)));
    247   else if (GF == false && alpha == Variable (1))
    248     w= GCD_small_p (A, deriv (A, Variable (i)));
    249   else
    250     w= GCD_Fp_extension (A, deriv (A, Variable (i)), vBuf);
     229  w= gcd (A, deriv (A, Variable (i)));
    251230
    252231  b= A/w;
     
    260239    {
    261240      b= w;
    262       if (GF)
    263         w= GCD_GF (w, deriv (w, Variable (i)));
    264       else if (GF == false && vBuf == Variable (1))
    265         w= GCD_small_p (w, deriv (w, Variable (i)));
    266       else
    267         w= GCD_Fp_extension (w, deriv (w, Variable (i)), vBuf);
     241      w= gcd (w, deriv (w, Variable (i)));
    268242      b /= w;
    269243      if (degree (b) < 1)
    270244        break;
    271245      CanonicalForm g;
    272       if (GF)
    273         g= GCD_GF (b, result);
    274       else if (GF == false && vBuf == Variable (1))
    275         g= GCD_small_p (b, result);
    276       else
    277         g= GCD_Fp_extension (b, result, vBuf);
     246      g= gcd (b, result);
    278247      if (degree (g) > 0)
    279248        result *= b/g;
Note: See TracChangeset for help on using the changeset viewer.