#9063: wrong type for denominator
-----------------------------------------+----------------------------------
   Reporter:  cjh                        |       Owner:  AlexGhitza
       Type:  defect                     |      Status:  needs_work
   Priority:  major                      |   Milestone:  sage-4.5.3
  Component:  algebra                    |    Keywords:            
     Author:  Luis Felipe Tabera Alonso  |    Upstream:  N/A       
   Reviewer:  John Cremona               |      Merged:            
Work_issues:                             |  
-----------------------------------------+----------------------------------
Changes (by cremona):

  * status:  needs_review => needs_work
  * reviewer:  => John Cremona


Comment:

 This looks good to me.  It applied ok to 4.5.3.alpha1, and all (long)
 tests pass, except for one:
 {{{

 sage -t -long "sage/matrix/matrix2.pyx"
 **********************************************************************
 File "/storage/jec/sage-4.5.3.alpha1/devel/sage-
 tests/sage/matrix/matrix2.pyx", line 4665:
     sage: M.weak_popov_form()
 Exception raised:
     Traceback (most recent call last):
       File "/home/jec/sage-current/local/bin/ncadoctest.py", line 1231, in
 run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File "/home/jec/sage-current/local/bin/sagedoctest.py", line 38, in
 run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File "/home/jec/sage-current/local/bin/ncadoctest.py", line 1172, in
 run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_68[7]>", line 1, in <module>
         M.weak_popov_form()###line 4665:
     sage: M.weak_popov_form()
       File "matrix2.pyx", line 4748, in
 sage.matrix.matrix2.Matrix.weak_popov_form (sage/matrix/matrix2.c:26417)
         ::
       File "/home/jec/sage-current/local/lib/python/site-
 packages/sage/matrix/matrix_misc.py", line 90, in weak_popov_form
         den = R(lcm([a.denominator() for a in M.list()]))
       File "/home/jec/sage-current/local/lib/python/site-
 packages/sage/rings/arith.py", line 1527, in lcm
         return __LCM_sequence(seq)
       File "/home/jec/sage-current/local/lib/python/site-
 packages/sage/rings/arith.py", line 1583, in __LCM_sequence
         g = vi.lcm(g)
       File "element.pyx", line 306, in
 sage.structure.element.Element.__getattr__ (sage/structure/element.c:2632)
         return getattr_from_other_class(self,
 self.parent().category().element_class, name)
       File "parent.pyx", line 268, in
 sage.structure.parent.getattr_from_other_class
 (sage/structure/parent.c:2835)
         raise_attribute_error(self, name)
       File "parent.pyx", line 170, in
 sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2602)
         raise AttributeError, "'%s.%s' object has no attribute
 '%s'"%(cls.__module__, cls.__name__, name)
     AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int'
 object has no attribute 'lcm'
 **********************************************************************
 1 items had failures:
 }}}

 The problem is in the function weak_popov_form() in
 sage/rings/matrix/matrix_misc.py  (which was only merged into Sage
 receontly -- and I was, by chance, its reviewer).  There one has matrices
 of polynomials over fields and the code tries to clear denominators, by
 forming the LCM of the denominators;  and that now fails when those
 denominators are all equal to 1 in a finite field!

 Rather than mess with the weakpopov form code, this could be solved if
 there was an lcm function for finite field elements which always returned
 1 (except lcm(0,0)=0, perhaps).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9063#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to