Changeset 38e7b3 in git


Ignore:
Timestamp:
May 15, 2007, 4:46:49 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
10697c5f8efbddd9473d4c6b1643df3543bb6c50
Parents:
c3c515358fdfb7f2eec3dccc57840e2480316ab9
Message:
*hannes: factorize in Zp(a)[x...]


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

Legend:

Unmodified
Added
Removed
  • libfac/charset/alg_factor.cc

    rc3c515 r38e7b3  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: alg_factor.cc,v 1.16 2006-05-16 14:46:48 Singular Exp $";
     5static char * rcsid = "$Id: alg_factor.cc,v 1.17 2007-05-15 14:46:48 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    448448// the heart of the algorithm: the one from Trager
    449449static CFFList
    450 alg_factor( const CanonicalForm & f, const CFList & Astar, const Variable & vminpoly, const Varlist & oldord, const CFList & as){
     450alg_factor( const CanonicalForm & f, const CFList & Astar, const Variable & vminpoly, const Varlist & oldord, const CFList & as)
     451{
    451452  CFFList L, Factorlist;
    452453  CanonicalForm R, Rstar, s, g, h;
     
    455456  DEBINCLEVEL(CERR,"alg_factor");
    456457  DEBOUTLN(CERR, "alg_factor: f= ", f);
     458
    457459  //out_cf("start alg_factor:",f,"\n");
    458460  substlist= simpleextension(Astar, vminpoly, Rstar);
     
    504506  if ( !Factorlist.getFirst().factor().inCoeffDomain() )
    505507    Factorlist.insert(CFFactor(1,1));
    506   if ( Factorlist.length() == 2 && Factorlist.getLast().exp()== 1){ // irreduzibel (first entry is a constant)
     508  if ( Factorlist.length() == 2 && Factorlist.getLast().exp()== 1)
     509  { // irreduzibel (first entry is a constant)
    507510    L.append(CFFactor(f,1));
    508511  }
    509   else{
     512  else
     513  {
    510514    DEBOUTLN(CERR, "alg_factor: g= ", g);
    511515    CanonicalForm gnew= g(s,s.mvar());
    512516    DEBOUTLN(CERR, "alg_factor: gnew= ", gnew);
    513517    g=gnew;
    514     for ( CFFListIterator i=Factorlist; i.hasItem(); i++){
     518    for ( CFFListIterator i=Factorlist; i.hasItem(); i++)
     519    {
    515520      CanonicalForm fnew=i.getItem().factor();
    516521      fnew= fnew(s,s.mvar());
     
    522527        DEBOUTLN(CERR, "alg_factor: fnew= ", fnew);
    523528      }
    524       if (degree(i.getItem().factor()) > 0 ){
     529      if (degree(i.getItem().factor()) > 0 )
     530      {
    525531        // undo linear transformation!!!! and then gcd!
    526532        //CERR << "algcd(" << g << "," << fnew << ",as" << as << ")" << "\n";
    527         //out_cf("algcd g=",g,"\n");
    528         //out_cf("algcd fnew=",fnew,"\n");
     533        //out_cf("g=",g,"\n");
     534        //out_cf("fnew=",fnew,"\n");
    529535        //h= algcd(g,fnew, as, oldord);
    530536        //if (as.length() >1)
     
    537543        DEBOUTLN(CERR, "  alg_factor: h= ", h);
    538544        DEBOUTLN(CERR, "  alg_factor: oldord= ", oldord);
    539         if ( degree(h) > 0 ){ //otherwise it's a constant
     545        if ( degree(h) > 0 )
     546        { //otherwise it's a constant
     547          //CanonicalForm c=LC(h,g.mvar());
     548          //out_cf("new lc h:",c,"\n");
     549          //h= divide(h,c,as);
     550          //out_cf("new factor h/c:",h,"\n");
    540551          g= divide(g, h,as);
    541552          DEBOUTLN(CERR, "alg_factor: g/h= ", g);
    542553          DEBOUTLN(CERR, "alg_factor: s= ", s);
    543554          DEBOUTLN(CERR, "alg_factor: substlist= ", substlist);
     555          //out_cf("new g:",g,"\n");
    544556          L.append(CFFactor(h,1));
    545557        }
     558        //else printf("degree <=1\n");
    546559      }
    547560    }
     
    817830/*
    818831$Log: not supported by cvs2svn $
     832Revision 1.16  2006/05/16 14:46:48  Singular
     833*hannes: gcc 4.1 fixes
     834
    819835Revision 1.15  2005/10/17 13:16:18  Singular
    820836*hannes: code cleanup
  • libfac/charset/csutil.cc

    rc3c515 r38e7b3  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: csutil.cc,v 1.13 2006-06-19 13:37:47 Singular Exp $";
     4static char * rcsid = "$Id: csutil.cc,v 1.14 2007-05-15 14:46:48 Singular Exp $";
    55/////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    202202
    203203CanonicalForm
    204 divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as){
     204divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as)
     205{
    205206  CanonicalForm r,m,q;
    206207
     
    224225
    225226static CanonicalForm
    226 myfitting( const CanonicalForm &f ){
     227myfitting( const CanonicalForm &f )
     228{
    227229 CanonicalForm rem=f;
    228230
    229  if ( !(rem.isZero()) ){
     231 if ( !(rem.isZero()) )
     232 {
    230233   if ( getCharacteristic() > 0 )
    231234     return num((rem/lc(rem)));
    232    else{
     235   else
     236   {
    233237     On(SW_RATIONAL);
    234238     CanonicalForm temp= mapinto(rem);
     
    270274
    271275static CanonicalForm
    272 premasb( const CanonicalForm & f, const CFList & as){
     276premasb( const CanonicalForm & f, const CFList & as)
     277{
    273278  CanonicalForm remd=f;
    274279  CFList AS=as;
    275280
    276   if ( as.length() > 1 ){
     281  if ( as.length() > 1 )
     282  {
    277283    AS.removeFirst(); // get rid of first elem
    278284    CanonicalForm elem;
    279     while ( ! AS.isEmpty() ){ // thats true for at least the first iteration
     285    while ( ! AS.isEmpty() )
     286    { // thats true for at least the first iteration
    280287      elem= AS.getLast();
    281288      remd= Prem(remd,elem);
     
    291298
    292299CFList
    293 remsetb( const CFList & ps, const CFList & as){
     300remsetb( const CFList & ps, const CFList & as)
     301{
    294302  CFList output;
    295303  CanonicalForm elem;
    296   for (CFListIterator i=ps; i.hasItem(); i++){
     304  for (CFListIterator i=ps; i.hasItem(); i++)
     305  {
    297306    elem= premasb(i.getItem(),as);
    298307    if ( elem != elem.genZero() ) output.append(elem);
     
    305314// replace the power of factors of polys in as by 1 if any
    306315static CFList
    307 nopower( const CanonicalForm & init ){
     316nopower( const CanonicalForm & init )
     317{
    308318  CFFList sqrfreelist;// = Factorize(init);//SqrFree(init);
    309319  CFList output;
     
    317327  //  CERR << "nopower: count is " << count << "\n";}
    318328  if ( count > 1 ) sqrfreelist = CFFList( CFFactor(init,1));
    319   else {
     329  else
     330  {
    320331    sqrfreelist = Factorize(init);
    321332    //sqrfreelist.removeFirst();
    322333  }
    323   for ( CFFListIterator i=sqrfreelist; i.hasItem(); i++ ){
     334  for ( CFFListIterator i=sqrfreelist; i.hasItem(); i++ )
     335  {
    324336    elem=i.getItem().factor();
    325337    if ( cls(elem) > 0 ) output.append(elem);
     
    363375  CFListIterator j ;
    364376
    365   for ( int J=1; J<= n ; J++ ){
     377  for ( int J=1; J<= n ; J++ )
     378  {
    366379    testlist.append(CanonicalForm(Variable(J)));
    367380  }
     
    370383
    371384  // remove already removed factors
    372   for ( j = Remembern.FS2 ; j.hasItem(); j++ ){
     385  for ( j = Remembern.FS2 ; j.hasItem(); j++ )
     386  {
    373387    testelem = j.getItem();
    374     while ( 1 ){
     388    while ( 1 )
     389    {
    375390      test = mydivremt(r,testelem,a,b);
    376391      if ( test && b == r.genZero() ) r = a;
     
    380395
    381396  // Let's look if we have other canditates to remove
    382   for ( j = testlist ; j.hasItem(); j++ ){
     397  for ( j = testlist ; j.hasItem(); j++ )
     398  {
    383399    testelem = j.getItem();
    384400//    if ( testelem != r && testelem != r.mvar() ){
    385     if ( testelem != r ){
    386       while ( 1 ){
     401    if ( testelem != r )
     402    {
     403      while ( 1 )
     404      {
    387405        test = divremt(r,testelem,a,b);
    388         if ( test && b == r.genZero() ){
     406        if ( test && b == r.genZero() )
     407        {
    389408          Remembern.FS2= Union(Remembern.FS2, CFList(testelem));
    390409          r = a;
     
    404423// all irreducible nonconstant factors of a set of polynomials
    405424CFList
    406 factorps( const CFList &ps ){
     425factorps( const CFList &ps )
     426{
    407427  CFList qs;
    408428  CFFList q;
    409429  CanonicalForm elem;
    410430
    411   for ( CFListIterator i=ps; i. hasItem(); i++ ){
     431  for ( CFListIterator i=ps; i. hasItem(); i++ )
     432  {
    412433    q=Factorize(i.getItem());
    413434    q.removeFirst();
    414435    // Next can be simplified ( first (already removed) elem in q is the only constant
    415     for ( CFFListIterator j=q; j.hasItem(); j++ ){
     436    for ( CFFListIterator j=q; j.hasItem(); j++ )
     437    {
    416438      elem = j.getItem().factor();
    417439      if ( getNumVars(elem) > 0 )
     
    424446// the initial of poly f wrt to the order of the variables
    425447static CanonicalForm
    426 inital( const CanonicalForm &f ){
     448inital( const CanonicalForm &f )
     449{
    427450  CanonicalForm leadcoeff;
    428451
    429452  if ( cls(f) == 0 ) {return f.genOne(); }
    430   else {
     453  else
     454  {
    431455    leadcoeff = LC(f,lvar(f));
    432456    //    if ( leadcoeff != 0 )
     
    873897/*
    874898$Log: not supported by cvs2svn $
     899Revision 1.13  2006/06/19 13:37:47  Singular
     900*hannes: more CS renamed
     901
    875902Revision 1.12  2006/05/16 14:46:49  Singular
    876903*hannes: gcc 4.1 fixes
  • libfac/factor/Factor.cc

    rc3c515 r38e7b3  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22///////////////////////////////////////////////////////////////////////////////
    3 static char * rcsid = "$Id: Factor.cc,v 1.23 2006-05-16 14:46:49 Singular Exp $ ";
     3static char * rcsid = "$Id: Factor.cc,v 1.24 2007-05-15 14:46:48 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///////////////////////////////////////////////////////////////////////////////
     
    343343    if ( level(compress(g,m)) == (vars_left) ) // exactly one variable less
    344344      if ( SqrFreeTest(g,1) ) // poly is sqrfree
    345         if ( mygcd(g,g.deriv()) == 1 ) // Discriminante != 0
     345        if ( gcd(g,g.deriv()) == 1 ) // Discriminante != 0
    346346           return 1;
    347347  return 0;
     
    431431///////////////////////////////////////////////////////////////
    432432static int
    433 try_specializePoly(const CanonicalForm & f, const Variable & Extension, int deg, SFormList & Substitutionlist, int ii,int j){
     433try_specializePoly(const CanonicalForm & f, const Variable & Extension, int deg, SFormList & Substitutionlist, int ii,int j)
     434{
    434435  int ok,i= ii;
    435436  CanonicalForm ff= f;
     
    440441  }
    441442
    442   if ( degree(Extension) > 0 ){ // working over Extensions
     443  if ( degree(Extension) > 0 )
     444  { // working over Extensions
    443445    DEBOUTLN(CERR, "try_specializePoly: working over Extensions: ", Extension);
    444     AlgExtGenerator g(Extension);
    445     for ( int k=i ; k<j ; k++ ){ // try to find specialization for all
    446                                  // variables (# = k ) beginning with the
     446    if (Extension.level() > 0)
     447    {
     448    //  AlgExtGenerator g(Extension,minpoly );
     449    //  for ( int k=i ; k<j ; k++ ) // try to find specialization for all
     450    //  {                           // variables (# = k ) beginning with the
     451    //                             // starting value i
     452    //    ok= specialize_agvariable( ff, deg, Substitutionlist, k, j, g );
     453    //    if ( ! ok ) return 0; // we failed
     454    //  }
     455      printf("libfac: try_specializePoly: extension level >0\n");
     456      return 0; // we failed
     457    }
     458    else
     459    {
     460      AlgExtGenerator g(Extension);
     461      for ( int k=i ; k<j ; k++ ) // try to find specialization for all
     462      {                           // variables (# = k ) beginning with the
    447463                                 // starting value i
    448       ok= specialize_agvariable( ff, deg, Substitutionlist, k, j, g );
    449       if ( ! ok ) return 0; // we failed
     464        ok= specialize_agvariable( ff, deg, Substitutionlist, k, j, g );
     465        if ( ! ok ) return 0; // we failed
     466      }
    450467    }
    451468  }
     
    658675    ff = f.deriv();
    659676    TIMING_START(discr_time);
    660     ffuni = mygcd(f,ff);
     677    ffuni = gcd(f,ff);
    661678    TIMING_END(discr_time);
    662679    if ( !(ffuni.isOne()) ){ //discriminante nonzero: split poly
     
    692709  lt = LC(f);
    693710  DEBOUTLN(CERR, "Leading term: ", lt);
    694   if ( lt != f.genOne() ){
     711  if ( lt != f.genOne() )
     712  {
    695713    // make the polynomial monic in the main variable
    696714    ff = make_monic(f,lt); ffuni = ff;
     
    702720  success=evaluate(min(10,max(degree(ff), 5)), min(degree(ff),3), min(degree(ff),3), ff, Extension, alpha, Substitutionlist,UnivariateFactorlist);
    703721  DEBOUTLN(CERR,  "Returned from evaluate: success: ", success);
    704   for ( SFormListIterator ii=Substitutionlist; ii.hasItem(); ii++ ){
     722  for ( SFormListIterator ii=Substitutionlist; ii.hasItem(); ii++ )
     723  {
    705724    DEBOUTLN(CERR, "Substituting ", ii.getItem().factor());
    706725    DEBOUTLN(CERR, "       with value: ", ii.getItem().exp());
    707726  }
    708727
    709   if ( success==0 ){ // evalute wasn't successfull
     728  if ( success==0 ) // evalute wasn't successfull
     729  {
    710730    success= specializePoly(ffuni,Extension,degree(ff),Substitutionlist,1,getNumVars(compress(ff,m)));
    711731    DEBOUTLN(CERR,  "Returned from specializePoly: success: ", success);
    712     if (success == 0 ){ // No spezialisation could be found
     732    if (success == 0 ) // No spezialisation could be found
     733    {
    713734#ifdef HAVE_SINGULAR_ERROR
    714735      WarnS("libfac: Factorize: ERROR: Not able to find a valid specialization!");
     
    731752    ffuni = substitutePoly(ff,Substitutionlist);
    732753    // We now have an univariat poly; factorize that
    733     if ( degree(Extension) == 0   ){
     754    if ( degree(Extension) == 0   )
     755    {
    734756      DEBOUTMSG(CERR, "Univ. Factorization over the ground field");
    735757      UnivariateFactorlist = factorize(ffuni,1); // univ. poly is sqr-free!
    736758    }
    737     else{
     759    else
     760    {
    738761      DEBOUTLN(CERR, "Univ. Factorization over extension of degree ",
    739762               degree(getMipo(Extension,'x')) );
     
    748771    }
    749772  }
    750   else{
     773  else
     774  {
    751775    ffuni = substitutePoly(ff,Substitutionlist);
    752776  }
    753777    TIMING_END(evaluate_time);
    754   if (UnivariateFactorlist.length() == 1){ // poly is irreduzibel
     778  if (UnivariateFactorlist.length() == 1)
     779  { // poly is irreduzibel
    755780    DEBOUTLN(CERR, "Univ. poly is irreduzible: ", UnivariateFactorlist);
    756781    Outputlist.append(CFFactor(F,1));
    757782    return Outputlist;
    758783  }
    759   else{ // we have factors
     784  else
     785  { // we have factors
    760786    DEBOUTSL(CERR);
    761787    DEBOUT(CERR, "Univariate poly has " , UnivariateFactorlist.length());
     
    812838///////////////////////////////////////////////////////////////
    813839int find_mvar(const CanonicalForm &f);
    814 CFFList
    815 Factorize(const CanonicalForm & F, int is_SqrFree ){
     840CFFList Factorize(const CanonicalForm & F, int is_SqrFree )
     841{
    816842  CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2;
    817843  ListIterator<CFFactor> i,j;
     
    828854  DEBOUTMSG(CERR, rcsid);
    829855  DEBOUTLN(CERR, "Called with F= ", F);
    830   if ( getCharacteristic() == 0 ) { // char == 0
     856  if ( getCharacteristic() == 0 )
     857  { // char == 0
    831858    TIMING_START(factorize_time);
    832859    //CERR << "Factoring in char=0 of " << F << " = " << Outputlist << "\n";
     
    858885  ///////
    859886  //  if ( ! SqrFreeTest(F) ){
    860   if ( ! is_SqrFree ){
     887  if ( ! is_SqrFree )
     888  {
    861889    TIMING_START(sqrfree_time);
    862890    SqrFreeList = InternalSqrFree(F) ; // first sqrfree the polynomial
     
    874902    SqrFreeList.append(CFFactor(F,1));
    875903  DEBOUTLN(CERR, "InternalSqrFreeList= ", SqrFreeList);
    876   for ( i=SqrFreeList; i.hasItem(); i++ ){
     904  for ( i=SqrFreeList; i.hasItem(); i++ )
     905  {
    877906    DEBOUTLN(CERR, "Factor under consideration: ", i.getItem().factor());
    878907    // We need a compress on each list item ! Maybe we have less variables!
     
    882911      Outputlist.append( CFFactor(g,1) ) ;
    883912    else// a real polynomial
    884       if ( g.isUnivariate() ){
     913      if ( g.isUnivariate() )
     914      {
    885915        Intermediatelist=factorize(g,1); // poly is sqr-free!
    886916        for ( j=Intermediatelist; j.hasItem(); j++ )
     
    888918          Outputlist.append( CFFactor( m(j.getItem().factor()),exp*j.getItem().exp()));
    889919      }
    890       else{ // multivariate polynomial
    891         if ( g.isHomogeneous() ){
     920      else
     921      { // multivariate polynomial
     922        if ( g.isHomogeneous() )
     923        {
    892924          DEBOUTLN(CERR, "Poly is homogeneous! : ", g);
    893925          // Now we can substitute one variable to 1, factorize and then
     
    911943  DEBOUTLN(CERR, "Outputlist is ", Outputlist);
    912944  for ( i=Outputlist; i.hasItem(); i++ )
    913     if ( level(i.getItem().factor()) > 0 ){
     945    if ( level(i.getItem().factor()) > 0 )
     946    {
    914947      unit = lc(i.getItem().factor());
    915       if ( getNumVars(unit) == 0 ){ // a constant; possibly 1
     948      if ( getNumVars(unit) == 0 )
     949      { // a constant; possibly 1
    916950        Outputlist2.append(CFFactor(i.getItem().factor()/unit , i.getItem().exp()));
    917951        g *=power(i.getItem().factor()/unit,i.getItem().exp());
    918952      }
    919       else{
     953      else
     954      {
    920955        Outputlist2.append(i.getItem());
    921956        g *=power(i.getItem().factor(),i.getItem().exp());
     
    959994///////////////////////////////////////////////////////////////
    960995CFFList
    961 Factorize(const CanonicalForm & F, const CanonicalForm & minpoly, int is_SqrFree ){
     996Factorize(const CanonicalForm & F, const CanonicalForm & minpoly, int is_SqrFree )
     997{
    962998  CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2;
    963999  ListIterator<CFFactor> i,j;
     
    11321168/*
    11331169$Log: not supported by cvs2svn $
     1170Revision 1.23  2006/05/16 14:46:49  Singular
     1171*hannes: gcc 4.1 fixes
     1172
    11341173Revision 1.22  2006/04/28 13:46:29  Singular
    11351174*hannes: better tests for 0, 1
  • libfac/factor/MVMultiHensel.cc

    rc3c515 r38e7b3  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.9 2006-05-16 14:46:49 Singular Exp $";
     4// static char * rcsid = "$Id: MVMultiHensel.cc,v 1.10 2007-05-15 14:46:49 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    2929#ifdef SINGULAR
    3030#define HAVE_SINGULAR_ERROR
     31#ifndef NOSTREAMIO
     32void out_cf(char *s1,const CanonicalForm &f,char *s2);
     33#endif
    3134#endif
    3235
    3336#ifdef HAVE_SINGULAR_ERROR
    34    extern "C" { void WerrorS(char *); }
     37   extern "C"
     38   {
     39     void WerrorS(char *);
     40     void Werror(const char *fmt, ...);
     41   }
    3542#endif
    3643
     
    97104      ia[ix].calculated=false;
    98105      ia[ix].poly=0;
    99     } 
     106    }
    100107  }
    101108// internal data representation
     
    111118///////////////////////////////////////////////////////////////
    112119static DiophantForm
    113 diophant( int levelU , const CanonicalForm & F1 , const CanonicalForm & F2 , int i , RememberArray & A, RememberArray & B ) {
     120diophant( int levelU , const CanonicalForm & F1 , const CanonicalForm & F2 , int i , RememberArray & A, RememberArray & B )
     121{
    114122  DiophantForm Retvalue;
    115123  CanonicalForm s,t,q,r;
     
    121129  // Did we solve the diophantine equation yet?
    122130  // If so, return the calculated values
    123   if (A.checksize(i) && A[i].calculated && B[i].calculated ){
     131  if (A.checksize(i) && A[i].calculated && B[i].calculated )
     132  {
    124133    Retvalue.One=A[i].poly;
    125134    Retvalue.Two=B[i].poly;
     
    128137
    129138  // Degrees ok? degree(F1,mainvar) + degree(F2,mainvar) <= i ?
    130   if ( (degree(F1,levelU) + degree(F2,levelU) ) <= i ) {
     139  if ( (degree(F1,levelU) + degree(F2,levelU) ) <= i )
     140  {
    131141#ifdef HAVE_SINGULAR_ERROR
    132     WerrorS("libfac: diophant ERROR: degree too large!  ");
     142    Werror("libfac: diophant ERROR: degree too large!  (%d + %d <= %d)",degree(F1,levelU), degree(F2,levelU), i);
     143      //out_cf("F1:",F1,"\n");
     144      //out_cf("F2:",F2,"\n");
    133145#else
    134146#ifndef NOSTREAMIO
     
    143155  }
    144156
    145   if ( i == 0 ) { // call the extended gcd
     157  if ( i == 0 )
     158  { // call the extended gcd
    146159    r=extgcd(F1,F2,s,t);
    147160    // check if gcd(F1,F2) <> 1 , i.e. F1 and F2 are not relatively prime
    148     if ( ! r.isOne() ){
     161    if ( ! r.isOne() )
     162    {
    149163#ifdef HAVE_SINGULAR_ERROR
    150164      WerrorS("libfac: diophant ERROR: F1 and F2 are not relatively prime! ");
     165      //out_cf("F1:",F1,"\n");
     166      //out_cf("F2:",F2,"\n");
    151167#else
    152168#ifndef NOSTREAMIO
     
    162178    Retvalue.One = s; Retvalue.Two = t;
    163179  }
    164   else { // recursively call diophant
     180  else
     181  { // recursively call diophant
    165182    Retvalue=diophant(levelU,F1,F2,i-1,A,B);
    166183    Retvalue.One *= x; // createVar(levelU,1);
     
    168185    // Check degrees.
    169186
    170     if ( degree(Retvalue.One,levelU) > degree(F2,levelU) ){
     187    if ( degree(Retvalue.One,levelU) > degree(F2,levelU) )
     188    {
    171189      // Make degree(Retvalue.one,mainvar) < degree(F2,mainvar)
    172190      divrem(Retvalue.One,F2,q,r);
    173191      Retvalue.One = r; Retvalue.Two += F1*q;
    174192    }
    175     else {
    176       if ( degree(Retvalue.Two,levelU) >= degree(F1,levelU) ){
     193    else
     194    {
     195      if ( degree(Retvalue.Two,levelU) >= degree(F1,levelU) )
     196      {
    177197        // Make degree(Retvalue.Two,mainvar) <= degree(F1,mainvar)
    178198        divrem(Retvalue.Two,F1,q,r);
     
    430450/*
    431451$Log: not supported by cvs2svn $
     452Revision 1.9  2006/05/16 14:46:49  Singular
     453*hannes: gcc 4.1 fixes
     454
    432455Revision 1.8  2002/07/30 15:11:19  Singular
    433456*hannes: minor cleanups
  • libfac/factor/SqrFree.cc

    rc3c515 r38e7b3  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: SqrFree.cc,v 1.10 2006-05-16 14:46:50 Singular Exp $";
     4static char * rcsid = "$Id: SqrFree.cc,v 1.11 2007-05-15 14:46:49 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///////////////////////////////////////////////////////////////////////////////
     
    149149    // Next: it would be best to have a *univariate* gcd-test which returns
    150150    // 0 iff gcdtest(f,g) == 1 or a constant ( for real Polynomials )
    151     g = mygcd(f,g);
     151    g = gcd(f,g);
    152152    if ( g.isOne() || (-g).isOne() ) return 1;
    153153    else
     
    182182    // Next: it would be best to have a *multivariate* gcd-test which returns
    183183    // 0 iff gcdtest(f,g) == 1 or a constant ( for real Polynomials )
    184     g= mygcd(f,g);
     184    g= gcd(f,g);
    185185    if ( g.isOne() || (-g).isOne() || (g==f) || (getNumVars(g)==0) ) return 1 ;
    186186    else return 0 ;
     
    294294  }
    295295  g = f.deriv();
    296   DEBOUTLN(CERR, "calculating mygcd of ", f);
     296  DEBOUTLN(CERR, "calculating gcd of ", f);
    297297  DEBOUTLN(CERR, "               and ", g);
    298   h = mygcd(f,pp(g));  h /= lc(h);
    299   DEBOUTLN(CERR,"mygcd(f,g)= ",h);
     298  h = gcd(f,pp(g));  h /= lc(h);
     299  DEBOUTLN(CERR,"gcd(f,g)= ",h);
    300300  if ( (h.isOne()) || ( h==f) || ((-h).isOne()) || getNumVars(h)==0 ) { // no common factor
    301301    Outputlist= myappend(Outputlist,CFFactor(f,1)) ;
     
    415415/*
    416416$Log: not supported by cvs2svn $
     417Revision 1.10  2006/05/16 14:46:50  Singular
     418*hannes: gcc 4.1 fixes
     419
    417420Revision 1.9  2006/04/28 13:46:29  Singular
    418421*hannes: better tests for 0, 1
  • libfac/factor/helpstuff.h

    rc3c515 r38e7b3  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: helpstuff.h,v 1.3 1997-09-12 07:19:57 Singular Exp $
     4// $Id: helpstuff.h,v 1.4 2007-05-15 14:46:49 Singular Exp $
    55////////////////////////////////////////////////////////////
    66#ifndef HELPSTUFF_H
     
    2727  return (a>b ? a:b);
    2828}
    29 //////////////////
    30 // For testing  //
    31 //////////////////
    32 #ifdef SPARSEGCD
    33 #include "gcd.h"
    34 #define mygcd(f,g) \
    35 ((CanonicalForm) sparsemod( f,  g ))
    36 #else
    37 #define mygcd(f,g) \
    38 ((CanonicalForm) gcd( f, g ))
    39 #endif
    40 
    4129#endif /* HELPSTUFF_H */
    4230
     
    4432/*
    4533$Log: not supported by cvs2svn $
     34Revision 1.3  1997/09/12 07:19:57  Singular
     35* hannes/michael: libfac-0.3.0
     36
    4637Revision 1.2  1997/04/25 22:23:49  michael
    4738Version for libfac-0.2.1
  • libfac/factor/test.cc

    rc3c515 r38e7b3  
    1 //static char rcsid[] = "@(#) $Id: test.cc,v 1.2 1997-06-09 15:56:11 Singular Exp $";
     1//static char rcsid[] = "@(#) $Id: test.cc,v 1.3 2007-05-15 14:46:49 Singular Exp $";
    22///////////////////////////////////////////////////////////////////////////////
    33// CLAP - Includes
     
    2727//    cout << SqrFree(f) << endl << endl;
    2828//cout << "gcd(f,f.deriv())= gcd(" << f << "," << f.deriv() << ")= " << gcd(f,f.deriv()) << endl;
    29 //cout << "mygcd(f,f.deriv())= mygcd(" << f << "," << f.deriv() << ")= " << mygcd(f,f.deriv()) << endl;
     29//cout << "gcd(f,f.deriv())= gcd(" << f << "," << f.deriv() << ")= " << gcd(f,f.deriv()) << endl;
    3030        Factorlist = Factorize( f );
    3131        cout << Factorlist ;//<< endl;
Note: See TracChangeset for help on using the changeset viewer.