Changeset 2878a0 in git


Ignore:
Timestamp:
Jan 25, 2021, 1:42:29 PM (3 years ago)
Author:
Daniel Schultz <tthsqe12@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c7af8613769b29c741d6c338945669719f1fc4f8')
Children:
a4240a2134ce068c6a739e2f0dbc245af4ad8497
Parents:
d854d7ee2faa25bc4e7476b6668602d7f4f39384
git-author:
Daniel Schultz <tthsqe12@gmail.com>2021-01-25 13:42:29+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2021-01-26 11:36:58+01:00
Message:
fix zero divisor bug
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facHensel.cc

    rd854d7 r2878a0  
    161161  CanonicalForm inv, leadingCoeff= Lc (F);
    162162  CFListIterator i= bufFactors;
     163
     164  result = CFList();    // empty the list before writing into it?!
     165
    163166  if (bufFactors.getFirst().inCoeffDomain())
    164167  {
     
    789792  CFList recResult;
    790793  CanonicalForm modMipo, mipo;
     794#if HAVE_NTL
     795  // no variables for ntl
     796#else
     797  fmpz_t bigpk;
     798  fq_ctx_t fqctx;
     799  fq_poly_t FLINTS, FLINTT, FLINTbuf3, FLINTbuf1, FLINTbuf2;
     800  fq_t fcheck;
     801#endif
     802
    791803  //here SW_RATIONAL is off
    792804  On (SW_RATIONAL);
     
    810822    if (fail)
    811823    {
     824next_prime:
    812825      int i= 0;
    813       while (cf_getBigPrime (i) < p)
     826      while (cf_getBigPrime (i) <= p)
    814827        i++;
    815828      findGoodPrime (F, i);
     
    874887  result.append (b (convertNTLZZ_pEX2CF (NTLS, x, gamma)));
    875888  result.append (b (convertNTLZZ_pEX2CF (NTLT, x, gamma)));
    876 #else   // flint
    877   fmpz_t bigpk;
    878   fq_ctx_t fqctx;
    879   fmpz_mod_poly_t FLINTmipo;
    880   fq_poly_t FLINTS, FLINTT, FLINTbuf3, FLINTbuf1, FLINTbuf2;
    881   fq_t fcheck;
     889#else // HAVE_FLINT
    882890
    883891  fmpz_init(bigpk); // does convert expect an initalized object?
    884892  convertCF2Fmpz(bigpk, b.getpk());
    885 
     893  fmpz_mod_poly_t FLINTmipo;
    886894  convertFacCF2Fmpz_mod_poly_t(FLINTmipo, getMipo(gamma), bigpk);
    887 
    888895#if __FLINT_RELEASE >= 20700
    889896  fmpz_mod_ctx_t bigpk_ctx;
     
    891898  fq_ctx_init_modulus(fqctx, FLINTmipo, bigpk_ctx, "Z");
    892899  fmpz_mod_ctx_clear(bigpk_ctx);
     900  fmpz_mod_poly_clear(FLINTmipo, bigpk_ctx);
    893901#else
    894902  fq_ctx_init_modulus(fqctx, FLINTmipo, "Z");
     903  fmpz_mod_poly_clear(FLINTmipo);
    895904#endif
    896905
     
    908917  if (!fq_is_one(fcheck, fqctx))
    909918  {
    910     printf("factory error: non-invertible element encountered\n");
    911     abort();
     919    fmpz_clear(bigpk);
     920    fq_clear(fcheck, fqctx);
     921    fq_poly_clear(FLINTS, fqctx);
     922    fq_poly_clear(FLINTT, fqctx);
     923    fq_poly_clear(FLINTbuf3, fqctx);
     924    fq_poly_clear(FLINTbuf1, fqctx);
     925    fq_poly_clear(FLINTbuf2, fqctx);
     926    fq_ctx_clear(fqctx);
     927    setReduce (alpha, false);
     928    fail = true;
     929    goto next_prime;
    912930  }
    913931
     
    928946    XGCD (NTLbuf3, NTLS, NTLT, NTLbuf3, convertFacCF2NTLZZ_pEX (buf1, NTLmipo));
    929947    S= convertNTLZZ_pEX2CF (NTLS, x, gamma);
    930 #else // HAVE_FLINT
     948#else
    931949    fq_poly_clear(FLINTbuf1, fqctx); //convert expects uninitialized!
    932950    convertFacCF2Fq_poly_t(FLINTbuf1, buf1, fqctx);
     
    935953    if (!fq_is_one(fcheck, fqctx))
    936954    {
    937       printf("factory error: non-invertible element encountered\n");
    938       abort();
     955      fmpz_clear(bigpk);
     956      fq_clear(fcheck, fqctx);
     957      fq_poly_clear(FLINTS, fqctx);
     958      fq_poly_clear(FLINTT, fqctx);
     959      fq_poly_clear(FLINTbuf3, fqctx);
     960      fq_poly_clear(FLINTbuf1, fqctx);
     961      fq_poly_clear(FLINTbuf2, fqctx);
     962      fq_ctx_clear(fqctx);
     963      setReduce (alpha, false);
     964      fail = true;
     965      goto next_prime;
    939966    }
    940967
Note: See TracChangeset for help on using the changeset viewer.