Changeset b96e07 in git for libfac/charset/alg_factor.cc


Ignore:
Timestamp:
Dec 10, 2004, 11:15:06 AM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
63105e52e5f78a1d812375fc7eca94457d009411
Parents:
b85647b819d6c13a8c294f515242ce32417af0ea
Message:
*pohl: AlgExtGenerator etc.


git-svn-id: file:///usr/local/Singular/svn/trunk@7622 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfac/charset/alg_factor.cc

    rb85647 rb96e07  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: alg_factor.cc,v 1.12 2003-02-18 11:09:25 Singular Exp $";
     5static char * rcsid = "$Id: alg_factor.cc,v 1.13 2004-12-10 10:15:05 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    225225  }
    226226}
     227static void
     228sqrf_agnorm_sub( const CanonicalForm & f, const CanonicalForm & PPalpha,
     229           AlgExtGenerator & myrandom, CanonicalForm & s,  CanonicalForm & g,
     230           CanonicalForm & R){
     231  Variable y=PPalpha.mvar(),vf=f.mvar();
     232  CanonicalForm temp, Palpha=PPalpha, t;
     233  int sqfreetest=0;
     234  CFFList testlist;
     235  CFFListIterator i;
     236
     237  DEBOUTLN(cout, "sqrf_norm_sub:      f= ", f);
     238  DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     239  myrandom.reset();   s=f.mvar()-myrandom.item()*Palpha.mvar();   g=f;
     240  R= CanonicalForm(0);
     241  DEBOUTLN(cout, "sqrf_norm_sub: myrandom s= ", s);
     242
     243  // Norm, resultante taken with respect to y
     244  while ( !sqfreetest ){
     245    DEBOUTLN(cout, "sqrf_norm_sub: Palpha= ", Palpha);
     246    R = resultante(Palpha, g, y); R= R* bCommonDen(R);
     247    DEBOUTLN(cout, "sqrf_norm_sub: R= ", R);
     248    // sqfree check ; R is a polynomial in K[x]
     249    if ( getCharacteristic() == 0 )
     250    {
     251      temp= gcd(R, R.deriv(vf));
     252      DEBOUTLN(cout, "sqrf_norm_sub: temp= ", temp);
     253      if (degree(temp,vf) != 0 || temp == temp.genZero() ){ sqfreetest= 0; }
     254      else { sqfreetest= 1; }
     255      DEBOUTLN(cout, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
     256    }
     257    else{
     258      DEBOUTMSG(cout, "Starting SqrFreeTest(R)!");
     259      // Look at SqrFreeTest!
     260      // (z+a^5+w)^4 with z<w<a should not give sqfreetest=1 !
     261      // for now we use this workaround with Factorize...
     262      // ...but it should go away soon!!!!
     263      Variable X;
     264      if (getAlgVar(R,X))
     265      {
     266        if (R.isUnivariate())
     267          testlist=factorize( R, X );
     268        else
     269          testlist= Factorize(R, X, 0);
     270      }
     271      else
     272        testlist= Factorize(R);
     273      DEBOUTLN(cout, "testlist= ", testlist);
     274      testlist.removeFirst();
     275      sqfreetest=1;
     276      for ( i=testlist; i.hasItem(); i++)
     277        if ( i.getItem().exp() > 1 && degree(i.getItem().factor(), R.mvar()) > 0) { sqfreetest=0; break; }
     278      DEBOUTLN(cout, "SqrFreeTest(R)= ", sqfreetest);
     279    }
     280    if ( ! sqfreetest ){
     281      myrandom.next();
     282      DEBOUTLN(cout, "sqrf_norm_sub generated new myrandom item: ", myrandom.item());
     283      if ( getCharacteristic() == 0 ) t= CanonicalForm(mapinto(myrandom.item()));
     284      else t= CanonicalForm(myrandom.item());
     285      s= f.mvar()+t*Palpha.mvar(); // s defines backsubstitution
     286      DEBOUTLN(cout, "sqrf_norm_sub: testing s= ", s);
     287      g= f(f.mvar()-t*Palpha.mvar(), f.mvar());
     288      DEBOUTLN(cout, "             gives g= ", g);
     289    }
     290  }
     291}
    227292
    228293static void
     
    246311    DEBOUTLN(cout, "sqrf_norm: degree of extension is ", degree(Extension));
    247312    AlgExtGenerator myrandom(Extension);
    248     sqrf_norm_sub(f,PPalpha, myrandom, s,g,R);
     313    sqrf_agnorm_sub(f,PPalpha, myrandom, s,g,R);
    249314  }
    250315  else{
     
    744809/*
    745810$Log: not supported by cvs2svn $
     811Revision 1.12  2003/02/18 11:09:25  Singular
     812* hannes: alg_gcd(f,f'=0) get a special handling
     813
    746814Revision 1.11  2002/10/24 17:22:21  Singular
    747815* hannes: factoring in alg.ext., alg_gcd, NTL stuff
Note: See TracChangeset for help on using the changeset viewer.