Changeset 0aa5d5 in git


Ignore:
Timestamp:
Mar 10, 2014, 4:02:26 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
df3eef0007e351efd7a2c08a22185605e7ae6dd2
Parents:
5f4e0e5f2f9ec9aea8d113e4a58ecbc39cf69c35
git-author:
Martin Lee <martinlee84@web.de>2014-03-10 16:02:26+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-03-17 18:31:54+01:00
Message:
chg: separate non function field case from function field case
chg: better readability of code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/libfac/charset/alg_factor.cc

    r5f4e0e r0aa5d5  
    733733#ifndef DEBUGOUTPUT
    734734static CFFList
    735 alg_factor( const CanonicalForm & f, const CFList & Astar, const Variable & vminpoly, const Varlist /*& oldord*/, const CFList & as)
     735alg_factor( const CanonicalForm & F, const CFList & Astar, const Variable & vminpoly, const Varlist /*& oldord*/, const CFList & as, bool isFunctionField)
    736736#else
    737737static CFFList
    738 alg_factor( const CanonicalForm & f, const CFList & Astar, const Variable & vminpoly, const Varlist & oldord, const CFList & as)
     738alg_factor( const CanonicalForm & F, const CFList & Astar, const Variable & vminpoly, const Varlist & oldord, const CFList & as, bool isFunctionField)
    739739#endif
    740740{
    741741  CFFList L, Factorlist;
    742   CanonicalForm R, Rstar, s, g, h;
     742  CanonicalForm R, Rstar, s, g, h, f= F;
    743743  CFList substlist;
    744744
     
    747747
    748748  //out_cf("start alg_factor:",f,"\n");
    749   substlist= simpleextension(Astar, vminpoly, Rstar);
     749  substlist= simpleextension(Astar, vminpoly, isFunctionField, Rstar);
    750750  DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
    751751  DEBOUTLN(CERR, "alg_factor: minpoly Rstar= ", Rstar);
    752752  DEBOUTLN(CERR, "alg_factor: vminpoly= ", vminpoly);
     753
     754  f= subst (f, Astar, substlist, Rstar, isFunctionField);
     755
     756  Variable alpha;
     757  if (!isFunctionField)
     758  {
     759    alpha= rootOf (Rstar);
     760    g= replacevar (f, Rstar.mvar(), alpha);
     761
     762    Factorlist= factorize (g, alpha);
     763
     764    for (CFFListIterator i= Factorlist; i.hasItem(); i++)
     765    {
     766      h= i.getItem().factor();
     767      if (!h.inCoeffDomain())
     768      {
     769        h= replacevar (h, alpha, Rstar.mvar());
     770        h *= bCommonDen(h);
     771        h= Prem (h, as);
     772        L.append (CFFactor (h, i.getItem().exp()));
     773      }
     774    }
     775    return L;
     776  }
    753777
    754778  sqrf_norm(f, Rstar, vminpoly, s, g, R );
     
    10471071  CFFList Factorlist;
    10481072  Varlist gcdord= Union(ord,newuord); gcdord.append(f.mvar());
     1073  bool isFunctionField= (newuord.length() > 0);
     1074
    10491075  // This is for now. we need alg_sqrfree implemented!
    1050   CanonicalForm Fgcd;
    1051           Fgcd= alg_gcd(f,f.deriv(),Astar);
     1076  CanonicalForm Fgcd= 0;
     1077  if (isFunctionField)
     1078    Fgcd= alg_gcd(f,f.deriv(),Astar);
     1079
    10521080  if ( Fgcd == 0 ) {DEBOUTMSG(CERR, "WARNING: p'th root ?");}
    1053   if (( degree(Fgcd, f.mvar()) > 0) && (!(f.deriv().isZero())) ){
     1081  if (isFunctionField && ( degree(Fgcd, f.mvar()) > 0) && (!(f.deriv().isZero())) )
     1082  {
    10541083    DEBOUTLN(CERR, "Nontrivial GCD found of ", f);
    10551084    CanonicalForm Ggcd= divide(f, Fgcd,Astar);
     1085    if (getCharacteristic() == 0)
     1086    {
     1087      CFFList result= newfactoras (Ggcd,as,success); //Ggcd is the squarefree part of f
     1088      multiplicity (result, f, Astar);
     1089      return result;
     1090    }
    10561091    DEBOUTLN(CERR, "  split into ", Fgcd);
    10571092    DEBOUTLN(CERR, "         and ", Ggcd);
     
    10601095    return myUnion(newfactoras(Fgcd,as,success) , newfactoras(Ggcd,as,success));
    10611096  }
    1062   if ( getCharacteristic() > 0 ){
    1063 
     1097  if ( getCharacteristic() > 0 )
     1098  {
    10641099    // First look for extension!
    10651100    IntList degreelist;
     
    10771112        vminpoly= rootOf(MIPO);
    10781113      }
    1079       Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
     1114      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    10801115      DEBDECLEVEL(CERR,"newfactoras");
    10811116      return Factorlist;
     
    10971132        DEBOUTLN(CERR, "degree(vminpoly)= ", degree(vminpoly));
    10981133      }
    1099       Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
     1134      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    11001135      DEBDECLEVEL(CERR,"newfactoras");
    11011136      return Factorlist;
     
    11051140    DEBOUTMSG(CERR, "Char=0! Apply Trager!");
    11061141    Variable vminpoly;
    1107     Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
     1142    Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    11081143      DEBDECLEVEL(CERR,"newfactoras");
    11091144      return Factorlist;
     
    11171152newcfactor(const CanonicalForm & f, const CFList & as, int & success )
    11181153{
    1119   Off(SW_RATIONAL);
    1120   CFFList Output, output, Factors=Factorize(f);
    1121   On(SW_RATIONAL);
    1122   Factors.removeFirst();
    1123 
    1124   if ( as.length() == 0 ){ success=1; return Factors;}
    1125   if ( cls(f) <= cls(as.getLast()) ) { success=1; return Factors;}
     1154  On (SW_RATIONAL);
     1155  CFFList Output, output, Factors= factorize(f);
     1156  if (Factors.getFirst().factor().inCoeffDomain())
     1157    Factors.removeFirst();
     1158
     1159  if ( as.length() == 0 )
     1160  {
     1161    success=1;
     1162    return Factors;
     1163  }
     1164  if ( cls(f) <= cls(as.getLast()) )
     1165  {
     1166    success=1;
     1167    return Factors;
     1168  }
    11261169
    11271170  success=1;
Note: See TracChangeset for help on using the changeset viewer.