#10063: Some determinants can not be computed
--------------------------------------------+-------------------------------
   Reporter:  tmonteil                      |       Owner:  tmonteil            
    
       Type:  defect                        |      Status:  needs_work          
    
   Priority:  critical                      |   Milestone:                      
    
  Component:  commutative algebra           |    Keywords:  determinant, ring, 
ideal
     Author:  Thierry Monteil               |    Upstream:  N/A                 
    
   Reviewer:  Mike Hansen, Sébastien Labbé  |      Merged:                      
    
Work_issues:                                |  
--------------------------------------------+-------------------------------

Comment(by tmonteil):

 Hi Sebastien,

 thanks for your comments. As you know, i am not a computer scientist nor a
 programmer, so i do not know much about design principles, but if i had to
 code a determinant function from scratch, knowing that:
  * the determinant is an fundamental function
  * there exist a division-free algorithm that works in any case
  * there are some fast/fancy/pretty/lounge/fieldic... optimizations that
 are very good in some particular cases but not completely finished, i will
 have written a code like (even ''before'' meeting any bug):

 {{{
 try:
     all the kind of optimized algorithms
 except StandardError:
     pass #or send an automatic bug report if the error seems new.
 the division-free algorithm that always works
 }}}

 I do not feel it is a dirty code, since its structure shows that one
 algorithm works everywhere and the other are fragile optimizations.

 Making patches that only repair the bugs found will make a code whose
 architecture depend on the history of the bugs discovery, not necessarily
 a readable code (why is there a test for the `is_field` method and not for
 `is_exact`,...).

 The aim of the Python convention is to avoid masking bugs, but if the
 exception is `NotImplementedError`, then the "bug" is already known, since
 it means that someone wrote an empty method which raises this
 `NotImplementedError`.

 Note also that the Python convention is a bit slower since i have to test
 the `is_field` method even if the algorithm is not `None`. Should i
 replace:
 {{{
 try:
     R_is_field_attempt = R.is_field()
 except NotImplementedError:
     R_is_field_attempt = False

 }}}

 by:

 {{{
 if algorithm is None:
     try:
         R_is_field_attempt = R.is_field()
     except NotImplementedError:
         R_is_field_attempt = False
 }}}

 in order to skip the test when another algorithm is is called?

 Anyway, here is a patch that implements your recommendations (i rename it
 to keep the previous version on the trac server and follow the
 discussion).

 I fixed the problem of the documentation as well (i took the opportunity
 to fix the existing test, which i copied).

 Should we think to clean the whole `determinant` code?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10063#comment:10>
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