Changeset 865b20 in git


Ignore:
Timestamp:
Aug 15, 2012, 7:55:06 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cbf866d4f8c3861325311c042cb2033c053453b2')
Children:
0beffdffc2fb65355384c180d0a9d06b7b0312cf
Parents:
6caad65fe9bcc8eacbc315b1b090770683668e8e
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-08-15 19:55:06+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-08-15 19:59:03+02:00
Message:
fixed a bug in naInvers for the case of non-irreducible minpoly and division by a zero-divisor
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/ext_fields/algext.cc

    r6caad65 r865b20  
    394394  if (a == NULL) return NULL;
    395395  poly bInverse = (poly)naInvers(b, cf);
    396   poly aDivB = p_Mult_q(p_Copy((poly)a, naRing), bInverse, naRing);
    397   definiteReduce(aDivB, naMinpoly, cf);
    398   return (number)aDivB;
     396  if(bInverse != NULL) // b is non-zero divisor!
     397  {
     398    poly aDivB = p_Mult_q(p_Copy((poly)a, naRing), bInverse, naRing);
     399    definiteReduce(aDivB, naMinpoly, cf);
     400    return (number)aDivB;
     401  }
     402  return NULL;
    399403}
    400404
     
    655659  naTest(a);
    656660  if (a == NULL) WerrorS(nDivBy0);
     661 
    657662  poly aFactor = NULL; poly mFactor = NULL;
    658663  poly theGcd = p_ExtGcd((poly)a, aFactor, naMinpoly, mFactor, naRing);
     664 
    659665  naTest((number)theGcd); naTest((number)aFactor); naTest((number)mFactor);
    660   /* the gcd must be 1 since naMinpoly is irreducible and a != NULL: */
    661   assume(naIsOne((number)theGcd, cf));
     666  p_Delete(&mFactor, naRing);
     667 
     668  //  /* the gcd must be 1 since naMinpoly is irreducible and a != NULL: */
     669  //  assume(naIsOne((number)theGcd, cf));
     670
     671  if( !naIsOne((number)theGcd, cf) )
     672  { 
     673    WerrorS("zero divisor found - your minpoly is not irreducible");
     674    p_Delete(&aFactor, naRing); aFactor = NULL;
     675  }
    662676  p_Delete(&theGcd, naRing);
    663   p_Delete(&mFactor, naRing);
     677
    664678  return (number)(aFactor);
    665679}
Note: See TracChangeset for help on using the changeset viewer.