Changeset 5355082 in git for factory


Ignore:
Timestamp:
Apr 29, 2014, 5:54:00 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
ea017ffdd4140ca784627c9a17bd45f8978c3818
Parents:
24819474a270d2480ed2d9f37a85ab3f5eafee1c
git-author:
Martin Lee <martinlee84@web.de>2014-04-29 17:54:00+02:00
git-committer:
Martin Lee <martinlee84@web.de>2014-05-12 14:35:01+02:00
Message:
chg: moved helper functions for facAlgFunc from libfac to facAlgFunc
Location:
factory
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • factory/facAlgFunc.cc

    r248194 r5355082  
    33////////////////////////////////////////////////////////////
    44
    5 // FACTORY - Includes
    6 #include <factory.h>
    7 // Factor - Includes
    8 #include <tmpl_inst.h>
    9 #include <helpstuff.h>
    10 // Charset - Includes
    11 #include "csutil.h"
    12 #include "charset.h"
    13 #include "reorder.h"
    14 #include "algfactor.h"
    15 // some CC's need this:
    16 #include "alg_factor.h"
     5#include "config.h"
     6
     7#include "cf_assert.h"
     8#include "debug.h"
     9
     10#include "algext.h"
     11#include "cf_random.h"
     12#include "cf_generator.h"
     13#include "cf_irred.h"
     14#include "cf_iter.h"
     15#include "cf_util.h"
     16#include "cf_algorithm.h"
     17#include "cf_map.h"
     18#include "cfModResultant.h"
     19#include "cfCharSets.h"
     20#include "facAlgFunc.h"
    1721
    1822void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
    1923
    20 #ifdef ALGFACTORDEBUG
    21 #  define DEBUGOUTPUT
    22 #else
    23 #  undef DEBUGOUTPUT
    24 #endif
    25 
    26 #include <libfac/factor/debug.h>
     24static
     25CanonicalForm
     26Prem (const CanonicalForm& F, const CanonicalForm& G)
     27{
     28  CanonicalForm f, g, l, test, lu, lv, t, retvalue;
     29  int degF, degG, levelF, levelG;
     30  bool reord;
     31  Variable v, vg= G.mvar();
     32
     33  if ( (levelF= F.level()) < (levelG= G.level()))
     34    return F;
     35  else
     36  {
     37    if ( levelF == levelG )
     38    {
     39      f= F;
     40      g= G;
     41      reord= false;
     42      v= F.mvar();
     43    }
     44    else
     45    {
     46      v= Variable (levelF + 1);
     47      f= swapvar (F, vg, v);
     48      g= swapvar (G, vg, v);
     49      reord= true;
     50    }
     51    degG= degree (g, v );
     52    degF= degree (f, v );
     53    if (degG <= degF)
     54    {
     55      l= LC (g);
     56      g= g - l*power (v, degG);
     57    }
     58    else
     59      l= 1;
     60    while ((degG <= degF) && (!f.isZero()))
     61    {
     62      test= gcd (l, LC(f));
     63      lu= l / test;
     64      lv= LC(f) / test;
     65
     66      t= power (v, degF - degG)*g*lv;
     67
     68      if (degF == 0)
     69        f= 0;
     70      else
     71        f= f - LC (f)*power (v, degF);
     72
     73      f= lu*f - t;
     74      degF= degree (f, v);
     75    }
     76
     77    if (reord)
     78      retvalue= swapvar (f, vg, v);
     79    else
     80      retvalue= f;
     81
     82    return retvalue;
     83  }
     84}
     85
     86static
     87CanonicalForm
     88Prem( const CanonicalForm &f, const CFList &L)
     89{
     90  CanonicalForm rem= f;
     91  CFListIterator i= L;
     92
     93  for (i.lastItem(); i.hasItem(); i--)
     94    rem= normalize (Prem (rem, i.getItem()));
     95
     96  return rem;
     97}
     98
     99static
     100CanonicalForm
     101Prem (const CanonicalForm &f, const CFList &L, const CFList &as)
     102{
     103  CanonicalForm rem = f;
     104  CFListIterator i = L;
     105  for ( i.lastItem(); i.hasItem(); i-- )
     106    rem = Prem( rem, i.getItem() );
     107  return normalize (rem); //TODO better normalize in case as.length() == 1 && as.getFirst().level() == 1 ???
     108}
     109
     110CFFList
     111myappend( const CFFList & Inputlist, const CFFactor & TheFactor)
     112{
     113  CFFList Outputlist ;
     114  CFFactor copy;
     115  CFFListIterator i;
     116  int exp=0;
     117
     118  for ( i=Inputlist ; i.hasItem() ; i++ )
     119  {
     120    copy = i.getItem();
     121    if ( copy.factor() == TheFactor.factor() )
     122      exp += copy.exp();
     123    else
     124      Outputlist.append(copy);
     125  }
     126  Outputlist.append( CFFactor(TheFactor.factor(), exp + TheFactor.exp()));
     127  return Outputlist;
     128}
     129
     130CFFList
     131myUnion(const CFFList & Inputlist1,const CFFList & Inputlist2)
     132{
     133  CFFList Outputlist;
     134  CFFListIterator i;
     135
     136  for ( i=Inputlist1 ; i.hasItem() ; i++ )
     137    Outputlist = myappend(Outputlist, i.getItem() );
     138  for ( i=Inputlist2 ; i.hasItem() ; i++ )
     139    Outputlist = myappend(Outputlist, i.getItem() );
     140
     141  return Outputlist;
     142}
    27143
    28144///////////////////////////////////////////////////////////////
     
    34150{
    35151  FFRandom gen;
    36   if (degree (Extension) < 0)
    37     factoryError("libfac: evaluate: Extension not inFF() or inGF() !");
     152  /*if (degree (Extension) < 0)
     153    factoryError("libfac: evaluate: Extension not inFF() or inGF() !");*/
    38154  return find_irreducible( degree_of_Extension, gen, Variable(1) );
    39155}
     
    64180{
    65181    current++;
     182}
     183
     184int hasAlgVar(const CanonicalForm &f, const Variable &v)
     185{
     186  if (f.inBaseDomain()) return 0;
     187  if (f.inCoeffDomain())
     188  {
     189    if (f.mvar()==v) return 1;
     190    return hasAlgVar(f.LC(),v);
     191  }
     192  if (f.inPolyDomain())
     193  {
     194    if (hasAlgVar(f.LC(),v)) return 1;
     195    for( CFIterator i=f; i.hasTerms(); i++)
     196    {
     197      if (hasAlgVar(i.coeff(),v)) return 1;
     198    }
     199  }
     200  return 0;
     201}
     202
     203int hasVar(const CanonicalForm &f, const Variable &v)
     204{
     205  if (f.inBaseDomain()) return 0;
     206  if (f.inCoeffDomain())
     207  {
     208    if (f.mvar()==v) return 1;
     209    return hasAlgVar(f.LC(),v);
     210  }
     211  if (f.inPolyDomain())
     212  {
     213    if (f.mvar()==v) return 1;
     214    if (hasVar(f.LC(),v)) return 1;
     215    for( CFIterator i=f; i.hasTerms(); i++)
     216    {
     217      if (hasVar(i.coeff(),v)) return 1;
     218    }
     219  }
     220  return 0;
     221}
     222
     223int hasAlgVar(const CanonicalForm &f)
     224{
     225  if (f.inBaseDomain()) return 0;
     226  if (f.inCoeffDomain())
     227  {
     228    if (f.level()!=0)
     229      return 1;
     230    return hasAlgVar(f.LC());
     231  }
     232  if (f.inPolyDomain())
     233  {
     234    if (hasAlgVar(f.LC())) return 1;
     235    for( CFIterator i=f; i.hasTerms(); i++)
     236    {
     237      if (hasAlgVar(i.coeff())) return 1;
     238    }
     239  }
     240  return 0;
     241}
     242
     243/// pseudo division of f and g wrt. x s.t. multiplier*f=q*g+r
     244void
     245psqr (const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q,
     246      CanonicalForm & r, CanonicalForm& multiplier, const Variable& x)
     247{
     248    ASSERT( x.level() > 0, "type error: polynomial variable expected" );
     249    ASSERT( ! g.isZero(), "math error: division by zero" );
     250
     251    // swap variables such that x's level is larger or equal
     252    // than both f's and g's levels.
     253    Variable X;
     254    if (f.level() > g.level())
     255      X= f.mvar();
     256    else
     257      X= g.mvar();
     258    if (X.level() < x.level())
     259      X= x;
     260    CanonicalForm F= swapvar (f, x, X);
     261    CanonicalForm G= swapvar (g, x, X);
     262
     263    // now, we have to calculate the pseudo remainder of F and G
     264    // w.r.t. X
     265    int fDegree= degree (F, X);
     266    int gDegree= degree (G, X);
     267    if (fDegree < 0 || fDegree < gDegree)
     268    {
     269      q= 0;
     270      r= f;
     271    }
     272    else
     273    {
     274      CanonicalForm LCG= LC (G, X);
     275      multiplier= power (LCG, fDegree - gDegree + 1);
     276      divrem (multiplier*F, G, q, r);
     277      q= swapvar (q, x, X);
     278      r= swapvar (r, x, X);
     279    }
     280}
     281
     282static CanonicalForm
     283Sprem ( const CanonicalForm &f, const CanonicalForm &g, CanonicalForm & m, CanonicalForm & q )
     284{
     285  CanonicalForm ff, gg, l, test, retvalue;
     286  int df, dg,n;
     287  bool reord;
     288  Variable vf, vg, v;
     289
     290  if ( (vf = f.mvar()) < (vg = g.mvar()) )
     291  {
     292    m=CanonicalForm(0); q=CanonicalForm(0);
     293    return f;
     294  }
     295  else
     296  {
     297    if ( vf == vg )
     298    {
     299      ff = f; gg = g;
     300      reord = false;
     301      v = vg; // == x
     302    }
     303    else
     304    {
     305      v = Variable(level(f.mvar()) + 1);
     306      ff = swapvar(f,vg,v); // == r
     307      gg = swapvar(g,vg,v); // == v
     308      reord=true;
     309    }
     310    dg = degree( gg, v ); // == dv
     311    df = degree( ff, v ); // == dr
     312    if (dg <= df) {l=LC(gg); gg = gg -LC(gg)*power(v,dg);}
     313    else { l = 1; }
     314    n= 0;
     315    while ( ( dg <= df  ) && ( !ff.isZero()) )
     316    {
     317      test= power(v,df-dg) * gg * LC(ff);
     318      if ( df == 0 ){ff= ff.genZero();}
     319      else {ff= ff - LC(ff)*power(v,df);}
     320      ff = l*ff-test;
     321      df= degree(ff,v);
     322      n++;
     323    }
     324    if ( reord )
     325    {
     326      retvalue= swapvar( ff, vg, v );
     327    }
     328    else
     329    {
     330      retvalue= ff;
     331    }
     332    m= power(l,n);
     333    if ( fdivides(g,m*f-retvalue) )
     334      q= (m*f-retvalue)/g;
     335    else
     336      q= CanonicalForm(0);
     337    return retvalue;
     338  }
     339}
     340
     341CanonicalForm
     342divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as)
     343{
     344  CanonicalForm r,m,q;
     345
     346  if (f.inCoeffDomain())
     347  {
     348    bool isRat=isOn(SW_RATIONAL);
     349    if (getCharacteristic() == 0)
     350      On(SW_RATIONAL);
     351    q=ff/f;
     352    if (!isRat && getCharacteristic() == 0)
     353      Off(SW_RATIONAL);
     354  }
     355  else
     356    r= Sprem(ff,f,m,q);
     357
     358  r= Prem(q,as);
     359  return r;
     360}
     361
     362CanonicalForm
     363alg_content (const CanonicalForm& f, const CFList& as)
     364{
     365  if (!f.inCoeffDomain())
     366  {
     367    CFIterator i= f;
     368    CanonicalForm result= abs (i.coeff());
     369    i++;
     370    while (i.hasTerms() && !result.isOne())
     371    {
     372      result= alg_gcd (i.coeff(), result, as);
     373      i++;
     374    }
     375    return result;
     376  }
     377
     378  return abs (f);
     379}
     380
     381CanonicalForm alg_gcd(const CanonicalForm & fff, const CanonicalForm &ggg,
     382                      const CFList &as)
     383{
     384  if (fff.inCoeffDomain() || ggg.inCoeffDomain())
     385    return 1;
     386  CanonicalForm f=fff;
     387  CanonicalForm g=ggg;
     388  f=Prem(f,as);
     389  g=Prem(g,as);
     390  if ( f.isZero() )
     391  {
     392    if ( g.lc().sign() < 0 ) return -g;
     393    else                     return g;
     394  }
     395  else  if ( g.isZero() )
     396  {
     397    if ( f.lc().sign() < 0 ) return -f;
     398    else                     return f;
     399  }
     400
     401  int v= as.getLast().level();
     402  if (f.level() <= v || g.level() <= v)
     403    return 1;
     404
     405  CanonicalForm res;
     406
     407  // does as appear in f and g ?
     408  bool has_alg_var=false;
     409  for ( CFListIterator j=as;j.hasItem(); j++ )
     410  {
     411    Variable v=j.getItem().mvar();
     412    if (hasVar (f, v))
     413      has_alg_var=true;
     414    if (hasVar (g, v))
     415      has_alg_var=true;
     416  }
     417  if (!has_alg_var)
     418  {
     419    /*if ((hasAlgVar(f))
     420    || (hasAlgVar(g)))
     421    {
     422      Varlist ord;
     423      for ( CFListIterator j=as;j.hasItem(); j++ )
     424        ord.append(j.getItem().mvar());
     425      res=algcd(f,g,as,ord);
     426    }
     427    else*/
     428    if (!hasAlgVar (f) && !hasAlgVar (g))
     429      res=gcd(f,g);
     430
     431    return res;
     432  }
     433
     434  int mvf=f.level();
     435  int mvg=g.level();
     436  if (mvg > mvf)
     437  {
     438    CanonicalForm tmp=f; f=g; g=tmp;
     439    int tmp2=mvf; mvf=mvg; mvg=tmp2;
     440  }
     441  if (g.inBaseDomain() || f.inBaseDomain())
     442    return CanonicalForm(1);
     443
     444  CanonicalForm c_f= alg_content (f, as);
     445
     446  if (mvf != mvg)
     447  {
     448    res= alg_gcd (g, c_f, as);
     449    return res;
     450  }
     451  Variable x= f.mvar();
     452
     453  // now: mvf==mvg, f.level()==g.level()
     454  CanonicalForm c_g= alg_content (g, as);
     455
     456  int delta= degree (f) - degree (g);
     457
     458  f= divide (f, c_f, as);
     459  g= divide (g, c_g, as);
     460
     461  // gcd of contents
     462  CanonicalForm c_gcd= alg_gcd (c_f, c_g, as);
     463  CanonicalForm tmp;
     464
     465  if (delta < 0)
     466  {
     467    tmp= f;
     468    f= g;
     469    g= tmp;
     470    delta= -delta;
     471  }
     472
     473  CanonicalForm r= 1;
     474
     475  while (degree (g, x) > 0)
     476  {
     477    r= Prem (f, g, as);
     478    r= Prem (r, as);
     479    if (!r.isZero())
     480    {
     481      r= divide (r, alg_content (r,as), as);
     482      r /= vcontent (r,Variable (v+1));
     483    }
     484    f= g;
     485    g= r;
     486  }
     487
     488  if (degree (g, x) == 0)
     489    return c_gcd;
     490
     491  c_f= alg_content (f, as);
     492
     493  f= divide (f, c_f, as);
     494
     495  f *= c_gcd;
     496  f /= vcontent (f, Variable (v+1));
     497
     498  return f;
    66499}
    67500
     
    112545  CFFListIterator i;
    113546
    114   DEBOUTLN(CERR, "sqrf_norm_sub:      f= ", f);
    115   DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    116547  myrandom.reset();   s=myrandom.item();   g=f;
    117548  R= CanonicalForm(0);
    118   DEBOUTLN(CERR, "sqrf_norm_sub: myrandom s= ", s);
    119549
    120550  // Norm, resultante taken with respect to y
    121551  while ( !sqfreetest )
    122552  {
    123     DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    124553    R = resultante(Palpha, g, y); R= R* bCommonDen(R);
    125     DEBOUTLN(CERR, "sqrf_norm_sub: R= ", R);
    126554    R /= content (R);
    127555    // sqfree check ; R is a polynomial in K[x]
     
    129557    {
    130558      temp= gcd(R, R.deriv(vf));
    131       DEBOUTLN(CERR, "sqrf_norm_sub: temp= ", temp);
    132559      if (degree(temp,vf) != 0 || temp == temp.genZero() )
    133560        sqfreetest= 0;
    134561      else
    135562        sqfreetest= 1;
    136       DEBOUTLN(CERR, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
    137563    }
    138564    else
    139565    {
    140       DEBOUTMSG(CERR, "Starting SqrFreeTest(R)!");
    141       // Look at SqrFreeTest!
    142       // (z+a^5+w)^4 with z<w<a should not give sqfreetest=1 !
    143       // for now we use this workaround with Factorize...
    144       // ...but it should go away soon!!!!
    145566      Variable X;
    146567      if (hasFirstAlgVar(R,X))
     
    148569      else
    149570        testlist= factorize(R);
    150       DEBOUTLN(CERR, "testlist= ", testlist);
     571
    151572      if (testlist.getFirst().factor().inCoeffDomain())
    152573        testlist.removeFirst();
     
    160581        }
    161582      }
    162       DEBOUTLN(CERR, "SqrFreeTest(R)= ", sqfreetest);
    163583    }
    164584    if ( ! sqfreetest )
    165585    {
    166586      myrandom.next();
    167       DEBOUTLN(CERR, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
    168587      if ( getCharacteristic() == 0 )
    169588        t= CanonicalForm(mapinto(myrandom.item()));
     
    171590        t= CanonicalForm(myrandom.item());
    172591      s= t;
    173       DEBOUTLN(CERR, "sqrf_norm_sub: testing s= ", s);
    174592      g= f(f.mvar()-t*Palpha.mvar(), f.mvar());
    175       DEBOUTLN(CERR, "             gives g= ", g);
    176593    }
    177594  }
     
    188605  CFFListIterator i;
    189606
    190   DEBOUTLN(CERR, "sqrf_norm_sub:      f= ", f);
    191   DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    192607  myrandom.reset();   s=myrandom.item();   g=f;
    193608  R= CanonicalForm(0);
    194   DEBOUTLN(CERR, "sqrf_norm_sub: myrandom s= ", s);
    195609
    196610  // Norm, resultante taken with respect to y
    197611  while ( !sqfreetest )
    198612  {
    199     DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    200613    R = resultante(Palpha, g, y); R= R* bCommonDen(R);
    201     DEBOUTLN(CERR, "sqrf_norm_sub: R= ", R);
    202614    R /= content (R);
    203615    // sqfree check ; R is a polynomial in K[x]
     
    205617    {
    206618      temp= gcd(R, R.deriv(vf));
    207       DEBOUTLN(CERR, "sqrf_norm_sub: temp= ", temp);
    208619      if (degree(temp,vf) != 0 || temp == temp.genZero() )
    209620        sqfreetest= 0;
    210621      else
    211622        sqfreetest= 1;
    212       DEBOUTLN(CERR, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
    213623    }
    214624    else
    215625    {
    216       DEBOUTMSG(CERR, "Starting SqrFreeTest(R)!");
    217       // Look at SqrFreeTest!
    218       // (z+a^5+w)^4 with z<w<a should not give sqfreetest=1 !
    219       // for now we use this workaround with Factorize...
    220       // ...but it should go away soon!!!!
    221626      Variable X;
    222627      if (hasFirstAlgVar(R,X))
     
    224629      else
    225630        testlist= factorize(R);
    226       DEBOUTLN(CERR, "testlist= ", testlist);
    227631      if (testlist.getFirst().factor().inCoeffDomain())
    228632        testlist.removeFirst();
     
    236640        }
    237641      }
    238       DEBOUTLN(CERR, "SqrFreeTest(R)= ", sqfreetest);
    239642    }
    240643    if ( ! sqfreetest )
    241644    {
    242645      myrandom.next();
    243       DEBOUTLN(CERR, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
    244646      if ( getCharacteristic() == 0 )
    245647        t= CanonicalForm(mapinto(myrandom.item()));
     
    247649        t= CanonicalForm(myrandom.item());
    248650      s= t;
    249       DEBOUTLN(CERR, "sqrf_norm_sub: testing s= ", s);
    250651      g= f(f.mvar()-t*Palpha.mvar(), f.mvar());
    251       DEBOUTLN(CERR, "             gives g= ", g);
    252652    }
    253653  }
     
    259659           CanonicalForm & R)
    260660{
    261   DEBOUTLN(CERR, "sqrf_norm:      f= ", f);
    262   DEBOUTLN(CERR, "sqrf_norm: Palpha= ", PPalpha);
    263661  if ( getCharacteristic() == 0 )
    264662  {
    265663    IntGenerator myrandom;
    266     DEBOUTMSG(CERR, "sqrf_norm: no extension, char=0");
    267664    sqrf_norm_sub(f,PPalpha, myrandom, s,g,R);
    268     DEBOUTLN(CERR, "sqrf_norm:      f= ", f);
    269     DEBOUTLN(CERR, "sqrf_norm: Palpha= ", PPalpha);
    270     DEBOUTLN(CERR, "sqrf_norm:      s= ", s);
    271     DEBOUTLN(CERR, "sqrf_norm:      g= ", g);
    272     DEBOUTLN(CERR, "sqrf_norm:      R= ", R);
    273665  }
    274666  else if ( degree(Extension) > 0 ) // working over Extensions
    275667  {
    276     DEBOUTLN(CERR, "sqrf_norm: degree of extension is ", degree(Extension));
    277668    AlgExtGenerator myrandom(Extension);
    278669    sqrf_agnorm_sub(f,PPalpha, myrandom, s,g,R);
     
    281672  {
    282673    FFGenerator myrandom;
    283     DEBOUTMSG(CERR, "sqrf_norm: degree of extension is 0");
    284674    sqrf_norm_sub(f,PPalpha, myrandom, s,g,R);
    285675  }
     
    347737      l= l+1;
    348738      if ( igcd(k,i.getItem()) == 1){
    349         DEBOUTLN(CERR, "getextension: gcd == 1, l=",l);
    350739        if ( l==length ){ setCharacteristic(charac);  return k; }
    351740      }
    352       else { DEBOUTMSG(CERR, "getextension: Next iteration"); break; }
     741      else { break; }
    353742    }
    354743    k= k+1; l=0;
    355744  }
    356745  while ( 1 );
    357 }
    358 
    359 
    360 /// pseudo division of f and g wrt. x s.t. multiplier*f=q*g+r
    361 /// but only if the leading coefficient of g is of level lower than coeffLevel
    362 void
    363 psqr (const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q,
    364       CanonicalForm & r, CanonicalForm& multiplier, const Variable& x,
    365       int coeffLevel)
    366 {
    367   ASSERT( x.level() > 0, "type error: polynomial variable expected" );
    368   ASSERT( ! g.isZero(), "math error: division by zero" );
    369 
    370   // swap variables such that x's level is larger or equal
    371   // than both f's and g's levels.
    372   Variable X;
    373   if (f.level() > g.level())
    374     X= f.mvar();
    375   else
    376     X= g.mvar();
    377   if (X.level() < x.level())
    378     X= x;
    379   CanonicalForm F= swapvar (f, x, X);
    380   CanonicalForm G= swapvar (g, x, X);
    381 
    382   // now, we have to calculate the pseudo remainder of F and G
    383   // w.r.t. X
    384   int fDegree= degree (F, X);
    385   int gDegree= degree (G, X);
    386   if (fDegree < 0 || fDegree < gDegree)
    387   {
    388     q= 0;
    389     r= f;
    390   }
    391   else
    392   {
    393     CanonicalForm LCG= LC (G, X);
    394     if (LCG.level() < coeffLevel)
    395     {
    396       multiplier= power (LCG, fDegree - gDegree + 1);
    397       divrem (multiplier*F, G, q, r);
    398       q= swapvar (q, x, X);
    399       r= swapvar (r, x, X);
    400     }
    401     else
    402     {
    403       q= 0;
    404       r= f;
    405     }
    406   }
    407 }
    408 
    409 /// pseudo division of f and g wrt. x s.t. multiplier*f=q*g+r
    410 void
    411 psqr (const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q,
    412       CanonicalForm & r, CanonicalForm& multiplier, const Variable& x)
    413 {
    414     ASSERT( x.level() > 0, "type error: polynomial variable expected" );
    415     ASSERT( ! g.isZero(), "math error: division by zero" );
    416 
    417     // swap variables such that x's level is larger or equal
    418     // than both f's and g's levels.
    419     Variable X;
    420     if (f.level() > g.level())
    421       X= f.mvar();
    422     else
    423       X= g.mvar();
    424     if (X.level() < x.level())
    425       X= x;
    426     CanonicalForm F= swapvar (f, x, X);
    427     CanonicalForm G= swapvar (g, x, X);
    428 
    429     // now, we have to calculate the pseudo remainder of F and G
    430     // w.r.t. X
    431     int fDegree= degree (F, X);
    432     int gDegree= degree (G, X);
    433     if (fDegree < 0 || fDegree < gDegree)
    434     {
    435       q= 0;
    436       r= f;
    437     }
    438     else
    439     {
    440       CanonicalForm LCG= LC (G, X);
    441       multiplier= power (LCG, fDegree - gDegree + 1);
    442       divrem (multiplier*F, G, q, r);
    443       q= swapvar (q, x, X);
    444       r= swapvar (r, x, X);
    445     }
    446746}
    447747
     
    568868  bool isRat= isOn (SW_RATIONAL);
    569869
    570   DEBOUTLN(CERR, "simpleextension: Astar= ", Astar);
    571   DEBOUTLN(CERR, "simpleextension:     R= ", R);
    572   DEBOUTLN(CERR, "simpleextension: Extension= ", Extension);
    573870  CFListIterator j;
    574871  if (Astar.length() == 1)
     
    654951      }
    655952
    656       DEBOUTLN(CERR, "simpleextension: g= ", g);
    657       DEBOUTLN(CERR, "simpleextension: s= ", s);
    658       DEBOUTLN(CERR, "simpleextension: R= ", R);
    659953      Returnlist.append (ra);
    660954      if (isFunctionField)
     
    680974    return alg_lc(f.LC());
    681975  }
    682   //assert(f.inCoeffDomain());
     976
    683977  return f;
    684978}
     
    8511145
    8521146// the heart of the algorithm: the one from Trager
    853 #ifndef DEBUGOUTPUT
    854 static CFFList
    855 alg_factor( const CanonicalForm & F, const CFList & Astar, const Variable & vminpoly, const Varlist /*& oldord*/, const CFList & as, bool isFunctionField)
    856 #else
    8571147static CFFList
    8581148alg_factor( const CanonicalForm & F, const CFList & Astar, const Variable & vminpoly, const Varlist & oldord, const CFList & as, bool isFunctionField)
    859 #endif
    8601149{
    8611150  bool isRat= isOn (SW_RATIONAL);
     
    8641153  CFList substlist, backSubsts;
    8651154
    866   DEBINCLEVEL(CERR,"alg_factor");
    867   DEBOUTLN(CERR, "alg_factor: f= ", f);
    868 
    8691155  substlist= simpleextension (backSubsts, Astar, vminpoly, isFunctionField, Rstar);
    870   DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
    871   DEBOUTLN(CERR, "alg_factor: minpoly Rstar= ", Rstar);
    872   DEBOUTLN(CERR, "alg_factor: vminpoly= ", vminpoly);
    8731156
    8741157  f= subst (f, Astar, substlist, Rstar, isFunctionField);
     
    9021185  // after here we are over an extension of a function field
    9031186
    904 
    9051187  // make quasi monic
    9061188  CFList Rstarlist= CFList (Rstar);
     
    9271209
    9281210  sqrf_norm(f, Rstar, vminpoly, s, g, R );
    929   //out_cf("sqrf_norm R:",R,"\n");
    930   //out_cf("sqrf_norm s:",s,"\n");
    931   //out_cf("sqrf_norm g:",g,"\n");
    932   DEBOUTLN(CERR, "alg_factor: g= ", g);
    933   DEBOUTLN(CERR, "alg_factor: s= ", s);
    934   DEBOUTLN(CERR, "alg_factor: R= ", R);
     1211
    9351212  Variable X;
    9361213  if (hasFirstAlgVar(R,X))
    9371214  {
    9381215    // factorize R over alg.extension with X
    939     //CERR << "alg: "<< X << " mipo=" << getMipo(X,Variable('X')) <<"\n";
    940     DEBOUTLN(CERR, "alg_factor: factorize( ", R);
    9411216    Factorlist =  factorize( R, X );
    9421217  }
     
    9441219  {
    9451220    // factor R over k
    946     DEBOUTLN(CERR, "alg_factor: Factorize( ", R);
    9471221    Factorlist = factorize(R);
    9481222  }
    9491223
    950   DEBOUTLN(CERR, "alg_factor: Factorize(R)= ", Factorlist);
    9511224  if ( !Factorlist.getFirst().factor().inCoeffDomain() )
    9521225    Factorlist.insert(CFFactor(1,1));
     
    9631236  {
    9641237    g= f;
    965     DEBOUTLN(CERR, "alg_factor: g= ", g);
    9661238    for ( CFFListIterator i=Factorlist; i.hasItem(); i++)
    9671239    {
     
    9741246        fnew= reduce (fnew, Rstar);
    9751247      }
    976 
    977       DEBOUTLN(CERR, "alg_factor: fnew= ", fnew);
    9781248
    9791249      h= alg_gcd (g, fnew, Rstarlist);
     
    10181288    LL=L;
    10191289  }
    1020   //CFFListIterator i=LL;
    1021   //for(;i.hasItem(); i++ )
    1022   //  out_cf("end alg_f:",i.getItem().factor(),"\n");
    1023   //printf("end alg_factor\n");
    1024   DEBOUTLN(CERR, "alg_factor: L= ", LL);
    1025   DEBDECLEVEL(CERR,"alg_factor");
     1290
    10261291  if (!isRat && getCharacteristic() == 0)
    10271292    Off (SW_RATIONAL);
     
    12251490
    12261491  // factor F with minimal polys given in asnew
    1227   PremForm rem;
    12281492  asnew.append (F);
    1229   asnew= mcharset (asnew, rem); // TODO use modCharSet
     1493  asnew= charSetViaModCharSet (asnew); // TODO use modCharSet
    12301494
    12311495  F= asnew.getLast();
     
    12691533  for (CFFListIterator k= tmp; k.hasItem(); k++)
    12701534  {
    1271     rem= PremForm();
    12721535    transform= transBack;
    12731536    CanonicalForm factor= k.getItem().factor();
    12741537    factor= M (factor);
    12751538    transform.append (factor);
    1276     transform= mcharset (transform, rem); //TODO use modCharSet
     1539    transform= charSetViaModCharSet (transform); //TODO use modCharSet
    12771540    for (i= transform; i.hasItem(); i++)
    12781541    {
     
    13411604
    13421605  success=1;
    1343   DEBINCLEVEL(CERR, "newfactoras");
    1344   DEBOUTLN(CERR, "newfactoras called with f= ", f);
    1345   DEBOUTLN(CERR, "               content(f)= ", content(f));
    1346   DEBOUTLN(CERR, "                       as= ", as);
    1347   DEBOUTLN(CERR, "newfactoras: cls(vf)= ", cls(vf));
    1348   DEBOUTLN(CERR, "newfactoras: cls(as.getLast())= ", cls(as.getLast()));
    1349   DEBOUTLN(CERR, "newfactoras: degree(f,vf)= ", degree(f,vf));
    13501606
    13511607// F1: [Test trivial cases]
    13521608// 1) first trivial cases:
    1353   if (cls(vf) <= cls(as.getLast()))
     1609  if (vf.level() <= as.getLast().level())
    13541610  {
    13551611// ||( (as.length()==1) && (degree(f,vf)==3) && (degree(as.getFirst()==2)) )
    1356     DEBDECLEVEL(CERR,"newfactoras");
    13571612    if (!isRat && getCharacteristic() == 0)
    13581613      Off (SW_RATIONAL);
     
    13791634  }
    13801635  uord= Difference(uord,ord);
    1381   DEBOUTLN(CERR, "Astar is: ", Astar);
    1382   DEBOUTLN(CERR, "ord is: ", ord);
    1383   DEBOUTLN(CERR, "uord is: ", uord);
    13841636
    13851637// 3) second trivial cases: we already proved irr. of f over no extensions
    13861638  if ( Astar.length() == 0 ){
    1387     DEBDECLEVEL(CERR,"newfactoras");
    13881639    if (!isRat && getCharacteristic() == 0)
    13891640      Off (SW_RATIONAL);
     
    13991650//   polynomials, we don't have transzendentals.
    14001651  Varlist newuord=Var_is_in_AS(uord,Astar);
    1401   DEBOUTLN(CERR, "newuord is: ", newuord);
    14021652
    14031653  CFFList Factorlist;
     
    14101660    Fgcd= alg_gcd(f,f.deriv(),Astar);
    14111661
    1412   if ( Fgcd == 0 ) {DEBOUTMSG(CERR, "WARNING: p'th root ?");}
    1413 
    14141662  bool derivZero= f.deriv().isZero();
    14151663  if (isFunctionField && (degree (Fgcd, f.mvar()) > 0) && !derivZero)
    14161664  {
    1417     DEBOUTLN(CERR, "Nontrivial GCD found of ", f);
    14181665    CanonicalForm Ggcd= divide(f, Fgcd,Astar);
    14191666    if (getCharacteristic() == 0)
     
    14251672      return result;
    14261673    }
    1427     DEBOUTLN(CERR, "  split into ", Fgcd);
    1428     DEBOUTLN(CERR, "         and ", Ggcd);
     1674
    14291675    Fgcd= pp(Fgcd); Ggcd= pp(Ggcd);
    1430     DEBDECLEVEL(CERR,"newfactoras");
    14311676    if (!isRat && getCharacteristic() == 0)
    14321677      Off (SW_RATIONAL);
     
    14411686    for (i=Astar; i.hasItem(); i++){degreelist.append(degree(i.getItem()));}
    14421687    int extdeg= getextension(degreelist, degree(f));
    1443     DEBOUTLN(CERR, "Extension needed of degree ", extdeg);
    14441688
    14451689    // Now the real stuff!
    14461690    if ( newuord.length() == 0 ) // no transzendentals
    14471691    {
    1448       DEBOUTMSG(CERR, "No transzendentals!");
    14491692      if ( extdeg > 1 ){
    14501693        CanonicalForm MIPO= generate_mipo( extdeg, vminpoly);
    1451         DEBOUTLN(CERR, "Minpoly produced ", MIPO);
    14521694        vminpoly= rootOf(MIPO);
    14531695      }
    14541696      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    1455       DEBDECLEVEL(CERR,"newfactoras");
    14561697      return Factorlist;
    14571698    }
    14581699    else if ( inseperable(Astar) > 0 || derivZero) // Look if extensions are seperable
    14591700    {
    1460       DEBOUTMSG(CERR, "Inseperable extensions! Using Endler!");
    14611701      Factorlist= SteelTrager(f, Astar, newuord);
    1462       DEBOUTLN(CERR, "Endler gives: ", Factorlist);
    14631702      return Factorlist;
    14641703    }
    14651704    else{ // we are on the save side: Use trager
    1466       DEBOUTMSG(CERR, "Only seperable extensions!");
    14671705      if (extdeg > 1 ){
    14681706        CanonicalForm MIPO=generate_mipo(extdeg, vminpoly );
    14691707        vminpoly= rootOf(MIPO);
    1470         DEBOUTLN(CERR, "Minpoly generated: ", MIPO);
    1471         DEBOUTLN(CERR, "vminpoly= ", vminpoly);
    1472         DEBOUTLN(CERR, "degree(vminpoly)= ", degree(vminpoly));
    14731708      }
    14741709      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    1475       DEBDECLEVEL(CERR,"newfactoras");
    14761710      return Factorlist;
    14771711    }
    14781712  }
    14791713  else{ // char=0 apply trager directly
    1480     DEBOUTMSG(CERR, "Char=0! Apply Trager!");
    14811714    Variable vminpoly;
    14821715    Factorlist= alg_factor(f, Astar, vminpoly, oldord, as, isFunctionField);
    1483     DEBDECLEVEL(CERR,"newfactoras");
    14841716    if (!isRat && getCharacteristic() == 0)
    14851717      Off (SW_RATIONAL);
     
    14871719  }
    14881720
    1489   DEBDECLEVEL(CERR,"newfactoras");
    14901721  return CFFList(CFFactor(f,1));
    14911722}
     
    15081739    return Factors;
    15091740  }
    1510   if ( cls(f) <= cls(as.getLast()) )
     1741  if (f.level() <= as.getLast().level())
    15111742  {
    15121743    if (!isRat && getCharacteristic() == 0)
  • factory/facAlgFunc.h

    r248194 r5355082  
    44////////////////////////////////////////////////////////////
    55
    6 #ifndef INCL_NEW_ALGFACTOR_H
    7 #define INCL_NEW_ALGFACTOR_H
     6#ifndef FAC_ALG_FUNC_H
     7#define FAC_ALG_FUNC_H
    88
    9 #include <factory.h>
    10 #include <tmpl_inst.h>  // for typedef's
     9#include "canonicalform.h"
    1110
    1211// missing class: IntGenerator:
     
    2625};
    2726
     27CanonicalForm alg_gcd(const CanonicalForm &, const CanonicalForm &, const CFList &);
     28/*BEGINPUBLIC*/
    2829CFFList newfactoras( const CanonicalForm & f, const CFList & as, int &success);
    29 /*BEGINPUBLIC*/
    3030CFFList newcfactor(const CanonicalForm & f, const CFList & as, int & success );
    3131/*ENDPUBLIC*/
  • factory/libfac/charset/csutil.cc

    r248194 r5355082  
    1111extern void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
    1212extern CanonicalForm alg_lc(const CanonicalForm &f);
    13 
    14 int hasAlgVar(const CanonicalForm &f, const Variable &v)
    15 {
    16   if (f.inBaseDomain()) return 0;
    17   if (f.inCoeffDomain())
    18   {
    19     if (f.mvar()==v) return 1;
    20     return hasAlgVar(f.LC(),v);
    21   }
    22   if (f.inPolyDomain())
    23   {
    24     if (hasAlgVar(f.LC(),v)) return 1;
    25     for( CFIterator i=f; i.hasTerms(); i++)
    26     {
    27       if (hasAlgVar(i.coeff(),v)) return 1;
    28     }
    29   }
    30   return 0;
    31 }
    32 
    33 int hasVar(const CanonicalForm &f, const Variable &v)
    34 {
    35   if (f.inBaseDomain()) return 0;
    36   if (f.inCoeffDomain())
    37   {
    38     if (f.mvar()==v) return 1;
    39     return hasAlgVar(f.LC(),v);
    40   }
    41   if (f.inPolyDomain())
    42   {
    43     if (f.mvar()==v) return 1;
    44     if (hasVar(f.LC(),v)) return 1;
    45     for( CFIterator i=f; i.hasTerms(); i++)
    46     {
    47       if (hasVar(i.coeff(),v)) return 1;
    48     }
    49   }
    50   return 0;
    51 }
    52 
    53 int hasAlgVar(const CanonicalForm &f)
    54 {
    55   if (f.inBaseDomain()) return 0;
    56   if (f.inCoeffDomain())
    57   {
    58     if (f.level()!=0)
    59     {
    60       //CERR << "hasAlgVar:" << f.mvar() <<"\n";
    61       return 1;
    62     }
    63     return hasAlgVar(f.LC());
    64   }
    65   if (f.inPolyDomain())
    66   {
    67     if (hasAlgVar(f.LC())) return 1;
    68     for( CFIterator i=f; i.hasTerms(); i++)
    69     {
    70       if (hasAlgVar(i.coeff())) return 1;
    71     }
    72   }
    73   return 0;
    74 }
    75 
    7613
    7714static bool
     
    278215}
    279216
    280 CanonicalForm
    281 divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as)
    282 {
    283   CanonicalForm r,m,q;
    284 
    285   //out_cf("divide f=",ff,"\n");
    286   //out_cf("divide g=",f,"\n");
    287   if (f.inCoeffDomain())
    288   {
    289     bool isRat=isOn(SW_RATIONAL);
    290     if (getCharacteristic() == 0)
    291       On(SW_RATIONAL);
    292     q=ff/f;
    293     if (!isRat && getCharacteristic() == 0)
    294       Off(SW_RATIONAL);
    295   }
    296   else
    297     r= Sprem(ff,f,m,q); //result in q, ignore r,m
    298   //CERR << "r= " << r << "  , m= " << m << "  , q= " << q << "\n";
    299   r= Prem(q,as);
    300   //CERR << "r= " << r << "\n";
    301   //out_cf(" ->",r,"\n");
    302   return r;
    303 }
    304 
    305217// This function allows as to be empty; in that case, it is equivalent
    306218// to the previous version (treating no variables as algebraic).
     
    870782#endif
    871783
    872 CanonicalForm
    873 alg_content (const CanonicalForm& f, const CFList& as)
    874 {
    875   if (!f.inCoeffDomain())
    876   {
    877     CFIterator i= f;
    878     CanonicalForm result= abs (i.coeff());
    879     i++;
    880     while (i.hasTerms() && !result.isOne())
    881     {
    882       result= alg_gcd (i.coeff(), result, as);
    883       i++;
    884     }
    885     return result;
    886   }
    887 
    888   return abs (f);
    889 }
    890 
    891 CanonicalForm alg_gcd(const CanonicalForm & fff, const CanonicalForm &ggg,
    892                       const CFList &as)
    893 {
    894   if (fff.inCoeffDomain() || ggg.inCoeffDomain())
    895     return 1;
    896   CanonicalForm f=fff;
    897   CanonicalForm g=ggg;
    898   f=Prem(f,as);
    899   g=Prem(g,as);
    900   if ( f.isZero() )
    901   {
    902     if ( g.lc().sign() < 0 ) return -g;
    903     else                     return g;
    904   }
    905   else  if ( g.isZero() )
    906   {
    907     if ( f.lc().sign() < 0 ) return -f;
    908     else                     return f;
    909   }
    910   //out_cf("alg_gcd fff(",fff," \n ");
    911   //out_cf("ggg",ggg,")\n");
    912   int v= as.getLast().level();
    913   if (f.level() <= v || g.level() <= v)
    914     return 1;
    915 
    916   CanonicalForm res;
    917   // does as appear in f and g ?
    918   bool has_alg_var=false;
    919   for ( CFListIterator j=as;j.hasItem(); j++ )
    920   {
    921     Variable v=j.getItem().mvar();
    922     if (hasVar(f,v)) {has_alg_var=true; /*break;*/}
    923     if (hasVar(g,v)) {has_alg_var=true; /*break;*/}
    924     //out_cf("as:",j.getItem(),"\n");
    925   }
    926   if (!has_alg_var)
    927   {
    928     if ((hasAlgVar(f))
    929     || (hasAlgVar(g)))
    930     {
    931       Varlist ord;
    932       for ( CFListIterator j=as;j.hasItem(); j++ )
    933         ord.append(j.getItem().mvar());
    934       res=algcd(f,g,as,ord);
    935     }
    936     else
    937       res=gcd(f,g);
    938     //out_cf("gcd=",res,"\n");
    939     //out_cf("of f=",fff," , ");
    940     //out_cf("and g=",ggg,"\n");
    941 
    942     return res;
    943   }
    944 
    945   int mvf=f.level();
    946   int mvg=g.level();
    947   if (mvg > mvf)
    948   {
    949     CanonicalForm tmp=f; f=g; g=tmp;
    950     int tmp2=mvf; mvf=mvg; mvg=tmp2;
    951   }
    952   if (g.inBaseDomain() || f.inBaseDomain())
    953   {
    954     //printf("const\n");
    955     //out_cf("of f=",fff," , ");
    956     //out_cf("and g=",ggg,"\n");
    957     return CanonicalForm(1);
    958   }
    959 
    960   // gcd of all coefficients:
    961   CanonicalForm c_f= alg_content (f, as);
    962 
    963   //printf("f.mvar=%d (%d), g.mvar=%d (%d)\n",f.level(),mvf,g.level(),mvg);
    964   if (mvf != mvg) // => mvf > mvg
    965   {
    966     res= alg_gcd (g, c_f, as);
    967     return res;
    968   }
    969   Variable x= f.mvar();
    970   // now: mvf==mvg, f.level()==g.level()
    971   // content of g
    972   CanonicalForm c_g= alg_content (g, as);
    973 
    974   int delta= degree (f) - degree (g);
    975 
    976   //f/=c_gcd;
    977   //g/=c_gcd;
    978   f= divide (f, c_f, as);
    979   g= divide (g, c_g, as);
    980 
    981   // gcd of contents
    982   CanonicalForm c_gcd= alg_gcd (c_f, c_g, as);
    983   CanonicalForm tmp;
    984 
    985   if (delta < 0)
    986   {
    987     tmp= f;
    988     f= g;
    989     g= tmp;
    990     delta= -delta;
    991   }
    992 
    993   CanonicalForm r=1;
    994 
    995   while (degree (g, x) > 0)
    996   {
    997     r= Prem (f, g, as);
    998     r= Prem (r, as);
    999     if (!r.isZero())
    1000     {
    1001       r= divide (r, alg_content (r,as), as);
    1002       r /= vcontent (r,Variable (v+1));
    1003     }
    1004     f= g;
    1005     g= r;
    1006   }
    1007 
    1008   if (degree (g, x) == 0)
    1009     return c_gcd;
    1010 
    1011   c_f= alg_content (f, as);
    1012 
    1013   f= divide (f, c_f, as);
    1014 
    1015   f *= c_gcd;
    1016   f /= vcontent (f, Variable (v+1));
    1017 
    1018   return f;
    1019 }
    1020 
     784
     785
  • factory/libfac/charset/csutil.h

    r248194 r5355082  
    5252CanonicalForm  Prem( const CanonicalForm &f, const CFList &L );
    5353CFList         Prem( const CFList &AS, const CFList &L );
    54 CanonicalForm alg_gcd(const CanonicalForm &, const CanonicalForm &, const CFList &);
    5554/*ENDPUBLIC*/
    56 CanonicalForm  divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as);
    5755CFList         remsetb( const CFList & ps, const CFList & as);
    5856CanonicalForm  lowestRank( const CFList & F );
  • factory/libfac/factor/helpstuff.cc

    r248194 r5355082  
    2121}
    2222
    23 // Now some procedures used in SqrFree and in Factor
    24 ///////////////////////////////////////////////////////////////
    25 ///////////////////////////////////////////////////////////////
    26 // We have to include a version of <CFFList>.append(CFFactor)//
    27 // and Union( CFFList, CFFList)                              //
    28 // because we have to look for multiplicities in SqrFree.    //
    29 // e.g.: SqrFree( f^3 ) with char <> 3                       //
    30 ///////////////////////////////////////////////////////////////
    31 CFFList
    32 myappend( const CFFList & Inputlist, const CFFactor & TheFactor)
    33 {
    34   CFFList Outputlist ;
    35   CFFactor copy;
    36   CFFListIterator i;
    37   int exp=0;
    38 
    39   for ( i=Inputlist ; i.hasItem() ; i++ )
    40   {
    41     copy = i.getItem();
    42     if ( copy.factor() == TheFactor.factor() )
    43       exp += copy.exp();
    44     else
    45       Outputlist.append(copy);
    46   }
    47   Outputlist.append( CFFactor(TheFactor.factor(), exp + TheFactor.exp()));
    48   return Outputlist;
    49 }
    50 
    51 CFFList
    52 myUnion(const CFFList & Inputlist1,const CFFList & Inputlist2)
    53 {
    54   CFFList Outputlist;
    55   CFFListIterator i;
    56 
    57   for ( i=Inputlist1 ; i.hasItem() ; i++ )
    58     Outputlist = myappend(Outputlist, i.getItem() );
    59   for ( i=Inputlist2 ; i.hasItem() ; i++ )
    60     Outputlist = myappend(Outputlist, i.getItem() );
    61 
    62   return Outputlist;
    63 }
    64 
  • factory/libfac/factor/helpstuff.h

    r248194 r5355082  
    99// Now some procedures used in SqrFree and in Factor
    1010///////////////////////////////////////////////////////////////
    11 CFFList myappend( const CFFList & Inputlist, const CFFactor & TheFactor) ;
    12 CFFList myUnion(const CFFList & Inputlist1,const CFFList & Inputlist2);
    1311inline int min ( const int a, const int b ){
    1412  return (a<=b ? a:b);
Note: See TracChangeset for help on using the changeset viewer.