Changeset c8302b in git


Ignore:
Timestamp:
May 9, 2012, 10:52:48 AM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
75f10d0ac85a8bbe7d3c995ee023d8aaaf4a6c9b
Parents:
5c0bf0e51f96eb0ce4f2b693d76e67b7ab513d4e68a3479934a843315e00106eafa5f39066a82124
Message:
Merge pull request #103 from mmklee/factory_fixes_sw

Factory fixes sw
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • factory/DegreePattern.cc

    r5c0bf0 rc8302b  
    3434  int p= getCharacteristic();
    3535  int d= 0;
    36   char cGFName;
     36  char cGFName= 'Z';
    3737  if (CFFactory::gettype() == GaloisFieldDomain)
    3838  {
  • factory/FLINTconvert.cc

    r5c0bf0 rc8302b  
    265265{
    266266  CFFList result;
    267   result.insert (CFFactor (CanonicalForm ((long) leadingCoeff), 1));
     267  if (leadingCoeff != 1)
     268    result.insert (CFFactor (CanonicalForm ((long) leadingCoeff), 1));
    268269
    269270  long i;
  • factory/cfNewtonPolygon.cc

    r5c0bf0 rc8302b  
    601601{
    602602  int n;
    603   int ** newtonPolyg;
     603  int ** newtonPolyg= NULL;
    604604  if (computeMA)
    605605  {
  • factory/cf_factor.cc

    r5c0bf0 rc8302b  
    441441      F= convertFLINTnmod_poly_factor2FacCFFList (result, leadingCoeff, f.mvar());
    442442      nmod_poly_factor_clear (result);
     443      nmod_poly_clear (f1);
    443444#else
    444445#ifdef HAVE_NTL
     
    542543      else
    543544#endif //HAVE_NTL
    544 #endif //HAVE_FLINT
    545545      {  // Use Factory without NTL
    546546        if ( isOn( SW_BERLEKAMP ) )
     
    549549          F=FpFactorizeUnivariateCZ( f, issqrfree, 0, Variable(), Variable() );
    550550      }
     551#endif //HAVE_FLINT
    551552    }
    552553    else
  • factory/cf_gcd_smallp.cc

    r5c0bf0 rc8302b  
    15961596  bool fail= false;
    15971597  bool inextension= false;
    1598   bool inextensionextension= false;
    1599   bool topLevel2= false;
     1598  topLevel= false;
    16001599  CFList source, dest;
    16011600  int bound1= degree (ppA, 1);
     
    16141613      G_random_element=
    16151614      GCD_small_p (ppA (random_element,x), ppB (random_element,x),
    1616                    coF_random_element, coG_random_element, topLevel2,
     1615                   coF_random_element, coG_random_element, topLevel,
    16171616                   list);
    16181617      TIMING_END_AND_PRINT (gcd_recursion,
     
    16271626      GCD_Fp_extension (ppA (random_element, x), ppB (random_element, x),
    16281627                        coF_random_element, coG_random_element, alpha,
    1629                         list, topLevel2);
     1628                        list, topLevel);
    16301629      TIMING_END_AND_PRINT (gcd_recursion,
    16311630                            "time for recursive call: ");
     
    16531652      GCD_Fp_extension (ppA (random_element, x), ppB (random_element, x),
    16541653                        coF_random_element, coG_random_element, alpha,
    1655                         list, topLevel2);
     1654                        list, topLevel);
    16561655      TIMING_END_AND_PRINT (gcd_recursion,
    16571656                            "time for recursive call: ");
     
    16981697      DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf2));
    16991698
    1700       inextensionextension= true;
    17011699      for (CFListIterator i= l; i.hasItem(); i++)
    17021700        i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
     
    17221720      GCD_Fp_extension (ppA (random_element, x), ppB (random_element, x),
    17231721                        coF_random_element, coG_random_element, V_buf,
    1724                         list, topLevel2);
     1722                        list, topLevel);
    17251723      TIMING_END_AND_PRINT (gcd_recursion,
    17261724                            "time for recursive call: ");
     
    30233021    }
    30243022
    3025     long rk;
    30263023    matColumns= biggestSize2 - 1;
    30273024    matRows= 0;
     
    30293026    {
    30303027      if (V_buf.level() == 1)
    3031         rk= gaussianElimFp (pMat[i], pL[i]);
     3028        (void) gaussianElimFp (pMat[i], pL[i]);
    30323029      else
    3033         rk= gaussianElimFq (pMat[i], pL[i], V_buf);
     3030        (void) gaussianElimFq (pMat[i], pL[i], V_buf);
    30343031
    30353032      if (pMat[i] (coeffMonoms[i].size(), coeffMonoms[i].size()) == 0)
     
    37063703  topLevel= false;
    37073704  bool inextension= false;
    3708   bool inextensionextension= false;
    37093705  Variable V_buf, alpha;
    37103706  CanonicalForm prim_elem, im_prim_elem;
     
    38073803      DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf2));
    38083804
    3809       inextensionextension= true;
    38103805      for (CFListIterator i= l; i.hasItem(); i++)
    38113806        i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
     
    40094004          DEBOUTLN (cerr, "getMipo (alpha)= " << getMipo (V_buf2));
    40104005
    4011           inextensionextension= true;
    40124006          for (CFListIterator i= l; i.hasItem(); i++)
    40134007            i.getItem()= mapUp (i.getItem(), alpha, V_buf, prim_elem,
  • factory/facFactorize.cc

    r5c0bf0 rc8302b  
    321321  if (!pass)
    322322  {
    323     int lev;
     323    int lev= 0;
    324324    for (int i= 1; i <= LCF.level(); i++)
    325325    {
  • factory/facFqBivar.cc

    r5c0bf0 rc8302b  
    4141#include "NTLconvert.h"
    4242
     43#ifdef HAVE_FLINT
     44#include "FLINTconvert.h"
     45#endif
     46
    4347TIMING_DEFINE_PRINT(fac_uni_factorizer)
    4448TIMING_DEFINE_PRINT(fac_hensel_lift12)
     
    145149{
    146150  Variable x= A.mvar();
    147   ASSERT (A.isUnivariate() || A.inCoeffDomain(),
     151  if (A.inCoeffDomain())
     152    return CFList();
     153  ASSERT (A.isUnivariate(),
    148154          "univariate polynomial expected or constant expected");
    149155  CFFList factorsA;
     
    215221  else
    216222  {
     223#ifdef HAVE_FLINT
     224    nmod_poly_t FLINTA;
     225    convertFacCF2nmod_poly_t (FLINTA, A);
     226    nmod_poly_factor_t result;
     227    nmod_poly_factor_init (result);
     228    mp_limb_t leadingCoeff= nmod_poly_factor (result, FLINTA);
     229    factorsA= convertFLINTnmod_poly_factor2FacCFFList (result, leadingCoeff, x);
     230    if (factorsA.getFirst().factor().inCoeffDomain())
     231      factorsA.removeFirst();
     232    nmod_poly_factor_clear (result);
     233    nmod_poly_clear (FLINTA);
     234#else
    217235    if (getCharacteristic() > 2)
    218236    {
     
    232250                                                          x);
    233251    }
     252#endif
    234253  }
    235254  CFList uniFactors;
     
    648667  zz_p::init (getCharacteristic());
    649668  zz_pX NTLIrredpoly;
    650   int i, m;
     669  int i=1, m= 2;
    651670  // extension of F_p needed
    652671  if (alpha.level() == 1 && beta.level() == 1 && k == 1)
     
    22652284                  )
    22662285{
    2267   bool irreducible= false;
    22682286  int d;
    22692287  int* bounds= computeBounds (F, d);
     
    23282346        if (NTLN.NumCols() == 1)
    23292347        {
    2330           irreducible= true;
    23312348          delete [] A;
    23322349          delete [] bounds;
     
    23982415                  )
    23992416{
    2400   bool irreducible= false;
    24012417  int d;
    24022418  int* bounds= computeBounds (F, d);
     
    24612477        if (NTLN.NumCols() == 1)
    24622478        {
    2463           irreducible= true;
    24642479          delete [] A;
    24652480          delete [] bounds;
     
    25332548  int degMipo= degree (getMipo (info.getAlpha()));
    25342549  Variable alpha= info.getAlpha();
    2535   bool irreducible= false;
    25362550  int d;
    25372551  int* bounds= computeBounds (F, d);
     
    26502664        if (NTLN.NumCols() == 1)
    26512665        {
    2652           irreducible= true;
    26532666          Variable y= Variable (2);
    26542667          CanonicalForm tmp= F (y - evaluation, y);
     
    27222735                    const Variable& alpha, int precision)
    27232736{
    2724   bool irreducible= false;
    27252737  int d;
    27262738  int* bounds= computeBounds (F, d);
     
    27862798        if (NTLN.NumCols() == 1)
    27872799        {
    2788           irreducible= true;
    27892800          delete [] A;
    27902801          delete [] bounds;
     
    28442855                       )
    28452856{
    2846   bool irreducible= false;
    28472857  int d;
    28482858  int* bounds= computeBounds (F, d);
     
    29082918        if (NTLN.NumCols() == 1)
    29092919        {
    2910           irreducible= true;
    29112920          delete [] A;
    29122921          delete [] bounds;
     
    29762985{
    29772986  CFList result= CFList();
    2978   bool irreducible= false;
    29792987  CFArray * A= new CFArray [factors.length()];
    29802988  int oldL2= oldL/2;
     
    30333041        if (NTLN.NumCols() == 1)
    30343042        {
    3035           irreducible= true;
    30363043          delete [] A;
    30373044          return CFList (F);
     
    30413048    if (NTLN.NumCols() == 1)
    30423049    {
    3043       irreducible= true;
    30443050      delete [] A;
    30453051      return CFList (F);
     
    30833089{
    30843090  CFList result= CFList();
    3085   bool irreducible= false;
    30863091  CFArray * A= new CFArray [factors.length()];
    30873092  int oldL2= oldL/2;
     
    31373142        if (NTLN.NumCols() == 1)
    31383143        {
    3139           irreducible= true;
    31403144          delete [] A;
    31413145          return CFList (F);
     
    31453149    if (NTLN.NumCols() == 1)
    31463150    {
    3147       irreducible= true;
    31483151      delete [] A;
    31493152      return CFList (F);
     
    31913194{
    31923195  CFList result= CFList();
    3193   bool irreducible= false;
    31943196  CFArray * A= new CFArray [factors.length()];
    31953197  int oldL2= oldL/2; //be careful
     
    33023304        if (NTLN.NumCols() == 1)
    33033305        {
    3304           irreducible= true;
    33053306          Variable y= Variable (2);
    33063307          CanonicalForm tmp= F (y - evaluation, y);
     
    33143315    if (NTLN.NumCols() == 1)
    33153316    {
    3316       irreducible= true;
    33173317      Variable y= Variable (2);
    33183318      CanonicalForm tmp= F (y - evaluation, y);
     
    33633363{
    33643364  CFList result= CFList();
    3365   bool irreducible= false;
    33663365  CFArray * A= new CFArray [factors.length()];
    33673366  int extensionDeg= degree (getMipo (alpha));
     
    34183417        if (NTLN.NumCols() == 1)
    34193418        {
    3420           irreducible= true;
    34213419          delete [] A;
    34223420          return CFList (F);
  • factory/facFqBivarUtil.cc

    r5c0bf0 rc8302b  
    669669  int** newtonPolyg= newtonPolygon (F, sizeOfNewtonPolygon);
    670670
    671   int minXIndex= 0, minYIndex= 0, maxXIndex= 0, maxYIndex= 0;
    672671  int minX, minY, maxX, maxY;
    673672  minX= newtonPolyg [0] [0];
     
    678677  {
    679678    if (minX > newtonPolyg [i] [0])
    680     {
    681679      minX= newtonPolyg [i] [0];
    682       minXIndex= i;
    683     }
    684680    if (maxX < newtonPolyg [i] [0])
    685     {
    686681      maxX= newtonPolyg [i] [0];
    687       maxXIndex= i;
    688     }
    689682    if (minY > newtonPolyg [i] [1])
    690     {
    691683      minY= newtonPolyg [i] [1];
    692       minYIndex= i;
    693     }
    694684    if (maxY < newtonPolyg [i] [1])
    695     {
    696685      maxY= newtonPolyg [i] [1];
    697       maxYIndex= i;
    698     }
    699686  }
    700687
  • factory/facFqFactorize.cc

    r5c0bf0 rc8302b  
    14991499  if (!pass)
    15001500  {
    1501     int lev;
     1501    int lev= 0;
    15021502    // LCF is non-constant here
    15031503    for (int i= 1; i <= LCF.level(); i++)
  • factory/facMul.cc

    r5c0bf0 rc8302b  
    107107
    108108  fmpz_poly_t FLINTA,FLINTB;
    109   fmpz_poly_init (FLINTA);
    110   fmpz_poly_init (FLINTB);
    111109  kronSub (FLINTA, A, d);
    112110  kronSub (FLINTB, B, d);
     
    217215
    218216  fmpz_poly_t FLINTA,FLINTB;
    219   fmpz_poly_init (FLINTA);
    220   fmpz_poly_init (FLINTB);
    221217  kronSub (FLINTA, A, d);
    222218  kronSub (FLINTB, B, d);
     
    13571353
    13581354  nmod_poly_t F1, F2;
    1359   mp_limb_t ninv= n_preinvert_limb (getCharacteristic());
    1360   nmod_poly_init_preinv (F1, getCharacteristic(), ninv);
    1361   nmod_poly_init_preinv (F2, getCharacteristic(), ninv);
    13621355  kronSubReciproFp (F1, F2, F, d1);
    13631356
    13641357  nmod_poly_t G1, G2;
    1365   nmod_poly_init_preinv (G1, getCharacteristic(), ninv);
    1366   nmod_poly_init_preinv (G2, getCharacteristic(), ninv);
    13671358  kronSubReciproFp (G1, G2, G, d1);
    13681359
     
    14091400
    14101401  nmod_poly_t FLINTA, FLINTB;
    1411   mp_limb_t ninv= n_preinvert_limb (getCharacteristic());
    1412   nmod_poly_init_preinv (FLINTA, getCharacteristic(), ninv);
    1413   nmod_poly_init_preinv (FLINTB, getCharacteristic(), ninv);
    14141402  kronSubFp (FLINTA, A, d1);
    14151403  kronSubFp (FLINTB, B, d1);
     
    14341422
    14351423  fmpz_poly_t F1, F2;
    1436   fmpz_poly_init (F1);
    1437   fmpz_poly_init (F2);
    14381424  kronSubReciproQ (F1, F2, F, d1);
    14391425
    14401426  fmpz_poly_t G1, G2;
    1441   fmpz_poly_init (G1);
    1442   fmpz_poly_init (G2);
    14431427  kronSubReciproQ (G1, G2, G, d1);
    14441428
     
    14831467
    14841468  fmpz_poly_t FLINTA, FLINTB;
    1485   fmpz_poly_init (FLINTA);
    1486   fmpz_poly_init (FLINTB);
    14871469  kronSub (FLINTA, A, d1);
    14881470  kronSub (FLINTB, B, d1);
  • libpolys/polys/clapsing.cc

    r68a3479 rc8302b  
    501501}
    502502
    503 static int primepower(int c, const ring r)
    504 {
    505   int p=1;
    506   int cc=c;
    507   while(cc!= rChar(r)) { cc*=c; p++; }
    508   return p;
    509 }
    510 
    511503BOOLEAN count_Factors(ideal I, intvec *v,int j, poly &f, poly fac, const ring r)
    512504{
Note: See TracChangeset for help on using the changeset viewer.