Changeset e2ca88 in git for libfac/factor


Ignore:
Timestamp:
May 16, 2006, 4:46:50 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
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/factor
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.