#13140: OS X Lion doctest failures for double dense QR decomposition
----------------------------------+-----------------------------------------
       Reporter:  jdemeyer        |         Owner:  jason, was  
           Type:  defect          |        Status:  needs_review
       Priority:  major           |     Milestone:  sage-5.2    
      Component:  linear algebra  |    Resolution:              
       Keywords:                  |   Work issues:              
Report Upstream:  N/A             |     Reviewers:              
        Authors:  John Palmieri   |     Merged in:              
   Dependencies:                  |      Stopgaps:              
----------------------------------+-----------------------------------------

Comment (by rbeezer):

 Replying to [comment:3 jhpalmieri]:
 > Here's a possible patch. Rob, what do you think?

 Dear John,

 Thanks for working on this.  This should be my mess to cleanup, but I have
 not had a chance to get to it.

 Some comments.  I get 7 doctest failures.  This is on 5.1.beta3, but the
 offending #10795 applied cleanly, along with your #13140.

 It looks to me like the following stanza in `_normalize_columns()` finds
 the first negative entry of the column, and adjusts that.  Which would not
 be the leading (non-zero) entry.
 {{{
 #!python
 for j from 0 <= j < M.ncols():
     for i from 0 <= i < M.column(j).degree():
         if M.column(j)[i] < 0:
             M = M.with_rescaled_col(j, -1)
             break
 }}}

 If I replace this with
 {{{
 #!python
 for j from 0 <= j < M.ncols():
     for i from 0 <= i < M.column(j).degree():
         if M.column(j)[i] != 0:
             if M.column(j)[i] < 0:
                 M = M.with_rescaled_col(j, -1)
             break
 }}}

 then the number of failures goes down to 4.  Notice this does not
 carefully consider the possibility of `-0.0` before the desired leading
 entry (can we just test on that literal?).

 Line 2517 (new line number according to patch) has a
 `.normalize_columns()` without an underscore.

 With my change above I think any remaining problems (barring one) are just
 +/- 0 mixups.  It might make sense to normalize first, then round/clip to
 six places.

 Most critically - `Q*R` should be the original matrix.  So if we adjust a
 column of `Q`, then we need to adjust a '''row''' of `R` before testing
 `Q*R == A`.  We could test this property '''before''' normalizing.  Then a
 companion `_normalize_rows()` might be indicated before displaying `Q` and
 `R`.  But still, the rows of `R` to normalize may not be the same as the
 columns of `Q` to normalize.

 I'll do my best to stick with this one, but the next three days are full
 of family obligations (taking care of the parental generation!).

 Thanks again for working on this.  It'd be good to have a pair of these
 normalization routines available.

 Rob

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