Ignore:
Timestamp:
Aug 3, 2012, 1:06:22 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c987db42cd2ec943b97ac5746c99892ceddf909c')
Children:
b0732eb4254fbe76540d72c337f3d7f985adf948
Parents:
b8610796eaca5ba7db8dc75f8bc88d698e077b365abb0e7fdca82a2bad9778e410148c74d7b49a0b
Message:
Merge pull request #162 from steenpass/libs

changes in LIBs from master
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/libfac/factor/Factor.cc

    r5abb0e7 rc10f46  
    2727
    2828#include "alg_factor.h"
    29 void out_cf(char *s1,const CanonicalForm &f,char *s2);
     29void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
    3030void out_cff(CFFList &L);
    3131
     
    5252* ( in factorize, alpha.level() must be < 0 )
    5353*/
     54static
    5455CFFList factorize2 ( const CanonicalForm & f,
    5556                     const Variable & alpha, const CanonicalForm & mipo )
     
    6162  else
    6263  {
    63     bool repl=(f.mvar() != alpha);
    6464    //out_cf("f2 - factor:",f,"\n");
    6565    //out_cf("f2 - ext:",alpha,"\n");
     
    6767    Variable X=rootOf(mipo);
    6868    CanonicalForm F=f;
    69     if (repl) F=replacevar(f,alpha,X);
     69    F=replacevar(f,alpha,X);
    7070    //out_cf("call - factor:",F,"\n");
    7171    //out_cf("call - ext:",X,"\n");
     
    7373    CFFList L=factorize(F,X);
    7474    CFFListIterator i=L;
    75     if (repl)
    7675    {
    7776      CFFList Outputlist;
     
    8281        i.getItem().exp()));
    8382      }
     83      //out_cff(Outputlist);
    8484      return Outputlist;
    8585    }
    86     else return L;
    8786  }
    8887}
     
    393392generate_mipo( int degree_of_Extension , const Variable & Extension ){
    394393  FFRandom gen;
    395   if ( degree(Extension) > 0 ) GFRandom gen;
    396   else {
    397     if ( degree(Extension) == 0 ) FFRandom gen;
    398     else
    399     {
    400       factoryError("libfac: evaluate: Extension not inFF() or inGF() !");
    401     }
    402   }
     394  if (degree (Extension) < 0)
     395    factoryError("libfac: evaluate: Extension not inFF() or inGF() !");
    403396  return find_irreducible( degree_of_Extension, gen, Variable(1) );
    404397}
     
    465458
    466459static int
    467 specializePoly(const CanonicalForm & f, Variable & Extension, int deg, SFormList & Substitutionlist, int i,int j){
     460specializePoly(const CanonicalForm & f, Variable & Extension, int deg, SFormList & Substitutionlist, int i,int j)
     461{
    468462  Variable minpoly= Extension;
    469463  int ok,extended= degree(Extension), working_over_extension;
     
    474468  // First try:
    475469  ok = try_specializePoly(f,minpoly,deg,Substitutionlist,i,j);
    476   while ( ! ok ){ // we have to extend!
     470  while ( ! ok ) // we have to extend!
     471  {
     472    SFormList origS=Substitutionlist;
    477473    extended+= 1;
    478     if ( ! working_over_extension ){
    479       minpoly= rootOf(generate_mipo( extended,Extension ));
     474    if ( ! working_over_extension )
     475    {
     476      if (!hasMipo(Extension))
     477        minpoly= rootOf (generate_mipo (extended, Extension));
     478      else
     479      {
     480        setReduce (Extension, false);
     481        setMipo (minpoly, generate_mipo ( extended, Extension));
     482        setReduce (Extension, true);
     483      }
    480484      Extension= minpoly;
    481485      ok= try_specializePoly(f,minpoly,deg,Substitutionlist,i,j);
     486      if (!ok)
     487        Substitutionlist=origS;
    482488    }
    483489    else
     
    804810{
    805811  //out_cf("Factorize ",F,"\n");
    806   CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2;
    807   ListIterator<CFFactor> i,j;
    808   CanonicalForm g=1,unit=1,r=1;
    809   Variable minpoly; // dummy
    810   int exp;
    811   CFMap m;
     812  CFFList Outputlist;
    812813
    813814  // INTERRUPTHANDLER
     
    831832    return Outputlist;
    832833  }
     834  CFFList SqrFreeList,Intermediatelist,Outputlist2;
     835  ListIterator<CFFactor> i,j;
     836  CanonicalForm g=1,unit=1,r=1;
     837  Variable minpoly; // dummy
     838  int exp;
     839  CFMap m;
    833840  TIMING_START(factorize_time);
    834841  // search an "optimal" main variavble
Note: See TracChangeset for help on using the changeset viewer.