#13878: Fix failing assertion in linbox/matrix/permutation-matrix.h
--------------------------------------------+-------------------------------
       Reporter:  SimonKing                 |         Owner:  jason, was
           Type:  defect                    |        Status:  new       
       Priority:  major                     |     Milestone:  sage-5.6  
      Component:  linear algebra            |    Resolution:            
       Keywords:  debug, linbox, assertion  |   Work issues:            
Report Upstream:  N/A                       |     Reviewers:            
        Authors:                            |     Merged in:            
   Dependencies:                            |      Stopgaps:            
--------------------------------------------+-------------------------------

Comment (by nbruin):

 Offending code is this:
 {{{
 cdef inline linbox_echelonize_efd(celement modulus, celement* entries,
 Py_ssize_t nrows, Py_ssize_t ncols):
     cdef ModField *F = new ModField(<long>modulus)
     cdef EchelonFormDomain *EF = new EchelonFormDomain(F[0])
     cdef BlasMatrix *A = new BlasMatrix(F[0], <uint64_t>nrows,
 <uint64_t>ncols)
     cdef BlasMatrix *E = new BlasMatrix(F[0], <uint64_t>nrows,
 <uint64_t>ncols)

     cdef Py_ssize_t i,j

     # TODO: can we avoid this copy?
     for i in range(nrows):
         for j in range(ncols):
             A.setEntry(i, j, <ModFieldElement>entries[i*ncols+j])

     cdef int r = EF.rowReducedEchelon(E[0], A[0])
     for i in range(nrows):
         for j in range(ncols):
             entries[i*ncols+j] = <celement>E.getEntry(i,j)

     cdef Py_ssize_t ii = 0
     cdef list pivots = []
     for i in range(r):
         for j in range(ii,ncols):
             if entries[i*ncols+j] == 1:
                 pivots.append(j)
                 ii = j+1
                 break

     del F, A, E, EF
     return r, pivots
 }}}
 This gets called with `nrows=0`, so `A` does not get initialized with
 anything (there's noting to set!). I suppose linbox should handle such an
 edge case, but I haven't checked their doc to see if they exclude it as
 valid. Obviously, it's easy to special case this degeneracy: If `nrows=0`
 then we should return 0,[]. It's probably worthwhile to fix this, but I'm
 pretty sure this is not a source for bugs otherwise.

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