Changeset e2ca88 in git for libfac


Ignore:
Timestamp:
May 16, 2006, 4:46:50 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
55abfc3008e047e8f26beaeb76b5bab66cfe8288
Parents:
dbcf42a937f51948f4de74902429b68c1b54592b
Message:
*hannes: gcc 4.1 fixes


git-svn-id: file:///usr/local/Singular/svn/trunk@9142 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
libfac
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • libfac/charset/alg_factor.cc

    rdbcf42a re2ca88  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: alg_factor.cc,v 1.15 2005-10-17 13:16:18 Singular Exp $";
     5static char * rcsid = "$Id: alg_factor.cc,v 1.16 2006-05-16 14:46:48 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    122122  int delta;
    123123
    124   DEBOUTLN( cout, "resultante: called  f= ", f);
    125   DEBOUTLN( cout, "resultante: called  g= ", g);
    126   DEBOUTLN( cout, "resultante: called  v= ", v);
     124  DEBOUTLN( CERR, "resultante: called  f= ", f);
     125  DEBOUTLN( CERR, "resultante: called  g= ", g);
     126  DEBOUTLN( CERR, "resultante: called  v= ", v);
    127127  if ( f.mvar() < v || g.mvar() < v ){
    128     DEBOUTMSG(cout, "resultante: f.mvar() < v || g.mvar() < v");
     128    DEBOUTMSG(CERR, "resultante: f.mvar() < v || g.mvar() < v");
    129129    return 1;
    130130  }
    131131
    132132  if ( f.degree( v ) < 1 || g.degree( v ) < 1 ){
    133     DEBOUTMSG(cout, "resultante: f.degree( v ) < 1 || g.degree( v ) < 1");
     133    DEBOUTMSG(CERR, "resultante: f.degree( v ) < 1 || g.degree( v ) < 1");
    134134    // If deg(F,v) == 0 , then resultante(F,G,v) = F^n, where n=deg(G,v)
    135135    if ( f.degree( v ) < 1 ) return power(f,degree(g,v));
     
    178178  CFFListIterator i;
    179179
    180   DEBOUTLN(cout, "sqrf_norm_sub:      f= ", f);
    181   DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     180  DEBOUTLN(CERR, "sqrf_norm_sub:      f= ", f);
     181  DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    182182  myrandom.reset();   s=f.mvar()-myrandom.item()*Palpha.mvar();   g=f;
    183183  R= CanonicalForm(0);
    184   DEBOUTLN(cout, "sqrf_norm_sub: myrandom s= ", s);
     184  DEBOUTLN(CERR, "sqrf_norm_sub: myrandom s= ", s);
    185185
    186186  // Norm, resultante taken with respect to y
    187187  while ( !sqfreetest ){
    188     DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     188    DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    189189    R = resultante(Palpha, g, y); R= R* bCommonDen(R);
    190     DEBOUTLN(cout, "sqrf_norm_sub: R= ", R);
     190    DEBOUTLN(CERR, "sqrf_norm_sub: R= ", R);
    191191    // sqfree check ; R is a polynomial in K[x]
    192192    if ( getCharacteristic() == 0 )
    193193    {
    194194      temp= gcd(R, R.deriv(vf));
    195       DEBOUTLN(cout, "sqrf_norm_sub: temp= ", temp);
     195      DEBOUTLN(CERR, "sqrf_norm_sub: temp= ", temp);
    196196      if (degree(temp,vf) != 0 || temp == temp.genZero() ){ sqfreetest= 0; }
    197197      else { sqfreetest= 1; }
    198       DEBOUTLN(cout, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
     198      DEBOUTLN(CERR, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
    199199    }
    200200    else{
    201       DEBOUTMSG(cout, "Starting SqrFreeTest(R)!");
     201      DEBOUTMSG(CERR, "Starting SqrFreeTest(R)!");
    202202      // Look at SqrFreeTest!
    203203      // (z+a^5+w)^4 with z<w<a should not give sqfreetest=1 !
     
    214214      else
    215215        testlist= Factorize(R);
    216       DEBOUTLN(cout, "testlist= ", testlist);
     216      DEBOUTLN(CERR, "testlist= ", testlist);
    217217      testlist.removeFirst();
    218218      sqfreetest=1;
    219219      for ( i=testlist; i.hasItem(); i++)
    220220        if ( i.getItem().exp() > 1 && degree(i.getItem().factor(), R.mvar()) > 0) { sqfreetest=0; break; }
    221       DEBOUTLN(cout, "SqrFreeTest(R)= ", sqfreetest);
     221      DEBOUTLN(CERR, "SqrFreeTest(R)= ", sqfreetest);
    222222    }
    223223    if ( ! sqfreetest ){
    224224      myrandom.next();
    225       DEBOUTLN(cout, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
     225      DEBOUTLN(CERR, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
    226226      if ( getCharacteristic() == 0 ) t= CanonicalForm(mapinto(myrandom.item()));
    227227      else t= CanonicalForm(myrandom.item());
    228228      s= f.mvar()+t*Palpha.mvar(); // s defines backsubstitution
    229       DEBOUTLN(cout, "sqrf_norm_sub: testing s= ", s);
     229      DEBOUTLN(CERR, "sqrf_norm_sub: testing s= ", s);
    230230      g= f(f.mvar()-t*Palpha.mvar(), f.mvar());
    231       DEBOUTLN(cout, "             gives g= ", g);
     231      DEBOUTLN(CERR, "             gives g= ", g);
    232232    }
    233233  }
     
    243243  CFFListIterator i;
    244244
    245   DEBOUTLN(cout, "sqrf_norm_sub:      f= ", f);
    246   DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     245  DEBOUTLN(CERR, "sqrf_norm_sub:      f= ", f);
     246  DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    247247  myrandom.reset();   s=f.mvar()-myrandom.item()*Palpha.mvar();   g=f;
    248248  R= CanonicalForm(0);
    249   DEBOUTLN(cout, "sqrf_norm_sub: myrandom s= ", s);
     249  DEBOUTLN(CERR, "sqrf_norm_sub: myrandom s= ", s);
    250250
    251251  // Norm, resultante taken with respect to y
    252252  while ( !sqfreetest ){
    253     DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     253    DEBOUTLN(CERR, "sqrf_norm_sub: Palpha= ", Palpha);
    254254    R = resultante(Palpha, g, y); R= R* bCommonDen(R);
    255     DEBOUTLN(cout, "sqrf_norm_sub: R= ", R);
     255    DEBOUTLN(CERR, "sqrf_norm_sub: R= ", R);
    256256    // sqfree check ; R is a polynomial in K[x]
    257257    if ( getCharacteristic() == 0 )
    258258    {
    259259      temp= gcd(R, R.deriv(vf));
    260       DEBOUTLN(cout, "sqrf_norm_sub: temp= ", temp);
     260      DEBOUTLN(CERR, "sqrf_norm_sub: temp= ", temp);
    261261      if (degree(temp,vf) != 0 || temp == temp.genZero() ){ sqfreetest= 0; }
    262262      else { sqfreetest= 1; }
    263       DEBOUTLN(cout, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
     263      DEBOUTLN(CERR, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
    264264    }
    265265    else{
    266       DEBOUTMSG(cout, "Starting SqrFreeTest(R)!");
     266      DEBOUTMSG(CERR, "Starting SqrFreeTest(R)!");
    267267      // Look at SqrFreeTest!
    268268      // (z+a^5+w)^4 with z<w<a should not give sqfreetest=1 !
     
    279279      else
    280280        testlist= Factorize(R);
    281       DEBOUTLN(cout, "testlist= ", testlist);
     281      DEBOUTLN(CERR, "testlist= ", testlist);
    282282      testlist.removeFirst();
    283283      sqfreetest=1;
    284284      for ( i=testlist; i.hasItem(); i++)
    285285        if ( i.getItem().exp() > 1 && degree(i.getItem().factor(), R.mvar()) > 0) { sqfreetest=0; break; }
    286       DEBOUTLN(cout, "SqrFreeTest(R)= ", sqfreetest);
     286      DEBOUTLN(CERR, "SqrFreeTest(R)= ", sqfreetest);
    287287    }
    288288    if ( ! sqfreetest ){
    289289      myrandom.next();
    290       DEBOUTLN(cout, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
     290      DEBOUTLN(CERR, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
    291291      if ( getCharacteristic() == 0 ) t= CanonicalForm(mapinto(myrandom.item()));
    292292      else t= CanonicalForm(myrandom.item());
    293293      s= f.mvar()+t*Palpha.mvar(); // s defines backsubstitution
    294       DEBOUTLN(cout, "sqrf_norm_sub: testing s= ", s);
     294      DEBOUTLN(CERR, "sqrf_norm_sub: testing s= ", s);
    295295      g= f(f.mvar()-t*Palpha.mvar(), f.mvar());
    296       DEBOUTLN(cout, "             gives g= ", g);
     296      DEBOUTLN(CERR, "             gives g= ", g);
    297297    }
    298298  }
     
    304304           CanonicalForm & R){
    305305
    306   DEBOUTLN(cout, "sqrf_norm:      f= ", f);
    307   DEBOUTLN(cout, "sqrf_norm: Palpha= ", PPalpha);
     306  DEBOUTLN(CERR, "sqrf_norm:      f= ", f);
     307  DEBOUTLN(CERR, "sqrf_norm: Palpha= ", PPalpha);
    308308  if ( getCharacteristic() == 0 ) {
    309309    IntGenerator myrandom;
    310     DEBOUTMSG(cout, "sqrf_norm: no extension, char=0");
     310    DEBOUTMSG(CERR, "sqrf_norm: no extension, char=0");
    311311    sqrf_norm_sub(f,PPalpha, myrandom, s,g,R);
    312     DEBOUTLN(cout, "sqrf_norm:      f= ", f);
    313     DEBOUTLN(cout, "sqrf_norm: Palpha= ", PPalpha);
    314     DEBOUTLN(cout, "sqrf_norm:      s= ", s);
    315     DEBOUTLN(cout, "sqrf_norm:      g= ", g);
    316     DEBOUTLN(cout, "sqrf_norm:      R= ", R);
     312    DEBOUTLN(CERR, "sqrf_norm:      f= ", f);
     313    DEBOUTLN(CERR, "sqrf_norm: Palpha= ", PPalpha);
     314    DEBOUTLN(CERR, "sqrf_norm:      s= ", s);
     315    DEBOUTLN(CERR, "sqrf_norm:      g= ", g);
     316    DEBOUTLN(CERR, "sqrf_norm:      R= ", R);
    317317  }
    318318  else if ( degree(Extension) > 0 ){ // working over Extensions
    319     DEBOUTLN(cout, "sqrf_norm: degree of extension is ", degree(Extension));
     319    DEBOUTLN(CERR, "sqrf_norm: degree of extension is ", degree(Extension));
    320320    AlgExtGenerator myrandom(Extension);
    321321    sqrf_agnorm_sub(f,PPalpha, myrandom, s,g,R);
     
    323323  else{
    324324    FFGenerator myrandom;
    325     DEBOUTMSG(cout, "sqrf_norm: degree of extension is 0");
     325    DEBOUTMSG(CERR, "sqrf_norm: degree of extension is 0");
    326326    sqrf_norm_sub(f,PPalpha, myrandom, s,g,R);
    327327  }
     
    396396      l= l+1;
    397397      if ( gcd0(k,i.getItem()) == 1){
    398         DEBOUTLN(cout, "getextension: gcd == 1, l=",l);
     398        DEBOUTLN(CERR, "getextension: gcd == 1, l=",l);
    399399        if ( l==length ){ setCharacteristic(charac);  return k; }
    400400      }
    401       else { DEBOUTMSG(cout, "getextension: Next iteration"); break; }
     401      else { DEBOUTMSG(CERR, "getextension: Next iteration"); break; }
    402402    }
    403403    k= k+1; l=0;
     
    414414  CanonicalForm s, g;
    415415
    416   DEBOUTLN(cout, "simpleextension: Astar= ", Astar);
    417   DEBOUTLN(cout, "simpleextension:     R= ", R);
    418   DEBOUTLN(cout, "simpleextension: Extension= ", Extension);
     416  DEBOUTLN(CERR, "simpleextension: Astar= ", Astar);
     417  DEBOUTLN(CERR, "simpleextension:     R= ", R);
     418  DEBOUTLN(CERR, "simpleextension: Extension= ", Extension);
    419419  if ( Astar.length() == 1 ){ R= Astar.getFirst();}
    420420  else{
    421421    R=Bstar.getFirst(); Bstar.removeFirst();
    422422    for ( CFListIterator i=Bstar; i.hasItem(); i++){
    423       DEBOUTLN(cout, "simpleextension: f(x)= ", i.getItem());
    424       DEBOUTLN(cout, "simpleextension: P(x)= ", R);
     423      DEBOUTLN(CERR, "simpleextension: f(x)= ", i.getItem());
     424      DEBOUTLN(CERR, "simpleextension: P(x)= ", R);
    425425      sqrf_norm(i.getItem(), R, Extension, s, g, R);
    426426      // spielt die Repraesentation eine Rolle?
    427427      // muessen wir die Nachfolger aendern, wenn s != 0 ?
    428       DEBOUTLN(cout, "simpleextension: g= ", g);
    429       if ( s != 0 ) DEBOUTLN(cout, "simpleextension: s= ", s);
    430       else DEBOUTLN(cout, "simpleextension: s= ", s);
    431       DEBOUTLN(cout, "simpleextension: R= ", R);
     428      DEBOUTLN(CERR, "simpleextension: g= ", g);
     429      if ( s != 0 ) DEBOUTLN(CERR, "simpleextension: s= ", s);
     430      else DEBOUTLN(CERR, "simpleextension: s= ", s);
     431      DEBOUTLN(CERR, "simpleextension: R= ", R);
    432432      Returnlist.insert(s);
    433433    }
     
    453453  CFList substlist;
    454454
    455   DEBINCLEVEL(cout,"alg_factor");
    456   DEBOUTLN(cout, "alg_factor: f= ", f);
     455  DEBINCLEVEL(CERR,"alg_factor");
     456  DEBOUTLN(CERR, "alg_factor: f= ", f);
    457457  //out_cf("start alg_factor:",f,"\n");
    458458  substlist= simpleextension(Astar, vminpoly, Rstar);
    459   DEBOUTLN(cout, "alg_factor: substlist= ", substlist);
    460   DEBOUTLN(cout, "alg_factor: minpoly Rstar= ", Rstar);
    461   DEBOUTLN(cout, "alg_factor: vminpoly= ", vminpoly);
     459  DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
     460  DEBOUTLN(CERR, "alg_factor: minpoly Rstar= ", Rstar);
     461  DEBOUTLN(CERR, "alg_factor: vminpoly= ", vminpoly);
    462462
    463463  sqrf_norm(f, Rstar, vminpoly, s, g, R );
     
    465465  //out_cf("sqrf_norm s:",s,"\n");
    466466  //out_cf("sqrf_norm g:",g,"\n");
    467   DEBOUTLN(cout, "alg_factor: g= ", g);
    468   DEBOUTLN(cout, "alg_factor: s= ", s);
    469   DEBOUTLN(cout, "alg_factor: R= ", R);
     467  DEBOUTLN(CERR, "alg_factor: g= ", g);
     468  DEBOUTLN(CERR, "alg_factor: s= ", s);
     469  DEBOUTLN(CERR, "alg_factor: R= ", R);
    470470  Off(SW_RATIONAL);
    471471  Variable X;
     
    473473  {
    474474    // factorize R over alg.extension with X
    475 //cout << "alg: "<< X << " mipo=" << getMipo(X,Variable('X')) <<endl;
     475//CERR << "alg: "<< X << " mipo=" << getMipo(X,Variable('X')) <<"\n";
    476476    if (R.isUnivariate())
    477477    {
    478       DEBOUTLN(cout, "alg_factor: factorize( ", R);
     478      DEBOUTLN(CERR, "alg_factor: factorize( ", R);
    479479      Factorlist =  factorize( R, X );
    480480    }
     
    485485      CanonicalForm mipo=getMipo(X,XX);
    486486      CFList as(mipo);
    487       DEBOUTLN(cout, "alg_factor: newfactoras( ", R);
     487      DEBOUTLN(CERR, "alg_factor: newfactoras( ", R);
    488488      Factorlist = newfactoras(R, as , 1);
    489489      #else
    490490      // factor R over k
    491       DEBOUTLN(cout, "alg_factor: Factorize( ", R);
     491      DEBOUTLN(CERR, "alg_factor: Factorize( ", R);
    492492      Factorlist = Factorize(R);
    493493      #endif
     
    497497  {
    498498    // factor R over k
    499     DEBOUTLN(cout, "alg_factor: Factorize( ", R);
     499    DEBOUTLN(CERR, "alg_factor: Factorize( ", R);
    500500    Factorlist = Factorize(R);
    501501  }
    502502  On(SW_RATIONAL);
    503   DEBOUTLN(cout, "alg_factor: Factorize(R)= ", Factorlist);
     503  DEBOUTLN(CERR, "alg_factor: Factorize(R)= ", Factorlist);
    504504  if ( !Factorlist.getFirst().factor().inCoeffDomain() )
    505505    Factorlist.insert(CFFactor(1,1));
     
    508508  }
    509509  else{
    510     DEBOUTLN(cout, "alg_factor: g= ", g);
     510    DEBOUTLN(CERR, "alg_factor: g= ", g);
    511511    CanonicalForm gnew= g(s,s.mvar());
    512     DEBOUTLN(cout, "alg_factor: gnew= ", gnew);
     512    DEBOUTLN(CERR, "alg_factor: gnew= ", gnew);
    513513    g=gnew;
    514514    for ( CFFListIterator i=Factorlist; i.hasItem(); i++){
    515515      CanonicalForm fnew=i.getItem().factor();
    516516      fnew= fnew(s,s.mvar());
    517       DEBOUTLN(cout, "alg_factor: fnew= ", fnew);
    518       DEBOUTLN(cout, "alg_factor: substlist= ", substlist);
     517      DEBOUTLN(CERR, "alg_factor: fnew= ", fnew);
     518      DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
    519519      for ( CFListIterator ii=substlist; ii.hasItem(); ii++){
    520         DEBOUTLN(cout, "alg_factor: item= ", ii.getItem());
     520        DEBOUTLN(CERR, "alg_factor: item= ", ii.getItem());
    521521        fnew= fnew(ii.getItem(), ii.getItem().mvar());
    522         DEBOUTLN(cout, "alg_factor: fnew= ", fnew);
     522        DEBOUTLN(CERR, "alg_factor: fnew= ", fnew);
    523523      }
    524524      if (degree(i.getItem().factor()) > 0 ){
    525525        // undo linear transformation!!!! and then gcd!
    526         //cout << "algcd(" << g << "," << fnew << ",as" << as << ")" << endl;
     526        //CERR << "algcd(" << g << "," << fnew << ",as" << as << ")" << "\n";
    527527        //out_cf("algcd g=",g,"\n");
    528528        //out_cf("algcd fnew=",fnew,"\n");
     
    534534        //out_cf(" -> algcd=",algcd(g,fnew, as, oldord),"\n");
    535535        //out_cf(" -> alg_gcd=",alg_gcd(g,fnew,as),"\n");
    536         //cout << "algcd result:" << h << endl;
    537         DEBOUTLN(cout, "  alg_factor: h= ", h);
    538         DEBOUTLN(cout, "  alg_factor: oldord= ", oldord);
     536        //CERR << "algcd result:" << h << "\n";
     537        DEBOUTLN(CERR, "  alg_factor: h= ", h);
     538        DEBOUTLN(CERR, "  alg_factor: oldord= ", oldord);
    539539        if ( degree(h) > 0 ){ //otherwise it's a constant
    540540          g= divide(g, h,as);
    541           DEBOUTLN(cout, "alg_factor: g/h= ", g);
    542           DEBOUTLN(cout, "alg_factor: s= ", s);
    543           DEBOUTLN(cout, "alg_factor: substlist= ", substlist);
     541          DEBOUTLN(CERR, "alg_factor: g/h= ", g);
     542          DEBOUTLN(CERR, "alg_factor: s= ", s);
     543          DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
    544544          L.append(CFFactor(h,1));
    545545        }
     
    575575  //  out_cf("end alg_f:",i.getItem().factor(),"\n");
    576576  //printf("end alg_factor\n");
    577   DEBOUTLN(cout, "alg_factor: L= ", LL);
    578   DEBDECLEVEL(cout,"alg_factor");
     577  DEBOUTLN(CERR, "alg_factor: L= ", LL);
     578  DEBDECLEVEL(CERR,"alg_factor");
    579579  return LL;
    580580}
     
    592592    g= i.getItem();
    593593    if (g.deriv() == 0 ){
    594       DEBOUTLN(cout, "Inseperable extension detected: ", g);
     594      DEBOUTLN(CERR, "Inseperable extension detected: ", g);
    595595      for (j=uord; j.hasItem(); j++){
    596596        if ( degree(g,j.getItem()) > 0 ) vg= j.getItem();
    597597      }
    598598      // Now we have the highest transzendental in vg;
    599       DEBOUTLN(cout, "Transzendental is ", vg);
     599      DEBOUTLN(CERR, "Transzendental is ", vg);
    600600      CanonicalForm gg=-1*g[0];
    601601      divrem(gg,vg,q,r); r= gg-q*vg;   gg= gg-r;
    602       //DEBOUTLN(cout, "q= ", q); DEBOUTLN(cout, "r= ", r);
    603       DEBOUTLN(cout, "  that is ", gg);
    604       DEBOUTLN(cout, "  maps to ", g+gg);
     602      //DEBOUTLN(CERR, "q= ", q); DEBOUTLN(CERR, "r= ", r);
     603      DEBOUTLN(CERR, "  that is ", gg);
     604      DEBOUTLN(CERR, "  maps to ", g+gg);
    605605      One.insert(gg); Two.insert(g+gg);
    606606      // Now transform all remaining polys in as:
     
    609609        if ( x != 0 ){
    610610          divrem(ii.getItem(), gg, q,r);
    611 //          cout << ii.getItem() << " divided by " << gg << endl;
    612           DEBOUTLN(cout, "q= ", q); DEBOUTLN(cout, "r= ", r);
     611//          CERR << ii.getItem() << " divided by " << gg << "\n";
     612          DEBOUTLN(CERR, "q= ", q); DEBOUTLN(CERR, "r= ", r);
    613613          ii.append(ii.getItem()+q*g); ii.remove(1);
    614           DEBOUTLN(cout, "as= ", as);
     614          DEBOUTLN(CERR, "as= ", as);
    615615        }
    616616        x+= 1;
     
    619619      divrem(F, gg, q,r);
    620620      F= F+q*g;
    621       DEBOUTLN(cout, "new F= ", F);
     621      DEBOUTLN(CERR, "new F= ", F);
    622622    }
    623623    else{ asnew.append(i.getItem());  }// just the identity
    624624  }
    625625  // factor F with minimal polys given in asnew:
    626   DEBOUTLN(cout, "Factor F=  ", F);
    627   DEBOUTLN(cout, "  with as= ", asnew);
     626  DEBOUTLN(CERR, "Factor F=  ", F);
     627  DEBOUTLN(CERR, "  with as= ", asnew);
    628628  int success=0;
    629629  CFFList factorlist= newcfactor(F,asnew, success);
    630   DEBOUTLN(cout, "  gives =  ", factorlist);
    631   DEBOUTLN(cout, "One= ", One);
    632   DEBOUTLN(cout, "Two= ", Two);
     630  DEBOUTLN(CERR, "  gives =  ", factorlist);
     631  DEBOUTLN(CERR, "One= ", One);
     632  DEBOUTLN(CERR, "Two= ", Two);
    633633
    634634  // Transform back:
     
    637637    ii=One;
    638638    for (i=Two; i.hasItem(); i++){
    639       DEBOUTLN(cout, "Mapping ", i.getItem());
    640       DEBOUTLN(cout, "     to ", ii.getItem());
    641       DEBOUTLN(cout, "     in ", factor);
     639      DEBOUTLN(CERR, "Mapping ", i.getItem());
     640      DEBOUTLN(CERR, "     to ", ii.getItem());
     641      DEBOUTLN(CERR, "     in ", factor);
    642642      divrem(factor,i.getItem(),q,r); r=factor -q*i.getItem();
    643       DEBOUTLN(cout, "q= ", q); DEBOUTLN(cout, "r= ", r);
     643      DEBOUTLN(CERR, "q= ", q); DEBOUTLN(CERR, "r= ", r);
    644644      factor= ii.getItem()*q +r; //
    645645      ii++;
     
    664664
    665665  success=1;
    666   DEBINCLEVEL(cout, "newfactoras");
    667   DEBOUTMSG(cerr, rcsid);
    668   DEBOUTLN(cout, "newfactoras called with f= ", f);
    669   DEBOUTLN(cout, "               content(f)= ", content(f));
    670   DEBOUTLN(cout, "                       as= ", as);
    671   DEBOUTLN(cout, "newfactoras: cls(vf)= ", cls(vf));
    672   DEBOUTLN(cout, "newfactoras: cls(as.getLast())= ", cls(as.getLast()));
    673   DEBOUTLN(cout, "newfactoras: degree(f,vf)= ", degree(f,vf));
     666  DEBINCLEVEL(CERR, "newfactoras");
     667  DEBOUTMSG(CERR, rcsid);
     668  DEBOUTLN(CERR, "newfactoras called with f= ", f);
     669  DEBOUTLN(CERR, "               content(f)= ", content(f));
     670  DEBOUTLN(CERR, "                       as= ", as);
     671  DEBOUTLN(CERR, "newfactoras: cls(vf)= ", cls(vf));
     672  DEBOUTLN(CERR, "newfactoras: cls(as.getLast())= ", cls(as.getLast()));
     673  DEBOUTLN(CERR, "newfactoras: degree(f,vf)= ", degree(f,vf));
    674674
    675675// F1: [Test trivial cases]
     
    677677  if ( (cls(vf) <= cls(as.getLast())) ||  degree(f,vf)<=1 ){
    678678// ||( (as.length()==1) && (degree(f,vf)==3) && (degree(as.getFirst()==2)) )
    679     DEBDECLEVEL(cout,"newfactoras");
     679    DEBDECLEVEL(CERR,"newfactoras");
    680680    return CFFList(CFFactor(f,1));
    681681  }
     
    700700  }
    701701  uord= Difference(uord,ord);
    702   DEBOUTLN(cout, "Astar is: ", Astar);
    703   DEBOUTLN(cout, "ord is: ", ord);
    704   DEBOUTLN(cout, "uord is: ", uord);
     702  DEBOUTLN(CERR, "Astar is: ", Astar);
     703  DEBOUTLN(CERR, "ord is: ", ord);
     704  DEBOUTLN(CERR, "uord is: ", uord);
    705705
    706706// 3) second trivial cases: we already prooved irr. of f over no extensions
    707707  if ( Astar.length() == 0 ){
    708     DEBDECLEVEL(cout,"newfactoras");
     708    DEBDECLEVEL(CERR,"newfactoras");
    709709    return CFFList(CFFactor(f,1));
    710710  }
     
    718718//   polynomials, we don't have transzendentals.
    719719  Varlist newuord=Var_is_in_AS(uord,Astar);
    720   DEBOUTLN(cout, "newuord is: ", newuord);
     720  DEBOUTLN(CERR, "newuord is: ", newuord);
    721721
    722722  CFFList Factorlist;
    723723  Varlist gcdord= Union(ord,newuord); gcdord.append(f.mvar());
    724724  // This is for now. we need alg_sqrfree implemented!
    725   //cout << "algcd(" << f << "," << f.deriv() << " as:" << Astar <<endl;
     725  //CERR << "algcd(" << f << "," << f.deriv() << " as:" << Astar <<"\n";
    726726  //CanonicalForm Fgcd= algcd(f,f.deriv(),Astar,gcdord);
    727727  CanonicalForm Fgcd;
     
    732732        //out_cf("algcd:",algcd(f,f.deriv(),Astar,gcdord),"\n");
    733733        //out_cf("alg_gcd:",alg_gcd(f,f.deriv(),Astar),"\n");
    734  // cout << "algcd result:"  << Fgcd << endl;
    735   if ( Fgcd == 0 ) DEBOUTMSG(cerr, "WARNING: p'th root ?");
     734 // CERR << "algcd result:"  << Fgcd << "\n";
     735  if ( Fgcd == 0 ) DEBOUTMSG(CERR, "WARNING: p'th root ?");
    736736  if (( degree(Fgcd, f.mvar()) > 0) && (!(f.deriv().isZero())) ){
    737     DEBOUTLN(cout, "Nontrivial GCD found of ", f);
     737    DEBOUTLN(CERR, "Nontrivial GCD found of ", f);
    738738    CanonicalForm Ggcd= divide(f, Fgcd,Astar);
    739     DEBOUTLN(cout, "  split into ", Fgcd);
    740     DEBOUTLN(cout, "         and ", Ggcd);
     739    DEBOUTLN(CERR, "  split into ", Fgcd);
     740    DEBOUTLN(CERR, "         and ", Ggcd);
    741741    Fgcd= pp(Fgcd); Ggcd= pp(Ggcd);
    742     DEBDECLEVEL(cout,"newfactoras");
     742    DEBDECLEVEL(CERR,"newfactoras");
    743743    return myUnion(newfactoras(Fgcd,as,success) , newfactoras(Ggcd,as,success));
    744744  }
     
    750750    for (i=Astar; i.hasItem(); i++){degreelist.append(degree(i.getItem()));}
    751751    int extdeg= getextension(degreelist, degree(f));
    752     DEBOUTLN(cout, "Extension needed of degree ", extdeg);
     752    DEBOUTLN(CERR, "Extension needed of degree ", extdeg);
    753753
    754754    // Now the real stuff!
    755755    if ( newuord.length() == 0 ){ // no transzendentals
    756       DEBOUTMSG(cout, "No transzendentals!");
     756      DEBOUTMSG(CERR, "No transzendentals!");
    757757      if ( extdeg > 1 ){
    758758        CanonicalForm MIPO= generate_mipo( extdeg, vminpoly);
    759         DEBOUTLN(cout, "Minpoly produced ", MIPO);
     759        DEBOUTLN(CERR, "Minpoly produced ", MIPO);
    760760        vminpoly= rootOf(MIPO);
    761761      }
    762762      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
    763       DEBDECLEVEL(cout,"newfactoras");
     763      DEBDECLEVEL(CERR,"newfactoras");
    764764      return Factorlist;
    765765    }
    766766    else if ( inseperable(Astar) > 0 ){ // Look if extensions are seperable
    767767      // a) Use Endler
    768       DEBOUTMSG(cout, "Inseperable extensions! Using Endler!");
     768      DEBOUTMSG(CERR, "Inseperable extensions! Using Endler!");
    769769      CFFList templist= endler(f,Astar, newuord);
    770       DEBOUTLN(cout, "Endler gives: ", templist);
     770      DEBOUTLN(CERR, "Endler gives: ", templist);
    771771      return templist;
    772772    }
    773773    else{ // we are on the save side: Use trager
    774       DEBOUTMSG(cout, "Only seperable extensions!");
     774      DEBOUTMSG(CERR, "Only seperable extensions!");
    775775      if (extdeg > 1 ){
    776776        CanonicalForm MIPO=generate_mipo(extdeg, vminpoly );
    777777        vminpoly= rootOf(MIPO);
    778         DEBOUTLN(cout, "Minpoly generated: ", MIPO);
    779         DEBOUTLN(cout, "vminpoly= ", vminpoly);
    780         DEBOUTLN(cout, "degree(vminpoly)= ", degree(vminpoly));
     778        DEBOUTLN(CERR, "Minpoly generated: ", MIPO);
     779        DEBOUTLN(CERR, "vminpoly= ", vminpoly);
     780        DEBOUTLN(CERR, "degree(vminpoly)= ", degree(vminpoly));
    781781      }
    782782      Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
    783       DEBDECLEVEL(cout,"newfactoras");
     783      DEBDECLEVEL(CERR,"newfactoras");
    784784      return Factorlist;
    785785    }
    786786  }
    787787  else{ // char=0 apply trager directly
    788     DEBOUTMSG(cout, "Char=0! Apply Trager!");
     788    DEBOUTMSG(CERR, "Char=0! Apply Trager!");
    789789    Variable vminpoly;
    790790    Factorlist= alg_factor(f, Astar, vminpoly, oldord, as);
    791       DEBDECLEVEL(cout,"newfactoras");
     791      DEBDECLEVEL(CERR,"newfactoras");
    792792      return Factorlist;
    793793  }
    794794
    795   DEBDECLEVEL(cout,"newfactoras");
     795  DEBDECLEVEL(CERR,"newfactoras");
    796796  return CFFList(CFFactor(f,1));
    797797}
     
    817817/*
    818818$Log: not supported by cvs2svn $
     819Revision 1.15  2005/10/17 13:16:18  Singular
     820*hannes: code cleanup
     821
    819822Revision 1.14  2005/07/08 09:18:15  Singular
    820823*hannes: fixed call of resultant
  • libfac/charset/algfactor.cc

    rdbcf42a re2ca88  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: algfactor.cc,v 1.6 2002-08-19 11:11:30 Singular Exp $";
     5static char * rcsid = "$Id: algfactor.cc,v 1.7 2006-05-16 14:46:48 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    8080  int nas= AS.length() +1;
    8181
    82   DEBOUTLN(cout, "charsetnA: called with ps= ", PS);
     82  DEBOUTLN(CERR, "charsetnA: called with ps= ", PS);
    8383  while ( ! RS.isEmpty() ) {
    8484    CS = BasicSet( QS );
    85     DEBOUTLN(cout, "charsetnA: CS= ", CS);
     85    DEBOUTLN(CERR, "charsetnA: CS= ", CS);
    8686    CS=Union(CS,AS);
    87     DEBOUTLN(cout, "charsetnA: CS= ", CS);
     87    DEBOUTLN(CERR, "charsetnA: CS= ", CS);
    8888    Remembern.FS1 = Union(Remembern.FS1, initalset1(CS));
    89     DEBOUTLN(cout, "charsetnA: Remembern.FS1= ", Remembern.FS1);
    90     DEBOUTLN(cout, "charsetnA: Remembern.FS2= ", Remembern.FS2);
     89    DEBOUTLN(CERR, "charsetnA: Remembern.FS1= ", Remembern.FS1);
     90    DEBOUTLN(CERR, "charsetnA: Remembern.FS2= ", Remembern.FS2);
    9191    RS = CFList();
    9292    if ( CS.length() == nas && degree(CS.getLast(),vf) > 0 ) {
    9393      CFList D = Difference( QS, CS );
    94       DEBOUT(cout, "charsetnA: Difference( ", QS);
    95       DEBOUT(cout, " , ", CS);
    96       DEBOUTLN(cout, " ) = ", D);
     94      DEBOUT(CERR, "charsetnA: Difference( ", QS);
     95      DEBOUT(CERR, " , ", CS);
     96      DEBOUTLN(CERR, " ) = ", D);
    9797      for ( CFListIterator i = D; i.hasItem(); ++i ) {
    9898        CanonicalForm r = Prem( i.getItem(), CS );
    99         DEBOUT(cout,"charsetnA: Prem(", i.getItem()  );
    100         DEBOUT(cout, ",", CS);
    101         DEBOUTLN(cout,") = ", r);
     99        DEBOUT(CERR,"charsetnA: Prem(", i.getItem()  );
     100        DEBOUT(CERR, ",", CS);
     101        DEBOUTLN(CERR,") = ", r);
    102102        if ( r != 0 ){
    103103          //removefactor( r, Remembern );
     
    106106      }
    107107      if ( ! checkok(RS,Remembern.FS2)) return CFList(CanonicalForm(1));
    108       DEBOUTLN(cout, "charsetnA: RS= ", RS);
     108      DEBOUTLN(CERR, "charsetnA: RS= ", RS);
    109109      //QS = Union( QS, RS );
    110110      QS=Union(AS,RS); QS.append(CS.getLast());
    111       DEBOUTLN(cout, "charsetnA: QS= Union(QS,RS)= ", QS);
     111      DEBOUTLN(CERR, "charsetnA: QS= Union(QS,RS)= ", QS);
    112112    }
    113113    else{ return CFList(CanonicalForm(1)); }
    114114  }
    115   DEBOUTLN(cout, "charsetnA: Removed factors: ", Remembern.FS2);
    116   DEBOUTLN(cout, "charsetnA: Remembern.FS1: ", Remembern.FS1);
     115  DEBOUTLN(CERR, "charsetnA: Removed factors: ", Remembern.FS2);
     116  DEBOUTLN(CERR, "charsetnA: Remembern.FS1: ", Remembern.FS1);
    117117
    118118  return CS;
     
    140140//   nas= as.length()+1;
    141141
    142   DEBOUTLN(cout, "algcd called with f= ", f);
    143   DEBOUTLN(cout, "                  g= ", g);
    144   DEBOUTLN(cout, "                 as= ", as);
    145   DEBOUTLN(cout, "              order= ", order);
    146   DEBOUTLN(cout, "         choosen vf= ", vf);
     142  DEBOUTLN(CERR, "algcd called with f= ", f);
     143  DEBOUTLN(CERR, "                  g= ", g);
     144  DEBOUTLN(CERR, "                 as= ", as);
     145  DEBOUTLN(CERR, "              order= ", order);
     146  DEBOUTLN(CERR, "         choosen vf= ", vf);
    147147
    148148  // check trivial case:
    149149  if ( degree(f, order.getLast())==0 || degree(g, order.getLast())==0)
    150150  {
    151     DEBOUTLN(cout, "algcd Result= ", 1);
     151    DEBOUTLN(CERR, "algcd Result= ", 1);
    152152    return CanonicalForm(1);
    153153  }
     
    156156  PremForm Remembern;
    157157  CFList cs=charsetnA(as,bs,Remembern,vf);
    158   DEBOUTLN(cout, "CharSetA((as,bs))= ", cs);
     158  DEBOUTLN(CERR, "CharSetA((as,bs))= ", cs);
    159159
    160160//    for ( VarlistIterator i=order; i.hasItem() ; i++ ){
    161 //      DEBOUTLN(cout, "vf= ", i.getItem());
    162 //      DEBOUTLN(cout, "CharSetA((as,bs))= " , charsetnA(as,bs,Remembern,i.getItem()));
     161//      DEBOUTLN(CERR, "vf= ", i.getItem());
     162//      DEBOUTLN(CERR, "CharSetA((as,bs))= " , charsetnA(as,bs,Remembern,i.getItem()));
    163163//    }
    164164
     
    180180  }
    181181  else result= CanonicalForm(1);
    182   DEBOUTLN(cout, "algcd Result= ", result);
     182  DEBOUTLN(CERR, "algcd Result= ", result);
    183183  return result;
    184184}
     
    192192  CFFList result;
    193193
    194   DEBINCLEVEL(cout, "factoras");
    195   DEBOUTMSG(cerr, rcsid);
    196   DEBOUTLN(cout, "factoras called with f= ", f);
    197   DEBOUTLN(cout, "               content(f)= ", content(f));
    198   DEBOUTLN(cout, "                       as= ", as);
    199   DEBOUTLN(cout, "factoras: cls(vf)= ", cls(vf));
    200   DEBOUTLN(cout, "factoras: cls(as.getLast())= ", cls(as.getLast()));
    201   DEBOUTLN(cout, "factoras: degree(f,vf)= ", degree(f,vf));
     194  DEBINCLEVEL(CERR, "factoras");
     195  DEBOUTMSG(CERR, rcsid);
     196  DEBOUTLN(CERR, "factoras called with f= ", f);
     197  DEBOUTLN(CERR, "               content(f)= ", content(f));
     198  DEBOUTLN(CERR, "                       as= ", as);
     199  DEBOUTLN(CERR, "factoras: cls(vf)= ", cls(vf));
     200  DEBOUTLN(CERR, "factoras: cls(as.getLast())= ", cls(as.getLast()));
     201  DEBOUTLN(CERR, "factoras: degree(f,vf)= ", degree(f,vf));
    202202
    203203// F1: [Test trivial cases]
     
    208208       ){
    209209    success=1;
    210     DEBDECLEVEL(cout,"factoras");
     210    DEBDECLEVEL(CERR,"factoras");
    211211    return CFFList(CFFactor(f,1));
    212212  }
     
    234234  }
    235235  uord= Difference(uord,ord);
    236   DEBOUTLN(cout, "Astar is: ", Astar);
    237   DEBOUTLN(cout, "ord is: ", ord);
    238   DEBOUTLN(cout, "uord is: ", uord);
     236  DEBOUTLN(CERR, "Astar is: ", Astar);
     237  DEBOUTLN(CERR, "ord is: ", ord);
     238  DEBOUTLN(CERR, "uord is: ", uord);
    239239
    240240// 3) second trivial cases
    241241  if ( Astar.length() == 0 ){
    242242    success=1;
    243     DEBDECLEVEL(cout,"factoras");
     243    DEBDECLEVEL(CERR,"factoras");
    244244    return CFFList(CFFactor(f,1));
    245245  }
     
    258258  CanonicalForm substhin=CanonicalForm(vf), substback=CanonicalForm(vf);
    259259  CanonicalForm monom;
    260   DEBOUTLN(cout, "substhin= ", substhin);
    261   DEBOUTLN(cout, "substback= ", substback);
     260  DEBOUTLN(CERR, "substhin= ", substhin);
     261  DEBOUTLN(CERR, "substback= ", substback);
    262262  int j=1;
    263263  for ( VarlistIterator jjj=ord; jjj.hasItem(); jjj++){
     
    267267    substhin-= monom; substback+= monom;
    268268  }
    269   DEBOUTLN(cout, "substhin= ", substhin);
    270   DEBOUTLN(cout, "substback= ", substback);
     269  DEBOUTLN(CERR, "substhin= ", substhin);
     270  DEBOUTLN(CERR, "substback= ", substback);
    271271  CanonicalForm fstar=f(substhin,vf);
    272   DEBOUTLN(cout, "fstar= ", fstar);
     272  DEBOUTLN(CERR, "fstar= ", fstar);
    273273
    274274// 7) Set up Variable ordering from ord,vf to vf,ord ! i.e. vf is the variable
     
    276276  Varlist nord=uord;
    277277  nord.append(vf); nord= Union(ord,nord);
    278   DEBOUTLN(cout, "          nord= ", nord);
     278  DEBOUTLN(CERR, "          nord= ", nord);
    279279  CFList Astarnord= Astar; Astarnord.insert(fstar);
    280   DEBOUTLN(cout, "     Astarnord= ", Astarnord);
     280  DEBOUTLN(CERR, "     Astarnord= ", Astarnord);
    281281  Astarnord= reorder(nord,Astarnord);
    282   DEBOUTLN(cout, "original Astar= ", Astar);
    283   DEBOUTLN(cout, "reorderd Astar= ", Astarnord);
    284   DEBOUTLN(cout, "             f= ", f);
    285   DEBOUTLN(cout, "         fstar= ", fstar);
     282  DEBOUTLN(CERR, "original Astar= ", Astar);
     283  DEBOUTLN(CERR, "reorderd Astar= ", Astarnord);
     284  DEBOUTLN(CERR, "             f= ", f);
     285  DEBOUTLN(CERR, "         fstar= ", fstar);
    286286
    287287// 8) Compute Charset Cstar of Astar \cup { fstar } wrt. ordering {vf, ord}
    288288  PremForm Remembern;
    289289  CFList Cstar= MCharSetN(Astarnord, Remembern);
    290   DEBOUTLN(cout, " Cstar= ", Cstar );
    291   DEBOUTLN(cout, " Factors removed= ", Remembern.FS2 );
    292   DEBOUTLN(cout, " Possible Factors considered:= ", Remembern.FS1 );
    293   DEBOUTLN(cout, " Reorderd Cstar= ", reorder(nord,Cstar));
     290  DEBOUTLN(CERR, " Cstar= ", Cstar );
     291  DEBOUTLN(CERR, " Factors removed= ", Remembern.FS2 );
     292  DEBOUTLN(CERR, " Possible Factors considered:= ", Remembern.FS1 );
     293  DEBOUTLN(CERR, " Reorderd Cstar= ", reorder(nord,Cstar));
    294294
    295295// 9) Compute Delta: the set of all irr. factors (over K_0) of initials of
    296296//    Cstar
    297297  CFList iniset= initalset1(Cstar);
    298   DEBOUTLN(cout, "Set of initials: ", iniset);
     298  DEBOUTLN(CERR, "Set of initials: ", iniset);
    299299  CFFList Delta;
    300300  CFFList temp;
     
    306306    Delta= Union(temp,Delta);
    307307  }
    308   DEBOUTLN(cout, "Delta= ", Delta);
     308  DEBOUTLN(CERR, "Delta= ", Delta);
    309309
    310310// 10) Compute Psi: the irreduzible factors (over K_0) of the first polynomial
     
    315315  Psi.removeFirst();
    316316  Psi= myDifference(Psi,Delta);
    317   DEBOUTLN(cout, "Psi= ", Psi);
     317  DEBOUTLN(CERR, "Psi= ", Psi);
    318318
    319319// F3: [Test quasilinearity]
     
    322322// else D.nextpoint() -> F2
    323323  if ( isquasilinear(Cstar) ) {
    324     DEBOUTLN(cout, "Cstar is quasilinear; going to F4, Cstar= ", Cstar);
     324    DEBOUTLN(CERR, "Cstar is quasilinear; going to F4, Cstar= ", Cstar);
    325325    goto F4;
    326326  }
     
    328328    Delta= Union(Psi,Delta);
    329329    Psi= CFFList();
    330     DEBOUTMSG(cout, "Psi.length() == 1; going to F4");
     330    DEBOUTMSG(CERR, "Psi.length() == 1; going to F4");
    331331    goto F4;
    332332  }
    333333  else{
    334334    D.nextpoint();
    335     DEBOUTMSG(cout, "Choosing next evaluation point. going to F2");
     335    DEBOUTMSG(CERR, "Choosing next evaluation point. going to F2");
    336336    goto F2;
    337337  }
     
    341341  Delta= reorder(nord,Delta);
    342342  Psi= reorder(nord,Psi);
    343   DEBOUTLN(cout, "Reordered: Delta= ", Delta);
    344   DEBOUTLN(cout, "             Psi= ", Psi);
     343  DEBOUTLN(CERR, "Reordered: Delta= ", Delta);
     344  DEBOUTLN(CERR, "             Psi= ", Psi);
    345345  CanonicalForm fp;
    346346
    347   DEBOUTMSG(cout, "Testing Psi: this gives irreducible Factors!");
     347  DEBOUTMSG(CERR, "Testing Psi: this gives irreducible Factors!");
    348348  for (jj=Psi; jj.hasItem(); jj++){
    349349    if ( degree(g,vf) == 1 ) { // g is linear
     
    351351    }
    352352    fp= jj.getItem().factor();
    353     DEBOUT(cout, "Calculating fp= gcd(", g);
    354     DEBOUT(cout, ",", fp(substback,vf));
    355     DEBOUT(cout, ") over K_r wrt ", vf);
     353    DEBOUT(CERR, "Calculating fp= gcd(", g);
     354    DEBOUT(CERR, ",", fp(substback,vf));
     355    DEBOUT(CERR, ") over K_r wrt ", vf);
    356356    fp=alg_gcd(g,fp(substback,vf), as);
    357357    //fp= algcd(g,fp(substback,vf), as, oldord);
    358     DEBOUTLN(cout, " = ", fp);
     358    DEBOUTLN(CERR, " = ", fp);
    359359    if ( degree(fp,vf) > 0 ){ //otherwise it's a constant
    360360      g= divide(g, fp,as);
    361       DEBOUTLN(cout, "f/fp= ", g);
     361      DEBOUTLN(CERR, "f/fp= ", g);
    362362      result.append(CFFactor(fp,1));
    363363    }
    364364  }
    365365
    366   DEBOUTMSG(cout, "Testing Delta: this gives Factors (not nec. irreduzible!)");
     366  DEBOUTMSG(CERR, "Testing Delta: this gives Factors (not nec. irreduzible!)");
    367367  for (jj=Delta; jj.hasItem(); jj++){
    368368    if ( degree(g,vf) <= 1 ) { // g is linear (or a constant..)
     
    370370    }
    371371    fp= jj.getItem().factor();
    372     DEBOUT(cout, "Calculating fp= gcd(", g);
    373     DEBOUT(cout, ",", fp(substback,vf));
    374     DEBOUT(cout, ") over K_r wrt ", vf);
     372    DEBOUT(CERR, "Calculating fp= gcd(", g);
     373    DEBOUT(CERR, ",", fp(substback,vf));
     374    DEBOUT(CERR, ") over K_r wrt ", vf);
    375375    fp= alg_gcd(g,fp(substback,vf), as);
    376376    //fp= algcd(g,fp(substback,vf), as, oldord);
    377     DEBOUTLN(cout, " = ", fp);
     377    DEBOUTLN(CERR, " = ", fp);
    378378    if ( degree(fp,vf) > 0 ){ //otherwise it's a constant
    379379      g= divide(g, fp,as);
    380       DEBOUTLN(cout, "f/fp= ", g);
     380      DEBOUTLN(CERR, "f/fp= ", g);
    381381//      reduceresult.append(fp); // a facctor but not nec. irreduzible
    382382      result.append(CFFactor(fp,1));
     
    396396    if ( isquasilinear(Cstar) ){ // Cstar quasilinear => f is irreduzible
    397397      success=1;
    398       DEBDECLEVEL(cout,"factoras");
     398      DEBDECLEVEL(CERR,"factoras");
    399399      return CFFList(CFFactor(f,1));
    400400    }
    401401    else {
    402       DEBOUTMSG(cout, "Going to F2!");
     402      DEBOUTMSG(CERR, "Going to F2!");
    403403      D.nextpoint(); // choose a new set of int's.
    404404      goto F2;
     
    408408  success=1;
    409409  result.append(CFFactor(g,1)); //append the rest
    410   DEBDECLEVEL(cout,"factoras");
     410  DEBDECLEVEL(CERR,"factoras");
    411411  return result;
    412412}
     
    426426  success=1;
    427427  for ( CFFListIterator i=Factors; i.hasItem(); i++ ){
    428     CFFList coutput=factoras(i.getItem().factor(),as,csuccess);
     428    CFFList CERR=factoras(i.getItem().factor(),as,csuccess);
    429429    success= min(success,csuccess);
    430     for ( CFFListIterator j=coutput; j.hasItem(); j++)
     430    for ( CFFListIterator j=CERR; j.hasItem(); j++)
    431431      Output = myappend(Output,CFFactor(j.getItem().factor(),j.getItem().exp()*i.getItem().exp()));
    432432  }
     
    450450/*
    451451$Log: not supported by cvs2svn $
     452Revision 1.6  2002/08/19 11:11:30  Singular
     453* hannes/pfister: alg_gcd etc.
     454
    452455Revision 1.5  2001/06/27 13:58:05  Singular
    453456*hannes/GP: debug newfactoras, char_series, ...
  • libfac/charset/charset.cc

    rdbcf42a re2ca88  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: charset.cc,v 1.10 2002-08-19 11:11:31 Singular Exp $";
     4static char * rcsid = "$Id: charset.cc,v 1.11 2006-05-16 14:46:49 Singular Exp $";
    55/////////////////////////////////////////////////////////////
    66// FACTORY - Includes
    77#include <factory.h>
     8#ifdef HAVE_IOSTREAM
     9#define CIN std::cin
     10#else
     11#define CIN cin
     12#endif
    813// Factor - Includes
    914#include <SqrFree.h>
     
    5560    int cb;
    5661
    57     DEBOUTLN(cout, "BasicSet: called with ps= ", PS);
     62    DEBOUTLN(CERR, "BasicSet: called with ps= ", PS);
    5863    if ( PS.length() < 2 ) return PS;
    5964    while ( ! QS.isEmpty() ) {
    6065        b = lowestRank( QS );
    6166        cb = rank( b );
    62         DEBOUTLN(cout, "BasicSet: choose b  = ", b);
    63         DEBOUTLN(cout, "BasicSet: it's rank = ", cb);
     67        DEBOUTLN(CERR, "BasicSet: choose b  = ", b);
     68        DEBOUTLN(CERR, "BasicSet: it's rank = ", cb);
    6469        BS=Union(CFList(b),BS);//BS.append( b );
    6570        if ( rank( b ) == 0 )
     
    7681        }
    7782    }
    78     DEBOUTLN(cout, "BasicSet: returning bs= ", BS);
     83    DEBOUTLN(CERR, "BasicSet: returning bs= ", BS);
    7984    return BS;
    8085}
     
    109114  CFList QS = PS, RS = PS, CS, OLDCS;
    110115
    111   DEBOUTLN(cout, "MCharSetN: called with ps= ", PS);
     116  DEBOUTLN(CERR, "MCharSetN: called with ps= ", PS);
    112117  while ( ! RS.isEmpty() ) {
    113118    CS = BasicSet( QS );
    114119    OLDCS=CS;
    115     DEBOUTLN(cout, "MCharSetN: CS= ", CS);
     120    DEBOUTLN(CERR, "MCharSetN: CS= ", CS);
    116121//     if ( getNumVars(CS.getFirst()) > 1 ){
    117122//       //CS = removecontent(CS, Remembern);
    118123// #ifdef MCHARSETNDEBUG
    119 //       cout << "MCharSetN: CS= " << CS << endl;
     124//       CERR << "MCharSetN: CS= " << CS << "\n";
    120125// #endif
    121126//     }
    122127    Remembern.FS1 = Union(Remembern.FS1, initalset1(CS));
    123     DEBOUTLN(cout, "MCharSetN: Remembern.FS1= ", Remembern.FS1);
    124     DEBOUTLN(cout, "MCharSetN: Remembern.FS2= ", Remembern.FS2);
     128    DEBOUTLN(CERR, "MCharSetN: Remembern.FS1= ", Remembern.FS1);
     129    DEBOUTLN(CERR, "MCharSetN: Remembern.FS2= ", Remembern.FS2);
    125130    RS = CFList();
    126131    if ( rank( CS.getFirst() ) != 0 ) {
    127132      CFList D = Difference( QS, CS );
    128       DEBOUT(cout, "MCharSetN: Difference( ", QS);
    129       DEBOUT(cout, " , ", CS);
    130       DEBOUTLN(cout, " ) = ", D);
    131 //cout << "MCharSetN: Difference( " << QS << " , " << CS << " ) = " << D << endl;
     133      DEBOUT(CERR, "MCharSetN: Difference( ", QS);
     134      DEBOUT(CERR, " , ", CS);
     135      DEBOUTLN(CERR, " ) = ", D);
     136//CERR << "MCharSetN: Difference( " << QS << " , " << CS << " ) = " << D << "\n";
    132137      //PremForm Oldremember=Remembern;
    133138      //PremForm Newremember=Remembern;
    134139      for ( CFListIterator i = D; i.hasItem(); ++i ) {
    135140        CanonicalForm r = Prem( i.getItem(), CS );
    136         DEBOUT(cout,"MCharSetN: Prem(", i.getItem()  );
    137         DEBOUT(cout, ",", CS);
    138         DEBOUTLN(cout,") = ", r);
    139 //cout << "MCharSetN: Prem("<< i.getItem() << "," << CS << ") = " << r << endl;
     141        DEBOUT(CERR,"MCharSetN: Prem(", i.getItem()  );
     142        DEBOUT(CERR, ",", CS);
     143        DEBOUTLN(CERR,") = ", r);
     144//CERR << "MCharSetN: Prem("<< i.getItem() << "," << CS << ") = " << r << "\n";
    140145        if ( r != 0 ){
    141146          //removefactor( r, Newremember );
     
    149154      }
    150155      if ( ! checkok(RS,Remembern.FS2)) return CFList(CanonicalForm(1));
    151       DEBOUTLN(cout, "MCharSetN: RS= ", RS);
     156      DEBOUTLN(CERR, "MCharSetN: RS= ", RS);
    152157      //QS = Union( QS, RS );
    153158      QS = Union(OLDCS,RS);
    154       DEBOUTLN(cout, "MCharSetN: QS= Union(QS,RS)= ", QS);
     159      DEBOUTLN(CERR, "MCharSetN: QS= Union(QS,RS)= ", QS);
    155160    }
    156161    else{ return CFList(CanonicalForm(1)); }
    157162  }
    158   DEBOUTLN(cout, "MCharSetN: Removed factors: ", Remembern.FS2);
    159   DEBOUTLN(cout, "MCharSetN: Remembern.FS1: ", Remembern.FS1);
     163  DEBOUTLN(CERR, "MCharSetN: Removed factors: ", Remembern.FS2);
     164  DEBOUTLN(CERR, "MCharSetN: Remembern.FS1: ", Remembern.FS1);
    160165
    161166  return CS;
     
    168173  CFList rs= remsetb(Difference(PS,cs),cs);
    169174
    170   DEBOUTLN(cout, "mcharset: cs= ", cs);
    171   DEBOUTLN(cout, "mcharset: rs= ", rs);
     175  DEBOUTLN(CERR, "mcharset: cs= ", cs);
     176  DEBOUTLN(CERR, "mcharset: rs= ", rs);
    172177  if ( rs.length() > 0 )
    173178    cs= mcharset(Union(PS,Union(cs,rs)), Remembern);
     
    182187  while ( ! RS.isEmpty() ) {
    183188    CS = BasicSet( QS );
    184     DEBOUTLN(cout, "CharSet: CS= ", CS);
     189    DEBOUTLN(CERR, "CharSet: CS= ", CS);
    185190    RS = CFList();
    186191    if ( rank( CS.getFirst() ) != 0 ) {
     
    343348choosefrom(){
    344349int choice;
    345     cout << "choose from qhi! ->";
    346     cin >> choice;
     350    CERR << "choose from qhi! ->";
     351    CIN >> choice;
    347352return choice;
    348353}
     
    353358  ListCFList output;
    354359
    355   cout << "Sort: list to sort is: " <<  list_to_sort << endl;
     360  CERR << "Sort: list to sort is: " <<  list_to_sort << "\n";
    356361  for (int i=1; i<= number; i++){
    357     cout << " Next elem = "; cin >> nr;
     362    CERR << " Next elem = "; CIN >> nr;
    358363    output.append(getItemNr(nr,list_to_sort));
    359364  }
     
    379384#endif
    380385
    381   DEBOUTMSG(cout, rcsid);
    382 //  cout << getCharacteristic() << endl;
     386  DEBOUTMSG(CERR, rcsid);
     387//  CERR << getCharacteristic() << "\n";
    383388  for ( CFListIterator Ps=PS; Ps.hasItem(); Ps++ )
    384389    if ( level(Ps.getItem() ) > highestlevel ) highestlevel = level(Ps.getItem()) ;
    385390//  for ( int xx=1; xx <= highestlevel; xx++)
    386 //   cout << Variable(xx) ;
    387 //  cout << endl;
     391//   CERR << Variable(xx) ;
     392//  CERR << "\n";
    388393//  for ( CFListIterator Ps=PS; Ps.hasItem(); Ps++ )
    389 //    cout << Ps.getItem() << ", " ;//<< endl;
    390 //  cout <<  endl;
     394//    CERR << Ps.getItem() << ", " ;//<< "\n";
     395//  CERR <<  "\n";
    391396  while ( ! qhi.isEmpty() ) {
    392397    qhi=sort(qhi);
    393     DEBOUTLN(cout, "qhi is: ", qhi);
     398    DEBOUTLN(CERR, "qhi is: ", qhi);
    394399#ifdef EXPERIMENTAL
    395400    choice=choosefrom();
    396     cout <<"/n Choose " << choice << endl;
     401    CERR <<"/n Choose " << choice << "\n";
    397402    qs= getItemNr(choice, qhi);
    398403#else
    399404    qs=qhi.getFirst();
    400405#endif
    401     DEBOUTLN(cout, "qs  is: ", qs);
    402     DEBOUTLN(cout, "ppi is: ", ppi);
     406    DEBOUTLN(CERR, "qs  is: ", qs);
     407    DEBOUTLN(CERR, "ppi is: ", ppi);
    403408    ListCFList ppi1,ppi2;
    404409    select(ppi,qs.length(),ppi1,ppi2);
    405     DEBOUTLN(cout, "ppi1 is: ", ppi1);
    406     DEBOUTLN(cout, "ppi2 is: ", ppi2);
     410    DEBOUTLN(CERR, "ppi1 is: ", ppi1);
     411    DEBOUTLN(CERR, "ppi2 is: ", ppi2);
    407412    qqi = MyUnion(ppi2,qqi);
    408     DEBOUTLN(cout, "qqi is: ", qqi);
     413    DEBOUTLN(CERR, "qqi is: ", qqi);
    409414    if ( nr_of_iteration == 0 ){ nr_of_iteration += 1; ppi = ListCFList(); }
    410415    else{ nr_of_iteration += 1; ppi = MyUnion(ListCFList(qs),ppi1); }
    411     DEBOUTLN(cout,"ppi is: ", ppi);
     416    DEBOUTLN(CERR,"ppi is: ", ppi);
    412417    PremForm Remembern;
    413418    cs = MCharSetN(qs,Remembern);
    414     DEBOUTLN(cout, "cs is: ", cs);
    415     DEBOUTLN(cout, "factorset is: ", Remembern.FS2);
     419    DEBOUTLN(CERR, "cs is: ", cs);
     420    DEBOUTLN(CERR, "factorset is: ", Remembern.FS2);
    416421    cs = removecontent(cs,Remembern);
    417422    factorset=Remembern.FS2;
    418     DEBOUTLN(cout, "cs (after removecontent) is: ", cs);
    419     DEBOUTLN(cout, "factorset is: ", factorset);
     423    DEBOUTLN(CERR, "cs (after removecontent) is: ", cs);
     424    DEBOUTLN(CERR, "factorset is: ", factorset);
    420425    // Hier: removecontent einfuegen!!!!
    421426    if ( cls(cs.getFirst()) > 0 ){
     
    426431      // INTERRUPTHANDLER
    427432
    428       DEBOUTLN(cout, "ts is: ", ts);
    429       DEBOUTLN(cout, "ts2 is: ", ts2);
     433      DEBOUTLN(CERR, "ts is: ", ts);
     434      DEBOUTLN(CERR, "ts2 is: ", ts2);
    430435      // next is preliminary: should be ==0
    431436      if ( ts2 <= 0 ){ //irreducible
    432437        if ( ! subset(cs,qs) ){
    433           DEBOUTMSG(cout, "cs is not a subset of qs");
     438          DEBOUTMSG(CERR, "cs is not a subset of qs");
    434439          cs = charseta(Union(qs,cs));
    435           DEBOUTLN(cout, "new cs is: ", cs);
     440          DEBOUTLN(CERR, "new cs is: ", cs);
    436441        }
    437442        if ( ! member(cs,pi) ){
    438443          pi = MyUnion(pi, ListCFList(cs));
    439           DEBOUTMSG(cout, "cs is not a member of pi");
    440           DEBOUTLN(cout, "pi is: ", pi);
     444          DEBOUTMSG(CERR, "cs is not a member of pi");
     445          DEBOUTLN(CERR, "pi is: ", pi);
    441446          if ( cls(cs.getFirst()) > 0 ){
    442447            ts = irras(cs,ts2,reducible);
     
    446451            // INTERRUPTHANDLER
    447452
    448             DEBOUTLN(cout, "ts is: ", ts);
    449             DEBOUTLN(cout, "ts2 is: ", ts2);
     453            DEBOUTLN(CERR, "ts is: ", ts);
     454            DEBOUTLN(CERR, "ts2 is: ", ts2);
    450455            // next is preliminary: should be ==0
    451456            if ( ts2 <= 0 ){ //irreducible
    452457              qsi = MyUnion(qsi,ListCFList(cs));
    453               DEBOUTLN(cout, "qsi is: ", qsi);
     458              DEBOUTLN(CERR, "qsi is: ", qsi);
    454459              if ( cs.length() == highestlevel ){
    455                 DEBOUTLN(cout, "cs.length() == nops(ord) :", cs.length());
     460                DEBOUTLN(CERR, "cs.length() == nops(ord) :", cs.length());
    456461                is = factorps(factorset);
    457462              }
    458463              else{
    459                 DEBOUT(cout,"cs.length() != nops(ord) :", cs.length());
    460                 DEBOUTLN(cout, "  nops(ord)= ", highestlevel);
     464                DEBOUT(CERR,"cs.length() != nops(ord) :", cs.length());
     465                DEBOUTLN(CERR, "  nops(ord)= ", highestlevel);
    461466                is = Union(initalset1(cs),factorps(factorset));
    462467              }
    463               DEBOUTLN(cout, "is is: ", is);
     468              DEBOUTLN(CERR, "is is: ", is);
    464469              iss = adjoin(is,qs,qqi);
    465               DEBOUTLN(cout, "iss is: ", iss);
     470              DEBOUTLN(CERR, "iss is: ", iss);
    466471            }
    467472          }
     
    469474        }
    470475        else{
    471           DEBOUTMSG(cout, "cs is a member of pi");
     476          DEBOUTMSG(CERR, "cs is a member of pi");
    472477          iss = adjoin(factorps(factorset),qs,qqi); }
    473         DEBOUTLN(cout, "iss is: ", iss);
    474         DEBOUTLN(cout, "   factorps(factorset)= ", factorps(factorset));
    475         DEBOUTLN(cout, "   qs= ", qs);
    476         DEBOUTLN(cout, "   qqi= ", qqi);
     478        DEBOUTLN(CERR, "iss is: ", iss);
     479        DEBOUTLN(CERR, "   factorps(factorset)= ", factorps(factorset));
     480        DEBOUTLN(CERR, "   qs= ", qs);
     481        DEBOUTLN(CERR, "   qqi= ", qqi);
    477482      }
    478483      // next is preliminary: should be !=0
    479484      if ( ts2 > 0 ){
    480485        is = factorps(factorset);
    481         DEBOUTLN(cout, "is is: ", is);
     486        DEBOUTLN(CERR, "is is: ", is);
    482487        if ( ts2 > 1 ){
    483488          // setup cst: need it later for adjoinb
     
    491496        }
    492497        else{ iss = adjoin(Union(is,ts),qs,qqi); }
    493         DEBOUTLN(cout, "iss is: ", iss);
     498        DEBOUTLN(CERR, "iss is: ", iss);
    494499      }
    495500    }
    496501    else{
    497502      iss = adjoin(factorps(factorset),qs,qqi);
    498       DEBOUTMSG(cout, "case: cs is a constant.");
    499       DEBOUTLN(cout, "  qs = ", qs);
    500       DEBOUTLN(cout, "  qqi = ", qqi);
    501       DEBOUTLN(cout, "  iss = adjoin(factorps(factorset),qs,qqi) = ",iss);
     503      DEBOUTMSG(CERR, "case: cs is a constant.");
     504      DEBOUTLN(CERR, "  qs = ", qs);
     505      DEBOUTLN(CERR, "  qqi = ", qqi);
     506      DEBOUTLN(CERR, "  iss = adjoin(factorps(factorset),qs,qqi) = ",iss);
    502507    }
    503508    if ( qhi.length() > 1 ){ qhi.removeFirst(); qhi = MyUnion(qhi,iss); }
    504509    else{ qhi = iss; }
    505     DEBOUTLN(cout, "iss is: ", iss);
     510    DEBOUTLN(CERR, "iss is: ", iss);
    506511  }
    507512  if ( ! qsi.isEmpty() ){
    508     DEBOUTLN(cout, "qsi before contract= ", qsi);
     513    DEBOUTLN(CERR, "qsi before contract= ", qsi);
    509514    if ( opt == 0 ){
    510515       return contract( qsi );
     
    534539
    535540  ja = 0;
    536   DEBOUTLN(cout, "irras: called with: AS= ", AS);
     541  DEBOUTLN(CERR, "irras: called with: AS= ", AS);
    537542  for ( i=AS; i.hasItem(); i++ ){
    538543    elem = i.getItem();
    539544    nr += 1;
    540     DEBOUT(cout, "irras: factoring: ", elem);
     545    DEBOUT(CERR, "irras: factoring: ", elem);
    541546    if ( degree(elem) > 1 ) // linear poly's are irreduzible
    542547    {
     
    547552      qs.insert(CFFactor(CanonicalForm(1),1));
    548553    }
    549     DEBOUTLN(cout, "  = ", qs);
     554    DEBOUTLN(CERR, "  = ", qs);
    550555    // INTERRUPTHANDLER
    551556    if ( interrupt_handle() ) return CFList() ;
     
    553558    qs.removeFirst();
    554559    if ( (qs.length() >= 2 ) || (qs.getFirst().exp() > 1)){
    555       DEBOUTLN(cout, "irras: Setting ind=0, ja= ", nr);
     560      DEBOUTLN(CERR, "irras: Setting ind=0, ja= ", nr);
    556561      ja=nr; ind=0; reducible= elem;
    557562      break;
     
    559564    //    else{ as.append(elem) ; }
    560565  }
    561   //  cout << "ind= " << ind << endl;
     566  //  CERR << "ind= " << ind << "\n";
    562567  if ( (ind == 1) ){ //&& ( as.length() > 1) ){
    563568    if ( irreducible(AS) ){ // as quasilinear? => irreducible!
    564569      ja = 0;
    565       DEBOUTLN(cout, "as is irreducible. as= ", AS);
     570      DEBOUTLN(CERR, "as is irreducible. as= ", AS);
    566571    }
    567572    else {
     
    572577        if ( degree(i.getItem()) > 1 ){// search for a non linear elem
    573578          elem=i.getItem();
    574 //          cout << "f=  " << elem << endl;
    575 //        cout << "as= " << as << endl;
     579//          CERR << "f=  " << elem << "\n";
     580//        CERR << "as= " << as << "\n";
    576581          qs= newfactoras(elem,as,success);
    577 //          cout << "irras:newfactoras    qs= " << qs << endl;
     582//          CERR << "irras:newfactoras    qs= " << qs << "\n";
    578583//          qs= factoras(elem,as,success);
    579 //          cout << "irras:factoras qs= " << qs << endl;
     584//          CERR << "irras:factoras qs= " << qs << "\n";
    580585          if ( qs.length() > 1 || qs.getFirst().exp() > 1 ){ //found elem is reducible
    581586            reducible=elem;
     
    594599/*
    595600$Log: not supported by cvs2svn $
     601Revision 1.10  2002/08/19 11:11:31  Singular
     602* hannes/pfister: alg_gcd etc.
     603
    596604Revision 1.9  2001/08/08 14:26:54  Singular
    597605*hannes: Dan's HAVE_SINGULAR_ERROR
  • libfac/charset/csutil.cc

    rdbcf42a re2ca88  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: csutil.cc,v 1.11 2006-05-16 13:48:13 Singular Exp $";
     4static char * rcsid = "$Id: csutil.cc,v 1.12 2006-05-16 14:46:49 Singular Exp $";
    55/////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    4848  f = i.getItem(); ++i;
    4949  while ( i.hasItem() ) {
    50     //cout << "comparing " << f << "  and " << i.getItem()
    51     // << " == " << lowerRank( i.getItem(), f, ind ) << endl;
     50    //CERR << "comparing " << f << "  and " << i.getItem()
     51    // << " == " << lowerRank( i.getItem(), f, ind ) << "\n";
    5252    if ( lowerRank( i.getItem(), f, ind ) ) {
    5353      if ( ind ){
     
    5656
    5757        // Have to further compare number of terms!
    58         //cout << "compare terms! f= " << Flist.length() << "  item= "
    59         //     << Itemlist.length() <<endl;
     58        //CERR << "compare terms! f= " << Flist.length() << "  item= "
     59        //     << Itemlist.length() <<"\n";
    6060        if ( Itemlist.length() < Flist.length()) f = i.getItem();
    6161        ind=0;
     
    129129    else { l = 1; }
    130130    while ( ( dg <= df  ) && ( ff != ff.genZero()) ){
    131       // cout << "Start gcd..." << endl;
     131      // CERR << "Start gcd..." << "\n";
    132132      test = gcd(l,LC(ff));
    133       //cout << "gcd(" << l << "," << LC(ff) << ")= " << test << endl;
     133      //CERR << "gcd(" << l << "," << LC(ff) << ")= " << test << "\n";
    134134      lu = l/test; lv = LC(ff)/test;
    135135      t = power(v,df-dg) * gg * lv;
     
    216216  else
    217217    r= Sprem(ff,f,m,q); //result in q, ignore r,m
    218   //cout << "r= " << r << "  , m= " << m << "  , q= " << q << endl;
     218  //CERR << "r= " << r << "  , m= " << m << "  , q= " << q << "\n";
    219219  r= Prem(q,as);
    220   //cout << "r= " << r << endl;
     220  //CERR << "r= " << r << "\n";
    221221  //out_cf(" ->",r,"\n");
    222222  return r;
     
    233233     On(SW_RATIONAL);
    234234     CanonicalForm temp= mapinto(rem);
    235 //      cout << "temp= " << temp << endl;
    236 //      cout << "lc(temp)= " << lc(temp) << endl;
    237 //      cout << "temp/lc(temp)= " << temp/lc(temp) << endl;
    238 //      cout << "num(rem/lc(rem))= " << num(rem/lc(rem)) << endl;
     235//      CERR << "temp= " << temp << "\n";
     236//      CERR << "lc(temp)= " << lc(temp) << "\n";
     237//      CERR << "temp/lc(temp)= " << temp/lc(temp) << "\n";
     238//      CERR << "num(rem/lc(rem))= " << num(rem/lc(rem)) << "\n";
    239239     temp= bCommonDen(temp/lc(temp))*(temp/lc(temp));
    240240     Off(SW_RATIONAL);
     
    252252  CFListIterator i = L;
    253253  for ( i.lastItem(); i.hasItem(); i-- ){
    254 //cout << "   PREM: Prem(" << rem << "," ;
     254//CERR << "   PREM: Prem(" << rem << "," ;
    255255    rem = Prem( rem, i.getItem() );
    256 //cout << "   PREM: Prem(" << rem << "," << i.getItem() << ")  = " << rem << endl;
     256//CERR << "   PREM: Prem(" << rem << "," << i.getItem() << ")  = " << rem << "\n";
    257257  }
    258258  return myfitting(rem);
     
    314314    if (!(j.coeff().isOne()) ) count += 1;
    315315  //  if ( init != 1 ){
    316   //  cout << "nopower: f is " << init << endl;
    317   //  cout << "nopower: count is " << count << endl;}
     316  //  CERR << "nopower: f is " << init << "\n";
     317  //  CERR << "nopower: count is " << count << "\n";}
    318318  if ( count > 1 ) sqrfreelist = CFFList( CFFactor(init,1));
    319319  else {
     
    395395    }
    396396  }
    397   //  cout << "Remembern.FS1 = " << Remembern.FS1 << endl;
    398   //  cout << "Remembern.FS2 = " << Remembern.FS2 << endl;
     397  //  CERR << "Remembern.FS1 = " << Remembern.FS1 << "\n";
     398  //  CERR << "Remembern.FS2 = " << Remembern.FS2 << "\n";
    399399  //  Remembern.FS1 = Difference(Remembern.FS1, Remembern.FS2);
    400   //  cout << "  New Remembern.FS1 = " << Remembern.FS1 << endl;
     400  //  CERR << "  New Remembern.FS1 = " << Remembern.FS1 << "\n";
    401401}
    402402
     
    529529// AS is given by AS = { A1, A2, .. Ar }, d_i = degree(Ai)
    530530
    531   DEBOUTMSG(cout, rcsid);
     531  DEBOUTMSG(CERR, rcsid);
    532532// 1) we test: if d_i > 1, d_j =1 for all j<>i, then AS is irreducible.
    533533  bool deg1=1;
     
    604604subset( const CFList &PS, const CFList &CS ){
    605605
    606   //  cout << "subset: called with: " << PS << "   " << CS << endl;
     606  //  CERR << "subset: called with: " << PS << "   " << CS << "\n";
    607607  for ( CFListIterator i=PS; i.hasItem(); i++ )
    608608    if ( ! member(i.getItem(), CS) ) {
    609       //      cout << "subset: " << i.getItem() << "  is not a member of " << CS << endl;
     609      //      CERR << "subset: " << i.getItem() << "  is not a member of " << CS << "\n";
    610610      return 0;
    611611    }
     
    873873/*
    874874$Log: not supported by cvs2svn $
     875Revision 1.11  2006/05/16 13:48:13  Singular
     876*hannes: gcc 4.1 fix: factory changes
     877
    875878Revision 1.10  2006/04/28 13:45:29  Singular
    876879*hannes: better tests for 0, 1
  • libfac/charset/reorder.cc

    rdbcf42a re2ca88  
    1212/////////////////////////////////////////////////////////////
    1313// emacs edit mode for this file is -*- C++ -*-
    14 static char * rcsid = "$Id: reorder.cc,v 1.3 1997-09-12 07:19:44 Singular Exp $";
     14static char * rcsid = "$Id: reorder.cc,v 1.4 2006-05-16 14:46:49 Singular Exp $";
    1515////////////////////////////////////////////////////////////
    1616// FACTORY - Includes
     
    241241  while ( gap <= n) gap = __INIT_GAP__ * gap+1;
    242242  gap /= __INIT_GAP__;
    243   DEBOUTLN(cout, "gap is ", gap);
     243  DEBOUTLN(CERR, "gap is ", gap);
    244244 
    245245  while ( gap > 0 ){
     
    249249        if (degord(v[j],temp, PS, A,B,C,D,E,F,G))  break;
    250250        v[j+gap] = v[j];
    251         //cout << "v[" << j+gap << "]= " << v[j+gap] << endl;
     251        //CERR << "v[" << j+gap << "]= " << v[j+gap] << "\n";
    252252      }
    253253      v[j+gap] = temp;
    254       //cout << "v[" << j+gap << "]= " << v[j+gap] << endl;
     254      //CERR << "v[" << j+gap << "]= " << v[j+gap] << "\n";
    255255    }
    256256    gap /= __INIT_GAP__;
     
    259259  for (i=0; i<= n-1; i++)
    260260    output.append(v[i]);
    261   DEBOUTLN(cout, "A= ", A);  DEBOUTLN(cout, "B= ", B); 
    262   DEBOUTLN(cout, "C= ", C);  DEBOUTLN(cout, "D= ", D);
    263   DEBOUTLN(cout, "E= ", E);  DEBOUTLN(cout, "F= ", F);
    264   DEBOUTLN(cout, "G= ", G);
     261  DEBOUTLN(CERR, "A= ", A);  DEBOUTLN(CERR, "B= ", B); 
     262  DEBOUTLN(CERR, "C= ", C);  DEBOUTLN(CERR, "D= ", D);
     263  DEBOUTLN(CERR, "E= ", E);  DEBOUTLN(CERR, "F= ", F);
     264  DEBOUTLN(CERR, "G= ", G);
    265265  return output;
    266266}
     
    273273  Varlist oldorder, reorder, difference;
    274274
    275   DEBINCLEVEL(cout, "neworder");
    276   DEBOUTMSG(cout, rcsid);
     275  DEBINCLEVEL(CERR, "neworder");
     276  DEBOUTMSG(CERR, rcsid);
    277277  TIMING_START(neworder_time);
    278278
    279279  int highest_level= level(get_max_var(PS));
    280   DEBOUTLN(cout, "neworder: highest_level=   ", highest_level);
    281   DEBOUTLN(cout, "neworder: that is variable ", Variable(highest_level));
     280  DEBOUTLN(CERR, "neworder: highest_level=   ", highest_level);
     281  DEBOUTLN(CERR, "neworder: that is variable ", Variable(highest_level));
    282282
    283283  // set up oldorder and first criterion: only_in_one
     
    286286    CFList is_one= only_in_one(PS1, Variable(i));
    287287    if ( is_one.length() == 1 ){
    288       DEBOUTLN(cout, "Found a variable which is in only one Polynomial: ",
     288      DEBOUTLN(CERR, "Found a variable which is in only one Polynomial: ",
    289289               Variable(i));
    290       DEBOUTLN(cout, ".... in the Polynomial: ", is_one.getFirst());
     290      DEBOUTLN(CERR, ".... in the Polynomial: ", is_one.getFirst());
    291291      reorder.insert(Variable(i));
    292292      PS1 = Difference(PS1, is_one);
    293       DEBOUTLN(cout, "New cutted list is: ", PS1);
     293      DEBOUTLN(CERR, "New cutted list is: ", PS1);
    294294    }
    295295    else if ( is_one.length() == 0 ){
    296       DEBOUTLN(cout, "Found a variable which is in no polynomial: ",
     296      DEBOUTLN(CERR, "Found a variable which is in no polynomial: ",
    297297               Variable(i));
    298       DEBOUTMSG(cout, "... assigning it the highest level.");
     298      DEBOUTMSG(CERR, "... assigning it the highest level.");
    299299      reorder.append(Variable(i)); // assigne it the highest level
    300300      PS1 = Difference(PS1, is_one);
     
    302302  }
    303303  difference = Difference(oldorder,reorder);
    304   DEBOUTLN(cout, "Missing variables are: ", difference);
     304  DEBOUTLN(CERR, "Missing variables are: ", difference);
    305305  // rearrange the ordering of the variables!
    306306  difference = reorderb(difference, PS, highest_level);
    307   DEBOUTLN(cout, "second criterion gives: ", difference);
     307  DEBOUTLN(CERR, "second criterion gives: ", difference);
    308308  reorder = Union(reorder, difference);
    309   DEBOUTLN(cout, "old order was:     ", oldorder);
    310   DEBOUTLN(cout, "New order will be: ", Union(reorder, Difference(oldorder,reorder)));
    311   DEBDECLEVEL(cout, "neworder");
     309  DEBOUTLN(CERR, "old order was:     ", oldorder);
     310  DEBOUTLN(CERR, "New order will be: ", Union(reorder, Difference(oldorder,reorder)));
     311  DEBDECLEVEL(CERR, "neworder");
    312312  TIMING_END(neworder_time);
    313313
     
    372372    v[i]= level(j.getItem()); i++;
    373373  }
    374   DEBOUTLN(cout, "reorder: Original ps=  ", ps);
     374  DEBOUTLN(CERR, "reorder: Original ps=  ", ps);
    375375  // reorder:
    376376  for (i=1; i <= n; i++)
    377377    ps=swapvar(ps,Variable(v[i]),Variable(n+i));
    378   DEBOUTLN(cout, "reorder: Reorganized ps= ", ps);
     378  DEBOUTLN(CERR, "reorder: Reorganized ps= ", ps);
    379379  return ps;
    380380}
     
    390390    v[i]= level(j.getItem()); i++;
    391391  }
    392   DEBOUTLN(cout, "reorder: Original ps=  ", ps);
     392  DEBOUTLN(CERR, "reorder: Original ps=  ", ps);
    393393  // reorder:
    394394  for (i=1; i <= n; i++)
    395395    ps=swapvar(ps,Variable(v[i]),Variable(n+i));
    396   DEBOUTLN(cout, "reorder: Reorganized ps= ", ps);
     396  DEBOUTLN(CERR, "reorder: Reorganized ps= ", ps);
    397397  return ps;
    398398}
     
    408408/*
    409409$Log: not supported by cvs2svn $
     410Revision 1.3  1997/09/12 07:19:44  Singular
     411* hannes/michael: libfac-0.3.0
     412
    410413Revision 1.2  1997/04/25 22:53:25  michael
    411414changed cerr and cout messages for use with Singular
  • libfac/factor/Factor.cc

    rdbcf42a re2ca88  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22///////////////////////////////////////////////////////////////////////////////
    3 static char * rcsid = "$Id: Factor.cc,v 1.22 2006-04-28 13:46:29 Singular Exp $ ";
     3static char * rcsid = "$Id: Factor.cc,v 1.23 2006-05-16 14:46:49 Singular Exp $ ";
    44static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de \nPlease include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you.";
    55///////////////////////////////////////////////////////////////////////////////
     
    77#include <factory.h>
    88#ifndef NOSTREAMIO
     9#ifdef HAVE_IOSTREAM
     10#include <iostream>
     11#define CERR std::cerr
     12#define CIN std::cin
     13#elif defined(HAVE_IOSTREAM_H)
    914#include <iostream.h>
     15#define CERR cerr
     16#define CIN cin
     17#endif
    1018#endif
    1119// Factor - Includes
     
    106114  remlc= LC(f,n); mainvar = n;
    107115  if ( totaldegree(remlc)==0 ){ remlc=f.genOne() ; }
    108   DEBOUTLN(cout, "remlc= " , remlc);
     116  DEBOUTLN(CERR, "remlc= " , remlc);
    109117  for ( int i=n-1; i>=1; i-- ){
    110118    newlc= LC(f,i);
    111119    if ( totaldegree(newlc)==0 ){ newlc=f.genOne() ; }
    112     DEBOUTLN(cout, "newlc= " , newlc);
     120    DEBOUTLN(CERR, "newlc= " , newlc);
    113121    if ( (remlc.isOne()) && (newlc.isOne()) ){ // take care of the degrees
    114122      if ( degree(f,i) < degree(f,mainvar) ){
     
    227235    else{ // lt is a) a product or b) a sum of terms
    228236      if ( lt_is_product(lt) ){ // case a)
    229         DEBOUTLN(cout, "lt_is_product: ", lt);
     237        DEBOUTLN(CERR, "lt_is_product: ", lt);
    230238        savelc= content(lt) ; // can we simplify to savelc= lc(lt); ?
    231239        while ( getNumVars(savelc) != 0 )
     
    255263      }
    256264      else{ // case b)
    257         DEBOUTLN(cout, "lt_is_sum: ", lt);
     265        DEBOUTLN(CERR, "lt_is_sum: ", lt);
    258266        CanonicalForm save_denumerator= 1;
    259267        for ( i=TheList; i.hasItem(); i++ ){
     
    272280#else
    273281#ifndef NOSTREAMIO
    274             cerr << "libfac: ERROR: not_monic1: case lt is a sum.\n"
    275                  << rcsid << errmsg << endl;
     282            CERR << "libfac: ERROR: not_monic1: case lt is a sum.\n"
     283                 << rcsid << errmsg << "\n";
    276284#endif
    277285#endif
     
    291299#else
    292300#ifndef NOSTREAMIO
    293           cerr << "libfac: ERROR: not_monic2: case lt is a sum.\n"
    294                << rcsid << errmsg << endl;
     301          CERR << "libfac: ERROR: not_monic2: case lt is a sum.\n"
     302               << rcsid << errmsg << "\n";
    295303#endif
    296304#endif
     
    299307    }
    300308  }
    301   DEBOUTLN(cout,"Returnlist: ", Returnlist);
     309  DEBOUTLN(CERR,"Returnlist: ", Returnlist);
    302310  return Returnlist;
    303311}
     
    354362  Variable x(nr_of_variable);
    355363
    356   DEBOUTLN(cout, "specialize_variable: called with: ", f);
     364  DEBOUTLN(CERR, "specialize_variable: called with: ", f);
    357365  for ( Extgenerator.reset(); Extgenerator.hasItems(); Extgenerator.next() ){
    358     DEBOUTLN(cout, "  specialize_variable: trying:  ", Extgenerator.item());
     366    DEBOUTLN(CERR, "  specialize_variable: trying:  ", Extgenerator.item());
    359367    g= f( Extgenerator.item(), x );
    360     DEBOUTLN(cout, "  specialize_variable: resulting g= ", g);
     368    DEBOUTLN(CERR, "  specialize_variable: resulting g= ", g);
    361369    if ( various_tests(g,deg,former_nr_of_variables - nr_of_variable ) ){
    362370      Substitutionlist.insert(SForm(x,Extgenerator.item())); // append (Var,value) pair
     
    373381  Variable x(nr_of_variable);
    374382
    375   DEBOUTLN(cout, "specialize_variable: called with: ", f);
     383  DEBOUTLN(CERR, "specialize_variable: called with: ", f);
    376384  for ( Extgenerator.reset(); Extgenerator.hasItems(); Extgenerator.next() ){
    377     DEBOUTLN(cout, "  specialize_variable: trying:  ", Extgenerator.item());
     385    DEBOUTLN(CERR, "  specialize_variable: trying:  ", Extgenerator.item());
    378386    g= f( Extgenerator.item(), x );
    379     DEBOUTLN(cout, "  specialize_variable: resulting g= ", g);
     387    DEBOUTLN(CERR, "  specialize_variable: resulting g= ", g);
    380388    if ( various_tests(g,deg,former_nr_of_variables - nr_of_variable ) ){
    381389      Substitutionlist.insert(SForm(x,Extgenerator.item())); // append (Var,value) pair
     
    402410#else
    403411#ifndef NOSTREAMIO
    404     cerr << "libfac: evaluate: " << Extension << " not inFF() or inGF() !"
    405          << endl;
     412    CERR << "libfac: evaluate: " << Extension << " not inFF() or inGF() !"
     413         << "\n";
    406414#endif
    407415#endif
     
    433441
    434442  if ( degree(Extension) > 0 ){ // working over Extensions
    435     DEBOUTLN(cout, "try_specializePoly: working over Extensions: ", Extension);
     443    DEBOUTLN(CERR, "try_specializePoly: working over Extensions: ", Extension);
    436444    AlgExtGenerator g(Extension);
    437445    for ( int k=i ; k<j ; k++ ){ // try to find specialization for all
     
    444452  else{ // working over the ground-field
    445453    FFGenerator g;
    446     DEBOUTMSG(cout, "try_specializePoly: working over the ground-field.");
     454    DEBOUTMSG(CERR, "try_specializePoly: working over the ground-field.");
    447455    for ( int k=i ; k<j ; k++ ){
    448456      ok= specialize_variable( ff, deg, Substitutionlist, k, j, g );
     
    475483#else
    476484#ifndef NOSTREAMIO
    477       cerr << "libfac: spezializePoly ERROR: Working over given extension-field not yet implemented!\n"
    478            << rcsid << errmsg << endl;
     485      CERR << "libfac: spezializePoly ERROR: Working over given extension-field not yet implemented!\n"
     486           << rcsid << errmsg << "\n";
    479487#endif
    480488#endif
     
    511519#else
    512520#ifndef NOSTREAMIO
    513     cerr << "libfac: evaluate: " << Extension << " not inFF() or inGF() !"
    514          << endl;
     521    CERR << "libfac: evaluate: " << Extension << " not inFF() or inGF() !"
     522         << "\n";
    515523#endif
    516524#endif
     
    610618    else{
    611619      if (Extension.level()<0)
    612       DEBOUTLN(cout, "Univ. Factorization over extension of degree ",
     620      DEBOUTLN(CERR, "Univ. Factorization over extension of degree ",
    613621               degree(getMipo(Extension,'x')) );
    614622      else
    615       DEBOUTLN(cout, "Univ. Factorization over extension of level ??",
     623      DEBOUTLN(CERR, "Univ. Factorization over extension of level ??",
    616624                Extension.level());
    617625      TIMING_START(evaluate_time);
     
    643651
    644652  if ( oldmainvar != mainvar ){
    645     DEBOUTSL(cout); DEBOUT(cout,"Swapped poly ", F);
    646     DEBOUT(cout, " in ", f); DEBOUTNL(cout);
    647     DEBOUTSL(cout); DEBOUT(cout,"Swapped  ", oldmainvar );
    648     DEBOUT(cout, " <-- ", mainvar ); DEBOUT(cout, "  Mainvar= ", f.mvar());
    649     DEBOUTNL(cout);
     653    DEBOUTSL(CERR); DEBOUT(CERR,"Swapped poly ", F);
     654    DEBOUT(CERR, " in ", f); DEBOUTNL(CERR);
     655    DEBOUTSL(CERR); DEBOUT(CERR,"Swapped  ", oldmainvar );
     656    DEBOUT(CERR, " <-- ", mainvar ); DEBOUT(CERR, "  Mainvar= ", f.mvar());
     657    DEBOUTNL(CERR);
    650658    ff = f.deriv();
    651659    TIMING_START(discr_time);
     
    653661    TIMING_END(discr_time);
    654662    if ( !(ffuni.isOne()) ){ //discriminante nonzero: split poly
    655       DEBOUTLN(cout,"Nontrivial GCD of f= ", f);
    656       DEBOUTLN(cout,"             and @f= ", ff);
    657       DEBOUTLN(cout,"          GCD(f,@f)= ", ffuni);
     663      DEBOUTLN(CERR,"Nontrivial GCD of f= ", f);
     664      DEBOUTLN(CERR,"             and @f= ", ff);
     665      DEBOUTLN(CERR,"          GCD(f,@f)= ", ffuni);
    658666      ff=f/ffuni;
    659667      CFFList Outputlist_a, Outputlist_b;
    660668      Outputlist_a = Factorized(ff,alpha);
    661       DEBOUTLN(cout, "Outputlist_a = ", Outputlist_a);
     669      DEBOUTLN(CERR, "Outputlist_a = ", Outputlist_a);
    662670      Outputlist_b = Factorized(ffuni,alpha);
    663       DEBOUTLN(cout, "Outputlist_b = ", Outputlist_b);
     671      DEBOUTLN(CERR, "Outputlist_b = ", Outputlist_b);
    664672      Outputlist = myUnion(Outputlist_a, Outputlist_b);
    665673      // have to back-swapvar the factors....
     
    668676        Outputlist2.append(CFFactor(swapvar(copy.factor(),oldmainvar,mainvar),copy.exp()));
    669677      }
    670       DEBOUTLN(cout, "Outputlist2 (a+b swapped) (to return) = ", Outputlist2);
     678      DEBOUTLN(CERR, "Outputlist2 (a+b swapped) (to return) = ", Outputlist2);
    671679      return Outputlist2;
    672680    }
     
    676684  for ( int i=1; i<=level(F); i++)
    677685    if ( degree(f,Variable(i) ) == 1 ) { //test trivial case; only true iff F is primitiv w.r.t every variable; else check (if F=ax+b) gcd(a,b)=1 ?
    678       DEBOUTLN(cout, "Trivial case: ", F);
     686      DEBOUTLN(CERR, "Trivial case: ", F);
    679687      Outputlist.append(CFFactor(F,1));
    680688      return Outputlist;
     
    683691  // Look at the leading term:
    684692  lt = LC(f);
    685   DEBOUTLN(cout, "Leading term: ", lt);
     693  DEBOUTLN(CERR, "Leading term: ", lt);
    686694  if ( lt != f.genOne() ){
    687695    // make the polynomial monic in the main variable
    688696    ff = make_monic(f,lt); ffuni = ff;
    689     DEBOUTLN(cout, "make_monic returned: ", ff);
     697    DEBOUTLN(CERR, "make_monic returned: ", ff);
    690698  }
    691699  else{ ff= f; ffuni= ff; }
     
    693701  TIMING_START(evaluate_time);
    694702  success=evaluate(min(10,max(degree(ff), 5)), min(degree(ff),3), min(degree(ff),3), ff, Extension, alpha, Substitutionlist,UnivariateFactorlist);
    695   DEBOUTLN(cout,  "Returned from evaluate: success: ", success);
     703  DEBOUTLN(CERR,  "Returned from evaluate: success: ", success);
    696704  for ( SFormListIterator ii=Substitutionlist; ii.hasItem(); ii++ ){
    697     DEBOUTLN(cout, "Substituting ", ii.getItem().factor());
    698     DEBOUTLN(cout, "       with value: ", ii.getItem().exp());
     705    DEBOUTLN(CERR, "Substituting ", ii.getItem().factor());
     706    DEBOUTLN(CERR, "       with value: ", ii.getItem().exp());
    699707  }
    700708
    701709  if ( success==0 ){ // evalute wasn't successfull
    702710    success= specializePoly(ffuni,Extension,degree(ff),Substitutionlist,1,getNumVars(compress(ff,m)));
    703     DEBOUTLN(cout,  "Returned from specializePoly: success: ", success);
     711    DEBOUTLN(CERR,  "Returned from specializePoly: success: ", success);
    704712    if (success == 0 ){ // No spezialisation could be found
    705713#ifdef HAVE_SINGULAR_ERROR
     
    707715#else
    708716#ifndef NOSTREAMIO
    709       cerr << "libfac: Factorize: ERROR: Not able to find a valid specialization!\n"
    710            << rcsid << errmsg << endl;
     717      CERR << "libfac: Factorize: ERROR: Not able to find a valid specialization!\n"
     718           << rcsid << errmsg << "\n";
    711719#else
    712720       ;
     
    724732    // We now have an univariat poly; factorize that
    725733    if ( degree(Extension) == 0   ){
    726       DEBOUTMSG(cout, "Univ. Factorization over the ground field");
     734      DEBOUTMSG(CERR, "Univ. Factorization over the ground field");
    727735      UnivariateFactorlist = factorize(ffuni,1); // univ. poly is sqr-free!
    728736    }
    729737    else{
    730       DEBOUTLN(cout, "Univ. Factorization over extension of degree ",
     738      DEBOUTLN(CERR, "Univ. Factorization over extension of degree ",
    731739               degree(getMipo(Extension,'x')) );
    732740     #if 1
     
    745753    TIMING_END(evaluate_time);
    746754  if (UnivariateFactorlist.length() == 1){ // poly is irreduzibel
    747     DEBOUTLN(cout, "Univ. poly is irreduzible: ", UnivariateFactorlist);
     755    DEBOUTLN(CERR, "Univ. poly is irreduzible: ", UnivariateFactorlist);
    748756    Outputlist.append(CFFactor(F,1));
    749757    return Outputlist;
    750758  }
    751759  else{ // we have factors
    752     DEBOUTSL(cout);
    753     DEBOUT(cout, "Univariate poly has " , UnivariateFactorlist.length());
    754     DEBOUT(cout, " factors:  ", ffuni);
    755     DEBOUT(cout, " = ", UnivariateFactorlist); DEBOUTNL(cout);
     760    DEBOUTSL(CERR);
     761    DEBOUT(CERR, "Univariate poly has " , UnivariateFactorlist.length());
     762    DEBOUT(CERR, " factors:  ", ffuni);
     763    DEBOUT(CERR, " = ", UnivariateFactorlist); DEBOUTNL(CERR);
    756764
    757765    // INTERRUPTHANDLER
     
    761769    TIMING_START(hensel_time);
    762770    Outputlist = MultiHensel(ff,UnivariateFactorlist,Substitutionlist);
    763     DEBOUTLN(cout, "Outputlist after MultiHensel: ", Outputlist);
     771    DEBOUTLN(CERR, "Outputlist after MultiHensel: ", Outputlist);
    764772    TIMING_END(hensel_time);
    765773
     
    770778    TIMING_START(truefactor_time);
    771779    Outputlist = Truefactors(ff, level(ff), Substitutionlist, Outputlist);
    772     DEBOUTLN(cout, "Outputlist after Truefactors: ", Outputlist);
     780    DEBOUTLN(CERR, "Outputlist after Truefactors: ", Outputlist);
    773781    TIMING_END(truefactor_time);
    774782
     
    779787    if ( lt != f.genOne() ){
    780788      Outputlist = not_monic(Outputlist,lt,ff,level(ff));
    781       DEBOUTLN(cout, "not_monic returned: ", Outputlist);
     789      DEBOUTLN(CERR, "not_monic returned: ", Outputlist);
    782790    }
    783791
     
    817825  // INTERRUPTHANDLER
    818826
    819   DEBINCLEVEL(cout, "Factorize");
    820   DEBOUTMSG(cout, rcsid);
    821   DEBOUTLN(cout, "Called with F= ", F);
     827  DEBINCLEVEL(CERR, "Factorize");
     828  DEBOUTMSG(CERR, rcsid);
     829  DEBOUTLN(CERR, "Called with F= ", F);
    822830  if ( getCharacteristic() == 0 ) { // char == 0
    823831    TIMING_START(factorize_time);
    824     //cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl;
     832    //CERR << "Factoring in char=0 of " << F << " = " << Outputlist << "\n";
    825833    Outputlist= factorize(F);
    826834    // Factorization in char=0 doesn't sometimes return at least two elements!!!
    827835    if ( getNumVars(Outputlist.getFirst().factor()) != 0 )
    828836      Outputlist.insert(CFFactor(1,1));
    829     //cout << "  Factorize in char=0: returning with: " << Outputlist << endl;
     837    //CERR << "  Factorize in char=0: returning with: " << Outputlist << "\n";
    830838    TIMING_END(factorize_time);
    831     DEBDECLEVEL(cout, "Factorize");
     839    DEBDECLEVEL(CERR, "Factorize");
    832840    TIMING_PRINT(factorize_time, "\ntime used for factorization   : ");
    833841    return Outputlist;
     
    865873  else
    866874    SqrFreeList.append(CFFactor(F,1));
    867   DEBOUTLN(cout, "InternalSqrFreeList= ", SqrFreeList);
     875  DEBOUTLN(CERR, "InternalSqrFreeList= ", SqrFreeList);
    868876  for ( i=SqrFreeList; i.hasItem(); i++ ){
    869     DEBOUTLN(cout, "Factor under consideration: ", i.getItem().factor());
     877    DEBOUTLN(CERR, "Factor under consideration: ", i.getItem().factor());
    870878    // We need a compress on each list item ! Maybe we have less variables!
    871879    g =compress(i.getItem().factor(),m);
     
    882890      else{ // multivariate polynomial
    883891        if ( g.isHomogeneous() ){
    884           DEBOUTLN(cout, "Poly is homogeneous! : ", g);
     892          DEBOUTLN(CERR, "Poly is homogeneous! : ", g);
    885893          // Now we can substitute one variable to 1, factorize and then
    886894          // look on the resulting factors and their monomials for
     
    901909  }
    902910  g=1; unit=1;
    903   DEBOUTLN(cout, "Outputlist is ", Outputlist);
     911  DEBOUTLN(CERR, "Outputlist is ", Outputlist);
    904912  for ( i=Outputlist; i.hasItem(); i++ )
    905913    if ( level(i.getItem().factor()) > 0 ){
     
    928936  }
    929937
    930   DEBDECLEVEL(cout, "Factorize");
     938  DEBDECLEVEL(CERR, "Factorize");
    931939  TIMING_END(factorize_time);
    932940
     
    963971  // INTERRUPTHANDLER
    964972
    965   DEBINCLEVEL(cout, "Factorize");
    966   DEBOUTMSG(cout, rcsid);
    967   DEBOUTLN(cout, "Called with F= ", F);
     973  DEBINCLEVEL(CERR, "Factorize");
     974  DEBOUTMSG(CERR, rcsid);
     975  DEBOUTLN(CERR, "Called with F= ", F);
    968976  if ( getCharacteristic() == 0 )
    969977  { // char == 0
    970978    TIMING_START(factorize_time);
    971     //cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl;
     979    //CERR << "Factoring in char=0 of " << F << " = " << Outputlist << "\n";
    972980    #if 0
    973981    // SHOULD: Outputlist= factorize(F,minpoly);
     
    10031011    if ( getNumVars(Outputlist.getFirst().factor()) != 0 )
    10041012      Outputlist.insert(CFFactor(1,1));
    1005     //cout << "  Factorize in char=0: returning with: " << Outputlist << endl;
     1013    //CERR << "  Factorize in char=0: returning with: " << Outputlist << "\n";
    10061014    TIMING_END(factorize_time);
    1007     DEBDECLEVEL(cout, "Factorize");
     1015    DEBDECLEVEL(CERR, "Factorize");
    10081016    TIMING_PRINT(factorize_time, "\ntime used for factorization   : ");
    10091017    return Outputlist;
     
    10411049  else
    10421050    SqrFreeList.append(CFFactor(F,1));
    1043   DEBOUTLN(cout, "InternalSqrFreeList= ", SqrFreeList);
     1051  DEBOUTLN(CERR, "InternalSqrFreeList= ", SqrFreeList);
    10441052  for ( i=SqrFreeList; i.hasItem(); i++ ){
    1045     DEBOUTLN(cout, "Factor under consideration: ", i.getItem().factor());
     1053    DEBOUTLN(CERR, "Factor under consideration: ", i.getItem().factor());
    10461054    // We need a compress on each list item ! Maybe we have less variables!
    10471055    g =compress(i.getItem().factor(),m);
     
    10611069      else{ // multivariate polynomial
    10621070        if ( g.isHomogeneous() ){
    1063           DEBOUTLN(cout, "Poly is homogeneous! : ", g);
     1071          DEBOUTLN(CERR, "Poly is homogeneous! : ", g);
    10641072          // Now we can substitute one variable to 1, factorize and then
    10651073          // look on the resulting factors and their monomials for
     
    10801088  }
    10811089  g=1; unit=1;
    1082   DEBOUTLN(cout, "Outputlist is ", Outputlist);
     1090  DEBOUTLN(CERR, "Outputlist is ", Outputlist);
    10831091  for ( i=Outputlist; i.hasItem(); i++ )
    10841092    if ( level(i.getItem().factor()) > 0 ){
     
    11071115  }
    11081116
    1109   DEBDECLEVEL(cout, "Factorize");
     1117  DEBDECLEVEL(CERR, "Factorize");
    11101118  TIMING_END(factorize_time);
    11111119
     
    11241132/*
    11251133$Log: not supported by cvs2svn $
     1134Revision 1.22  2006/04/28 13:46:29  Singular
     1135*hannes: better tests for 0, 1
     1136
    11261137Revision 1.21  2005/12/12 18:02:03  Singular
    11271138*hannes: use sorting option in Factorize
  • libfac/factor/MVMultiHensel.cc

    rdbcf42a re2ca88  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.8 2002-07-30 15:11:19 Singular Exp $";
     4// static char * rcsid = "$Id: MVMultiHensel.cc,v 1.9 2006-05-16 14:46:49 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// FACTORY - Includes
    77#include <factory.h>
    88#ifndef NOSTREAMIO
     9#ifdef HAVE_IOSTREAM
     10#include <iostream>
     11#define OSTREAM std::ostream
     12#define ISTREAM std::istream
     13#define CERR std::cerr
     14#define CIN std::cin
     15#elif defined(HAVE_IOSTREAM_H)
    916#include <iostream.h>
     17#define OSTREAM ostream
     18#define ISTREAM istream
     19#define CERR cerr
     20#define CIN cin
     21#endif
    1022#endif
    1123// Factor - Includes
     
    104116  Variable x(levelU);
    105117
    106   DEBOUT(cout, "diophant: called with: ", F1);
    107   DEBOUT(cout, "  ", F2); DEBOUTLN(cout, "  ", i);
     118  DEBOUT(CERR, "diophant: called with: ", F1);
     119  DEBOUT(CERR, "  ", F2); DEBOUTLN(CERR, "  ", i);
    108120
    109121  // Did we solve the diophantine equation yet?
     
    121133#else
    122134#ifndef NOSTREAMIO
    123     cerr << "libfac: diophant ERROR: degree too large!  "
    124          << (degree(F1,levelU) + degree(F2,levelU) ) <<endl;
     135    CERR << "libfac: diophant ERROR: degree too large!  "
     136         << (degree(F1,levelU) + degree(F2,levelU) ) <<"\n";
    125137#else
    126138    ;
     
    139151#else
    140152#ifndef NOSTREAMIO
    141       cerr << "libfac: diophant ERROR: " << F1 << "  and  " << F2
    142            << "  are not relatively prime!" << endl;
     153      CERR << "libfac: diophant ERROR: " << F1 << "  and  " << F2
     154           << "  are not relatively prime!" << "\n";
    143155#else
    144156     ;
     
    176188    A[i].calculated = true ; B[i].calculated = true ;
    177189  }
    178   DEBOUT(cout, "diophant: Returnvalue is: ", Retvalue.One);
    179   DEBOUTLN(cout, "  ", Retvalue.Two);
     190  DEBOUT(CERR, "diophant: Returnvalue is: ", Retvalue.One);
     191  DEBOUTLN(CERR, "  ", Retvalue.Two);
    180192
    181193  return  Retvalue;
     
    193205  DiophantForm intermediate;
    194206
    195   DEBOUT(cout, "make_delta: W= ", W);
    196   DEBOUTLN(cout, "  degree(W,levelU)= ", degree(W,levelU) );
     207  DEBOUT(CERR, "make_delta: W= ", W);
     208  DEBOUTLN(CERR, "  degree(W,levelU)= ", degree(W,levelU) );
    197209
    198210  if ( levelU == level(W) ){ // same level, good
     
    206218    Retvalue = W * intermediate.One;
    207219  }
    208   DEBOUTLN(cout, "make_delta: Returnvalue= ", Retvalue);
     220  DEBOUTLN(CERR, "make_delta: Returnvalue= ", Retvalue);
    209221  return Retvalue;
    210222}
     
    217229  DiophantForm intermediate;
    218230
    219   DEBOUT(cout, "make_square: W= ", W );
    220   DEBOUTLN(cout, "  degree(W,levelU)= ", degree(W,levelU));
     231  DEBOUT(CERR, "make_square: W= ", W );
     232  DEBOUTLN(CERR, "  degree(W,levelU)= ", degree(W,levelU));
    221233
    222234  if ( levelU == level(W) ){ // same level, good
     
    230242    Retvalue = W * intermediate.Two;
    231243  }
    232   DEBOUTLN(cout, "make_square: Returnvalue= ", Retvalue);
     244  DEBOUTLN(CERR, "make_square: Returnvalue= ", Retvalue);
    233245
    234246  return Retvalue;
     
    252264  RememberArray B(degree(F,levelU)+degree(G,levelU)+1);
    253265
    254   DEBOUTLN(cout, "mvhensel called with: U= ", U);
    255   DEBOUTLN(cout, "                      F= ", F);
    256   DEBOUTLN(cout, "                      G= ", G);
    257   DEBOUTLN(cout, "                   degU= ", degU);
     266  DEBOUTLN(CERR, "mvhensel called with: U= ", U);
     267  DEBOUTLN(CERR, "                      F= ", F);
     268  DEBOUTLN(CERR, "                      G= ", G);
     269  DEBOUTLN(CERR, "                   degU= ", degU);
    258270
    259271  V=change_poly(U,Substitutionlist,0); // change x_i <- x_i + a_i for all i
    260272  Rk = F*G-V;
    261273#ifdef HENSELDEBUG2
    262   cout << "mvhensel: V = " << V << endl
    263        << "          Fk= " << F << endl
    264        << "          Gk= " << G << endl
    265        << "          Rk= " << Rk << endl;
     274  CERR << "mvhensel: V = " << V << "\n"
     275       << "          Fk= " << F << "\n"
     276       << "          Gk= " << G << "\n"
     277       << "          Rk= " << Rk << "\n";
    266278#endif
    267279  for ( int k=2; k<=degU+1; k++){//2; k++){//degU+1; k++){
    268280    W = mod_power(Rk,k,levelU);
    269281#ifdef HENSELDEBUG2
    270     cout << "mvhensel: Iteration: " << k << endl;
    271     cout << "mvhensel: W= " << W << endl;
     282    CERR << "mvhensel: Iteration: " << k << "\n";
     283    CERR << "mvhensel: W= " << W << "\n";
    272284#endif
    273285    D = make_delta(levelU,W,F,G,A,B);
    274286#ifdef HENSELDEBUG2
    275     cout << "mvhensel: D= " << D << endl;
     287    CERR << "mvhensel: D= " << D << "\n";
    276288#endif
    277289    S = make_square(levelU,W,F,G,A,B);
    278290#ifdef HENSELDEBUG2
    279     cout << "mvhensel: S= " << S << endl;
     291    CERR << "mvhensel: S= " << S << "\n";
    280292#endif
    281293    Rk += S*D - D*Fk - S*Gk;
    282294#ifdef HENSELDEBUG2
    283     cout << "mvhensel: Rk= " << Rk << endl;
     295    CERR << "mvhensel: Rk= " << Rk << "\n";
    284296#endif
    285297    Fk -= S;
    286298#ifdef HENSELDEBUG2
    287     cout << "mvhensel: Fk= " << Fk << endl;
     299    CERR << "mvhensel: Fk= " << Fk << "\n";
    288300#endif
    289301    Gk -= D;
    290302#ifdef HENSELDEBUG2
    291     cout << "mvhensel: Gk= " << Gk << endl;
     303    CERR << "mvhensel: Gk= " << Gk << "\n";
    292304#endif
    293305    if ( Rk.isZero() ) break;
     
    296308  Retvalue.Two = change_poly(Gk,Substitutionlist,1);
    297309
    298   DEBOUTLN(cout, "mvhensel: Retvalue: ", Retvalue.One);
    299   DEBOUTLN(cout, "                    ", Retvalue.Two);
     310  DEBOUTLN(CERR, "mvhensel: Retvalue: ", Retvalue.One);
     311  DEBOUTLN(CERR, "                    ", Retvalue.Two);
    300312
    301313  return Retvalue ;
     
    313325  int n = factorlist.length();
    314326
    315   DEBOUT(cout, "multihensel: called with ", mF);
    316   DEBOUTLN(cout, "  ", factorlist);
     327  DEBOUT(CERR, "multihensel: called with ", mF);
     328  DEBOUTLN(CERR, "  ", factorlist);
    317329
    318330  if ( n == 1 ) {
     
    329341    else { // more then two factors
    330342#ifdef HENSELDEBUG2
    331       cout << "multihensel: more than two factors!" << endl;
     343      CERR << "multihensel: more than two factors!" << "\n";
    332344#endif
    333345      Pl=factorlist.getFirst().factor(); factorlist.removeFirst();
     
    336348        Pr *=  i.getItem().factor() ;
    337349#ifdef HENSELDEBUG2
    338       cout << "multihensel: Pl,Pr, factorlist: " << Pl << "  " << Pr
    339            << "  " << factorlist << endl;
     350      CERR << "multihensel: Pl,Pr, factorlist: " << Pl << "  " << Pr
     351           << "  " << factorlist << "\n";
    340352#endif
    341353      intermediat= mvhensel(mF,Pl,Pr,Substitutionlist);
     
    364376  int n = factorlist.length(),h=n/2, k;
    365377
    366   DEBOUT(cout, "MultiHensel: called with ", mF);
    367   DEBOUTLN(cout, "  ", factorlist);
    368   DEBOUT(cout,"           : n,h = ", n);
    369   DEBOUTLN(cout,"  ", h);
     378  DEBOUT(CERR, "MultiHensel: called with ", mF);
     379  DEBOUTLN(CERR, "  ", factorlist);
     380  DEBOUT(CERR,"           : n,h = ", n);
     381  DEBOUTLN(CERR,"  ", h);
    370382
    371383  if ( n == 1 ) {
     
    386398      }
    387399
    388       DEBOUTLN(cout, "MultiHensel: Ll= ", Ll);
    389       DEBOUTLN(cout, "     factorlist= ", factorlist);
     400      DEBOUTLN(CERR, "MultiHensel: Ll= ", Ll);
     401      DEBOUTLN(CERR, "     factorlist= ", factorlist);
    390402
    391403      Pl = 1; Pr = 1;
    392404      for ( i = Ll; i.hasItem(); i++)
    393405        Pl *= i.getItem().factor();
    394       DEBOUTLN(cout, "MultiHensel: Pl= ", Pl);
     406      DEBOUTLN(CERR, "MultiHensel: Pl= ", Pl);
    395407      for ( i = factorlist; i.hasItem(); i++)
    396408        Pr *= i.getItem().factor();
    397       DEBOUTLN(cout, "MultiHensel: Pr= ", Pr);
     409      DEBOUTLN(CERR, "MultiHensel: Pr= ", Pr);
    398410      intermediat = mvhensel(mF,Pl,Pr,Substitutionlist);
    399411      // divison test for intermediat.One and intermediat.Two ?
     
    418430/*
    419431$Log: not supported by cvs2svn $
     432Revision 1.8  2002/07/30 15:11:19  Singular
     433*hannes: minor cleanups
     434
    420435Revision 1.7  2001/08/22 14:21:17  Singular
    421436*hannes: added search for main var to Factorize
  • libfac/factor/SqrFree.cc

    rdbcf42a re2ca88  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: SqrFree.cc,v 1.9 2006-04-28 13:46:29 Singular Exp $";
     4static char * rcsid = "$Id: SqrFree.cc,v 1.10 2006-05-16 14:46:50 Singular Exp $";
    55static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de .\n Please include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you.";
    66///////////////////////////////////////////////////////////////////////////////
     
    88#include<factory.h>
    99#ifndef NOSTREAMIO
     10#ifdef HAVE_IOSTREAM
     11#include <iostream>
     12#define OSTREAM std::ostream
     13#define ISTREAM std::istream
     14#define CERR std::cerr
     15#define CIN std::cin
     16#elif defined(HAVE_IOSTREAM_H)
    1017#include <iostream.h>
     18#define OSTREAM ostream
     19#define ISTREAM istream
     20#define CERR cerr
     21#define CIN cin
     22#endif
    1123#endif
    1224// Factor - Includes
     
    178190#else
    179191#ifndef NOSTREAMIO
    180   cerr << "\nlibfac: ERROR: SqrFreeTest: we should never fall trough here!\n"
    181        << rcsid << errmsg << endl;
     192  CERR << "\nlibfac: ERROR: SqrFreeTest: we should never fall trough here!\n"
     193       << rcsid << errmsg << "\n";
    182194#endif
    183195#endif
     
    198210  int n = level(f);
    199211
    200   DEBINCLEVEL(cout, "SqrFreed");
    201   DEBOUTLN(cout, "Called with r= ", r);
     212  DEBINCLEVEL(CERR, "SqrFreed");
     213  DEBOUTLN(CERR, "Called with r= ", r);
    202214  if (getNumVars(f)==0 ) { // just a constant; return it
    203215    Outputlist= myappend(Outputlist,CFFactor(f,1));
     
    213225      if ( ! (g.isOne() || (-g).isOne() || degree(g)==0 )) {
    214226        g = swapvar(g,k,n);
    215         DEBOUTLN(cout, "We have a content: ", g);
     227        DEBOUTLN(CERR, "We have a content: ", g);
    216228        Outputlist = myUnion(InternalSqrFree(g,mipo),Outputlist); // should we add a
    217229                                                // SqrFreeTest(g) first ?
    218         DEBOUTLN(cout, "Outputlist is now: ", Outputlist);
     230        DEBOUTLN(CERR, "Outputlist is now: ", Outputlist);
    219231        f /=g;
    220         DEBOUTLN(cout, "f is now: ", f);
     232        DEBOUTLN(CERR, "f is now: ", f);
    221233      }
    222234    } 
     
    225237// Now f is primitive; Let`s look if f is univariate
    226238  if ( f.isUnivariate() ) {
    227     DEBOUTLN(cout, "f is univariate: ", f);
     239    DEBOUTLN(CERR, "f is univariate: ", f);
    228240    g = content(g);
    229241    if ( ! (g.isOne() || (-g).isOne() ) ){
     
    232244    }
    233245    Outputlist = Union(sqrFree(f),Outputlist) ;
    234     DEBOUTLN(cout, "Outputlist after univ. sqrFree(f) = ", Outputlist);
    235     DEBDECLEVEL(cout, "SqrFreed");
     246    DEBOUTLN(CERR, "Outputlist after univ. sqrFree(f) = ", Outputlist);
     247    DEBDECLEVEL(CERR, "SqrFreed");
    236248    return Outputlist ;
    237249  }
     
    240252  if ( totaldegree(f) <= 1 ) {
    241253    Outputlist= myappend(Outputlist,CFFactor(f,1)) ;
    242     DEBDECLEVEL(cout, "SqrFreed");
     254    DEBDECLEVEL(CERR, "SqrFreed");
    243255    return Outputlist ;
    244256  }
     
    266278      if ( k==n )
    267279      { // really is Pth power
    268         DEBOUTLN(cout, "f is a p'th root: ", f);
     280        DEBOUTLN(CERR, "f is a p'th root: ", f);
    269281        CFMap m;
    270282        g = compress(f,m);
     
    273285        else
    274286          f = m(PthRoot(g,mipo));
    275         DEBOUTLN(cout, "  that is       : ", f);
     287        DEBOUTLN(CERR, "  that is       : ", f);
    276288        // now : Outputlist union ( SqrFreed(f) )^getCharacteristic()
    277289        Outputlist=myUnion(Powerup(InternalSqrFree(f),getCharacteristic()),Outputlist);
    278         DEBDECLEVEL(cout, "SqrFreed");
     290        DEBDECLEVEL(CERR, "SqrFreed");
    279291        return Outputlist ;
    280292      }
     
    282294  }
    283295  g = f.deriv();
    284   DEBOUTLN(cout, "calculating mygcd of ", f);
    285   DEBOUTLN(cout, "               and ", g);
     296  DEBOUTLN(CERR, "calculating mygcd of ", f);
     297  DEBOUTLN(CERR, "               and ", g);
    286298  h = mygcd(f,pp(g));  h /= lc(h);
    287   DEBOUTLN(cout,"mygcd(f,g)= ",h);
     299  DEBOUTLN(CERR,"mygcd(f,g)= ",h);
    288300  if ( (h.isOne()) || ( h==f) || ((-h).isOne()) || getNumVars(h)==0 ) { // no common factor
    289301    Outputlist= myappend(Outputlist,CFFactor(f,1)) ;
    290     DEBOUTLN(cout, "Outputlist= ", Outputlist);
    291     DEBDECLEVEL(cout, "SqrFreed");
     302    DEBOUTLN(CERR, "Outputlist= ", Outputlist);
     303    DEBDECLEVEL(CERR, "SqrFreed");
    292304    return Outputlist ;
    293305  }
     
    299311       f /= g;
    300312    }
    301     DEBOUTLN(cout, "Split into f= ", f);
    302     DEBOUTLN(cout, "       and h= ", h);
     313    DEBOUTLN(CERR, "Split into f= ", f);
     314    DEBOUTLN(CERR, "       and h= ", h);
    303315    // For char > 0 the polys f and h can have Pth roots; so we need a test
    304316    // Test is disabled because timing is the same
     
    312324//    else
    313325    Outputlist=myUnion(Outputlist,InternalSqrFree(h));
    314     DEBOUTLN(cout, "Returning list ", Outputlist);
    315     DEBDECLEVEL(cout, "SqrFreed");
     326    DEBOUTLN(CERR, "Returning list ", Outputlist);
     327    DEBDECLEVEL(CERR, "SqrFreed");
    316328    return Outputlist ;
    317329  }
     
    320332#else
    321333#ifndef NOSTREAMIO
    322   cerr << "\nlibfac: ERROR: SqrFreed: we should never fall trough here!\n"
    323        << rcsid << errmsg << endl;
    324 #endif
    325 #endif
    326   DEBDECLEVEL(cout, "SqrFreed");
     334  CERR << "\nlibfac: ERROR: SqrFreed: we should never fall trough here!\n"
     335       << rcsid << errmsg << "\n";
     336#endif
     337#endif
     338  DEBDECLEVEL(CERR, "SqrFreed");
    327339  return Outputlist; // for safety purpose
    328340}
     
    337349  CFFList Outputlist, Outputlist2;
    338350
    339   DEBINCLEVEL(cout, "InternalSqrFree");
    340   DEBOUTMSG(cout, rcsid);
    341   DEBOUTLN(cout,"Called with f= ", f);
     351  DEBINCLEVEL(CERR, "InternalSqrFree");
     352  DEBOUTMSG(CERR, rcsid);
     353  DEBOUTLN(CERR,"Called with f= ", f);
    342354
    343355  // Take care of stupid users giving us constants
     
    359371      }
    360372  }
    361   DEBOUTLN(cout,"Outputlist = ", Outputlist);
     373  DEBOUTLN(CERR,"Outputlist = ", Outputlist);
    362374  for ( CFFListIterator i=Outputlist; i.hasItem(); i++ )
    363375    if ( getNumVars(i.getItem().factor()) > 0 )
    364376      Outputlist2.append(i.getItem());
    365377
    366   DEBOUTLN(cout,"Outputlist2 = ", Outputlist2);
    367   DEBDECLEVEL(cout, "InternalSqrFree");
     378  DEBOUTLN(CERR,"Outputlist2 = ", Outputlist2);
     379  DEBDECLEVEL(CERR, "InternalSqrFree");
    368380  return Outputlist2 ;
    369381}
     
    376388  int n=totaldegree(r);
    377389
    378   DEBINCLEVEL(cout, "SqrFree");
     390  DEBINCLEVEL(CERR, "SqrFree");
    379391
    380392  if ( sqrfreelist.length() < 2 ){
    381     DEBDECLEVEL(cout, "SqrFree");
     393    DEBDECLEVEL(CERR, "SqrFree");
    382394    return sqrfreelist;
    383395  }
     
    396408  outputlist.insert(CFFactor(elem,1));
    397409
    398   DEBOUTLN(cout, "SqrFree returns list:", outputlist);
    399   DEBDECLEVEL(cout, "SqrFree");
     410  DEBOUTLN(CERR, "SqrFree returns list:", outputlist);
     411  DEBDECLEVEL(CERR, "SqrFree");
    400412  return outputlist;
    401413}
     
    403415/*
    404416$Log: not supported by cvs2svn $
     417Revision 1.9  2006/04/28 13:46:29  Singular
     418*hannes: better tests for 0, 1
     419
    405420Revision 1.8  2002/08/19 11:11:33  Singular
    406421* hannes/pfister: alg_gcd etc.
  • libfac/factor/Truefactor.cc

    rdbcf42a re2ca88  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.9 2001-08-08 14:26:56 Singular Exp $";
     4//static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.10 2006-05-16 14:46:50 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// Factory - Includes
    77#include <factory.h>
    88#ifndef NOSTREAMIO
     9#ifdef HAVE_IOSTREAM
     10#include <iostream>
     11#define OSTREAM std::ostream
     12#define ISTREAM std::istream
     13#define CERR std::cerr
     14#define CIN std::cin
     15#elif defined(HAVE_IOSTREAM_H)
    916#include <iostream.h>
     17#define OSTREAM ostream
     18#define ISTREAM istream
     19#define CERR cerr
     20#define CIN cin
     21#endif
    1022#endif
    1123// Factor - Includes
     
    7890    if (f.level()!=0)
    7991    {
    80       //cout << "hasAlgVar:" << f.mvar() <<endl;
     92      //CERR << "hasAlgVar:" << f.mvar() <<"\n";
    8193      return 1;
    8294    }
     
    162174  CFFList Returnlist;
    163175
    164   DEBOUTLN(cout, "Remove_from_List called with L= ",L);
    165   DEBOUTLN(cout, "                     and  elem= ",elem);
     176  DEBOUTLN(CERR, "Remove_from_List called with L= ",L);
     177  DEBOUTLN(CERR, "                     and  elem= ",elem);
    166178  for ( ListIterator<CFFactor> i = L ; i.hasItem(); i++)
    167179    if ( i.getItem().factor() != elem )
     
    220232  ListIterator<CFFactor> i;
    221233
    222   //cout << "SubstitutionList="<< SubstitutionList<<endl;
     234  //CERR << "SubstitutionList="<< SubstitutionList<<"\n";
    223235// step 1: simply test the generated factors alone
    224236  for ( i= PiList; i.hasItem();i++){
     
    226238    //CanonicalForm test_f=change_poly(factor.factor(),SubstitutionList,0);
    227239    CanonicalForm test_f=factor.factor();
    228     //cout <<"f:" << factor.factor() << " -> test_f:"<<test_f <<endl;
    229     //cout << "           1:" << change_poly(factor.factor(),SubstitutionList,1) <<endl;
     240    //CERR <<"f:" << factor.factor() << " -> test_f:"<<test_f <<"\n";
     241    //CERR << "           1:" << change_poly(factor.factor(),SubstitutionList,1) <<"\n";
    230242    c= mydivremt(U,test_f,a,b);
    231243    if (  c  && b == U.genZero() && !hasAlgVar(test_f))
    232244    // factor.getFactor() divides U
    233245    {
    234       //cout << " teilt:" << test_f <<endl;
     246      //CERR << " teilt:" << test_f <<"\n";
    235247      U= a;
    236248      FAC.append(factor);
    237249    }
    238250    else{
    239       //cout << " teilt nicht:" << test_f <<endl;
     251      //CERR << " teilt nicht:" << test_f <<"\n";
    240252      L.append(factor);
    241253    }
    242254  }
    243   DEBOUTLN(cout,"Truefactors: (step1) L  = ", L);
    244   DEBOUTLN(cout,"                     FAC= ", FAC);
     255  DEBOUTLN(CERR,"Truefactors: (step1) L  = ", L);
     256  DEBOUTLN(CERR,"                     FAC= ", FAC);
    245257
    246258// step 2: Do we have to check combinations?
     
    257269    }
    258270
    259   DEBOUTLN(cout,"Truefactors: (step2) M   = ", M);
    260   DEBOUTLN(cout,"                     r   = ", r);
    261   DEBOUTLN(cout,"                     degU= ", degU);
     271  DEBOUTLN(CERR,"Truefactors: (step2) M   = ", M);
     272  DEBOUTLN(CERR,"                     r   = ", r);
     273  DEBOUTLN(CERR,"                     degU= ", degU);
    262274
    263275// Now do the real work!
     
    277289    // step 5
    278290    E_all = combine(M, L); // generate all combinations of M elements from L
    279     DEBOUTLN(cout,"Truefactors: (step5) E_all= ", E_all);
     291    DEBOUTLN(CERR,"Truefactors: (step5) E_all= ", E_all);
    280292    // select combinations with the degree not to exceed degU:
    281293    E_all = Rightdegree( E_all, degU, levelU );
    282     DEBOUTLN(cout,"Truefactors: (step5) E_all(Rightdegree)= ", E_all);
     294    DEBOUTLN(CERR,"Truefactors: (step5) E_all(Rightdegree)= ", E_all);
    283295    if ( E_all.length() == 0 ){
    284296      FAC.append( CFFactor(U,1) );
     
    288300      factor = i.getItem();
    289301      Y = Multmod_power( factor.factor(), SubstitutionList, h, levelU);
    290       DEBOUTLN(cout, "Truefactors: (step6) Testing Y  = ", Y);
     302      DEBOUTLN(CERR, "Truefactors: (step6) Testing Y  = ", Y);
    291303      c = mydivremt(U,Y,a,b);
    292304      //      if (  c  && b == U.genZero()) { // Y divides U
    293305      if ( c && b.isZero() ){
    294         DEBOUT(cout,"Truefactors: (step6): ",Y );
    295         DEBOUTLN(cout, "  divides  ",U);
     306        DEBOUT(CERR,"Truefactors: (step6): ",Y );
     307        DEBOUTLN(CERR, "  divides  ",U);
    296308        U = a;
    297309        FAC.append(Y); // Y is a real factor
     
    363375#else
    364376#ifndef NOSTREAMIO
    365       cerr << "libfac: ERROR: TakeNorms less then two items remaining! "
    366            << endl;
     377      CERR << "libfac: ERROR: TakeNorms less then two items remaining! "
     378           << "\n";
    367379#else
    368380      ;
     
    388400        }
    389401        else {
    390           //cout << "Schade!" << endl;
     402          //CERR << "Schade!" << "\n";
    391403        }
    392         DEBOUT(cout, "Truefactor: Combined ", n);
    393         DEBOUTLN(cout, " factors to: ", intermediate);
     404        DEBOUT(CERR, "Truefactor: Combined ", n);
     405        DEBOUTLN(CERR, " factors to: ", intermediate);
    394406      }
    395407      n += 1;
     
    409421#else
    410422#ifndef NOSTREAMIO
    411         cerr << "libfac: TakeNorms: somethings wrong with remaining factors!"
    412              << endl;
     423        CERR << "libfac: TakeNorms: somethings wrong with remaining factors!"
     424             << "\n";
    413425#endif
    414426#endif
     
    422434/*
    423435$Log: not supported by cvs2svn $
     436Revision 1.9  2001/08/08 14:26:56  Singular
     437*hannes: Dan's HAVE_SINGULAR_ERROR
     438
    424439Revision 1.8  2001/08/08 11:59:13  Singular
    425440*hannes: Dan's NOSTREAMIO changes
  • libfac/factor/class.h

    rdbcf42a re2ca88  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: class.h,v 1.5 2000-05-29 08:06:47 pohl Exp $
     4// $Id: class.h,v 1.6 2006-05-16 14:46:50 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef INCL_CLASS_H
     
    1010
    1111#ifndef NOSTREAMIO
     12#ifdef HAVE_IOSTREAM
     13#include <iostream>
     14#define OSTREAM std::ostream
     15#define ISTREAM std::istream
     16#elif defined(HAVE_IOSTREAM_H)
    1217#include <iostream.h>
     18#define OSTREAM ostream
     19#define ISTREAM istream
     20#endif
    1321#endif
    1422
     
    3341//     Substitution<T>& operator*= ( const T & f ) { _factor *= f; _exp *= f; return *this; }
    3442#ifndef NOSTREAMIO
    35     void print ( ostream& ) const;
    36     friend ostream& operator<< ( ostream & os, const Substitution<T> & f )
     43    void print ( OSTREAM& ) const;
     44    friend OSTREAM& operator<< ( OSTREAM & os, const Substitution<T> & f )
    3745    {
    3846        f.print( os );
     
    5361/*
    5462$Log: not supported by cvs2svn $
     63Revision 1.5  2000/05/29 08:06:47  pohl
     64no artificial friend
     65
    5566Revision 1.4  1997/09/12 07:19:54  Singular
    5667* hannes/michael: libfac-0.3.0
  • libfac/factor/debug.h

    rdbcf42a re2ca88  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22////////////////////////////////////////////////////////////
    3 // static char * rcsid = "$Id: debug.h,v 1.3 1997-09-12 07:19:55 Singular Exp $" ;
     3// static char * rcsid = "$Id: debug.h,v 1.4 2006-05-16 14:46:50 Singular Exp $" ;
    44////////////////////////////////////////////////////////////
    55// It is possible to include this file multiple times for different
     
    3939extern char * deb_level_msg;
    4040#define DEBINCLEVEL(stream,msg) \
    41 (stream << "\n" << deb_level_msg << "entering << " << msg << " >>" << endl, deb_inc_level())
     41(stream << "\n" << deb_level_msg << "entering << " << msg << " >>" << "\n", deb_inc_level())
    4242#define DEBDECLEVEL(stream,msg) \
    43 (deb_dec_level(), stream << deb_level_msg << "leaving << " << msg << " >>" << endl)
     43(deb_dec_level(), stream << deb_level_msg << "leaving << " << msg << " >>" << "\n")
    4444#define DEBOUTSL(stream) \
    4545(stream << deb_level_msg, stream.flush())
     
    4747(stream << deb_level_msg << msg << object, stream.flush())
    4848#define DEBOUTLN(stream,msg,object) \
    49 (stream << deb_level_msg << msg << object << endl)
     49(stream << deb_level_msg << msg << object << "\n")
    5050#define DEBOUTMSG(stream,msg) \
    51 (stream << deb_level_msg << msg << endl)
     51(stream << deb_level_msg << msg << "\n")
    5252#define DEBOUTNL(stream) \
    53 (stream << endl)
     53(stream << "\n")
    5454#else
    5555#define DEBINCLEVEL(stream,msg)
     
    6464/*
    6565$Log: not supported by cvs2svn $
     66Revision 1.3  1997/09/12 07:19:55  Singular
     67* hannes/michael: libfac-0.3.0
     68
    6669Revision 1.2  1997/04/25 22:15:33  michael
    6770Version for libfac-0.2.1
  • libfac/factor/homogfactor.cc

    rdbcf42a re2ca88  
    11/* Copyright 1997 Michael Messollen. All rights reserved. */
    22////////////////////////////////////////////////////////////
    3 // static char * rcsid = "$Id: homogfactor.cc,v 1.6 2005-12-09 08:36:11 Singular Exp $ ";
     3// static char * rcsid = "$Id: homogfactor.cc,v 1.7 2006-05-16 14:46:50 Singular Exp $ ";
    44////////////////////////////////////////////////////////////
    55// FACTORY - Includes
    66#include <factory.h>
     7#ifdef HAVE_IOSTREAM
     8#include <iostream>
     9#define OSTREAM std::ostream
     10#define ISTREAM std::istream
     11#define CERR std::cerr
     12#define CIN std::cin
     13#elif defined(HAVE_IOSTREAM_H)
     14#include <iostream.h>
     15#define OSTREAM ostream
     16#define ISTREAM istream
     17#define CERR cerr
     18#define CIN cin
     19#endif
     20
    721// Factor - Includes
    822#include "tmpl_inst.h"
     
    121135CFFList
    122136HomogFactor( const CanonicalForm & g, const CanonicalForm  & minpoly, const int Mainvar ){
    123   DEBINCLEVEL(cout, "HomogFactor");
     137  DEBINCLEVEL(CERR, "HomogFactor");
    124138  Variable xn = get_max_degree_Variable(g);
    125139  int d_xn = degree(g,xn);
     
    127141  CanonicalForm F = compress(g(1,xn),n); // must compress F!
    128142
    129   DEBOUTLN(cout, "xn= ", xn);
    130   DEBOUTLN(cout, "d_xn=   ", d_xn);
    131   DEBOUTLN(cout, "F= ", F); 
     143  DEBOUTLN(CERR, "xn= ", xn);
     144  DEBOUTLN(CERR, "d_xn=   ", d_xn);
     145  DEBOUTLN(CERR, "F= ", F); 
    132146
    133147  // should we do this for low degree polys g ? e.g. quadratic?
     
    143157    Homoglist.append(CFFactor( n(j.getItem().factor()), j.getItem().exp()) );
    144158  // Now we have uncompressed factors in Homoglist
    145   DEBOUTLN(cout, "F factors as: ", Homoglist);
     159  DEBOUTLN(CERR, "F factors as: ", Homoglist);
    146160  CFFList Unhomoglist;
    147161  CanonicalForm unhomogelem;
    148162  for ( j=Homoglist; j.hasItem(); j++ ){
    149     DEBOUTLN(cout, "Homogenizing ",j.getItem().factor());
     163    DEBOUTLN(CERR, "Homogenizing ",j.getItem().factor());
    150164    unhomogelem= homogenize(j.getItem().factor(),xn);
    151     DEBOUTLN(cout, "      that is ", unhomogelem);
     165    DEBOUTLN(CERR, "      that is ", unhomogelem);
    152166    Unhomoglist.append(CFFactor(unhomogelem,j.getItem().exp()));
    153167    d_xn -= degree(unhomogelem,xn)*j.getItem().exp();
    154168  }
    155   DEBOUTLN(cout, "Power of xn to append is ", d_xn);
     169  DEBOUTLN(CERR, "Power of xn to append is ", d_xn);
    156170  if ( d_xn != 0 ) // have to append xn^(d_xn)
    157171    Unhomoglist.append(CFFactor(CanonicalForm(xn),d_xn));
    158172
    159   DEBDECLEVEL(cout, "HomogFactor");
     173  DEBDECLEVEL(CERR, "HomogFactor");
    160174  return Unhomoglist;
    161175}
     
    163177/*
    164178$Log: not supported by cvs2svn $
     179Revision 1.6  2005/12/09 08:36:11  Singular
     180*hannes: stuff for homog. polys ->factory
     181
    165182Revision 1.5  2005/12/05 15:47:32  Singular
    166183*hannes: is_homogeneous -> factory: isHomogeneous
  • libfac/factor/timing.h

    rdbcf42a re2ca88  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: timing.h,v 1.3 1997-09-12 07:19:59 Singular Exp $";
     4// static char * rcsid = "$Id: timing.h,v 1.4 2006-05-16 14:46:50 Singular Exp $";
    55////////////////////////////////////////////////////////////
    66// It is possible to include this file multiple times for different
     
    1616#include <time.h>
    1717#include <sys/times.h>
     18#ifdef HAVE_IOSTREAM
     19#include <iostream>
     20#define OSTREAM std::ostream
     21#define ISTREAM std::istream
     22#elif defined(HAVE_IOSTREAM_H)
    1823#include <iostream.h>
     24#define OSTREAM ostream
     25#define ISTREAM istream
     26#endif
    1927#define TIMING_START(t) { struct tms timing_ ## t ## _start, timing_ ## t ## _end; \
    2028  times( &timing_ ## t ## _start );
     
    2230  timing_ ## t ## _time += timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime; }
    2331#define TIMING_DEFINE_PRINT(t) long timing_ ## t ## _time; \
    24 void timing_print_ ## t ( char * msg ) { cout.setf( ios::fixed, ios::floatfield); cout.precision(2); \
    25   cout << msg << float(timing_ ## t ## _time) / 60 << " sec" << endl; }
     32void timing_print_ ## t ( char * msg ) { CERR.setf( ios::fixed, ios::floatfield); CERR.precision(2); \
     33  CERR << msg << float(timing_ ## t ## _time) / 60 << " sec" << "\n"; }
    2634#define TIMING_PRINT(t,msg) timing_print_ ## t ( msg );
    2735#define TIMING_DEFINE_PRINTPROTO(t) void timing_print_ ## t ( char * );
     
    3644/*
    3745$Log: not supported by cvs2svn $
     46Revision 1.3  1997/09/12 07:19:59  Singular
     47* hannes/michael: libfac-0.3.0
     48
    3849Revision 1.2  1997/04/25 22:13:56  michael
    3950Version for libfac-0.2.1
  • libfac/test.cc

    rdbcf42a re2ca88  
    1 //static char rcsid[] = "$Id: test.cc,v 1.3 1997-09-12 07:19:34 Singular Exp $";
     1//static char rcsid[] = "$Id: test.cc,v 1.4 2006-05-16 14:46:48 Singular Exp $";
    22///////////////////////////////////////////////////////////////////////////////
    33// Factor - Includes
    44#include "factor.h"
     5#ifdef HAVE_IOSTREAM
     6#include <iostream>
     7#define CERR std::cerr
     8#define COUT std::cout
     9#define CIN std::cin
     10#elif defined(HAVE_IOSTREAM_H)
     11#include <iostream.h>
     12#define CERR cerr
     13#define COUT cout
     14#define CIN cin
     15#endif
     16
    517
    618
     
    2133    CFFactor copy;
    2234
    23 cout << libfac_name  <<", Version " << libfac_version << endl;
    24 //    cout << " Characteristic = ";
    25     cin >> charac;
     35COUT << libfac_name  <<", Version " << libfac_version << "\n";
     36//    COUT << " Characteristic = ";
     37    CIN >> charac;
    2638    setCharacteristic(charac);
    2739    On(SW_SYMMETRIC_FF);
     
    3547//
    3648//////////////////////////////////////////////////////////////
    37 //    cout << " f = ";
    38     cin >> f;
    39     cout << f  << " mod " << charac << " = " ;
     49//    COUT << " f = ";
     50    CIN >> f;
     51    COUT << f  << " mod " << charac << " = " ;
    4052    Factorlist= Factorize( f,0 );
    41      cout << Factorlist ;//<< endl;
     53     COUT << Factorlist ;//<< "\n";
    4254// Ueberpruefen:
    4355    g=1;
     
    5062    }
    5163    if ( (f-g) != f.genZero() ){
    52         cerr << "\nList and f differ: f= " << f << "  g= " << g << endl;
     64        CERR << "\nList and f differ: f= " << f << "  g= " << g << "\n";
    5365    }
    5466}
  • libfac/testcs.cc

    rdbcf42a re2ca88  
    1 // $Id: testcs.cc,v 1.2 1997-09-12 07:19:35 Singular Exp $
     1// $Id: testcs.cc,v 1.3 2006-05-16 14:46:48 Singular Exp $
    22
    33#include <factory.h>
    44#include <factor.h>
     5#ifdef HAVE_IOSTREAM
     6#include <iostream>
     7#define COUT std::cout
     8#define CIN std::cin
     9#elif defined(HAVE_IOSTREAM_H)
     10#include <iostream.h>
     11#define COUT cout
     12#define CIN cin
     13#endif
     14
    515
    616// testing: Characteristic Sets
     
    1828  int reord=0; // use strategy for reordering?
    1929  int charac;
    20   cout << " Characteristic = "; cin >> charac;
     30  COUT << " Characteristic = "; CIN >> charac;
    2131  setCharacteristic(charac);
    2232  On(SW_SYMMETRIC_FF);
    2333  char vnames[30];
    24   cout << " vnames = "; cin >> vnames;
     34  COUT << " vnames = "; CIN >> vnames;
    2535
    2636  setVarNames( vnames );
     
    3444  Varlist betterorder;
    3545
    36   cout << " f[" << i << "] = "; cin >> f;
     46  COUT << " f[" << i << "] = "; cin >> f;
    3747  while ( f != 0 ) {
    3848    F1.append( f ); i++;
    39     cout << " f[" << i << "] = "; cin >> f;
     49    COUT << " f[" << i << "] = "; cin >> f;
    4050  }
    4151  F2=F1;
    42   cout << endl;
     52  COUT << "\n";
    4353
    44   cout << "F = " << F1 << endl;
     54  COUT << "F = " << F1 << "\n";
    4555  if (reord){
    4656    betterorder= neworder(F1);
    47     cout << "new orderd vars: " << betterorder << endl;
     57    COUT << "new orderd vars: " << betterorder << "\n";
    4858    F1=reorder(betterorder,F1);
    49     cout << "new F= " << F1 << endl;
     59    COUT << "new F= " << F1 << "\n";
    5060  }
    51 //   cout << "\nUsing Modified CharSet:" << endl;
     61//   COUT << "\nUsing Modified CharSet:" << "\n";
    5262//   F2 = MCharSetN( F1, Remembern );
    53 //   cout << "MCsN(F) = " << F2 << endl;
    54 //   cout << "Factors removed: " << Remembern.FS2 << endl;
    55 //   cout << "Possible Factors considered: " << Remembern.FS1 << endl;
     63//   COUT << "MCsN(F) = " << F2 << "\n";
     64//   COUT << "Factors removed: " << Remembern.FS2 << "\n";
     65//   COUT << "Possible Factors considered: " << Remembern.FS1 << "\n";
    5666//   for ( I = F2; I.hasItem(); I++ )
    57 //     cout << "  vars: " << getVars( I.getItem() ) << endl;
    58   cout << "\nUsing IrrCharSeries:" << endl;
     67//     COUT << "  vars: " << getVars( I.getItem() ) << "\n";
     68  COUT << "\nUsing IrrCharSeries:" << "\n";
    5969  Q= IrrCharSeries( F1 );
    60   cout << "ics(F) = " << Q << endl;
     70  COUT << "ics(F) = " << Q << "\n";
    6171  if (reord){
    6272    Q=reorder(betterorder,Q);
    63     cout << "reorderd ics(F) = " << Q << endl;
     73    COUT << "reorderd ics(F) = " << Q << "\n";
    6474  }
    6575}
Note: See TracChangeset for help on using the changeset viewer.