#3436: random_matrix() with prescribed density buggy
------------------------------+---------------------------------------------
   Reporter:  rpw             |       Owner:  was         
       Type:  defect          |      Status:  needs_review
   Priority:  major           |   Milestone:  sage-4.3.1  
  Component:  linear algebra  |    Keywords:              
Work_issues:                  |      Author:  spancratz   
   Upstream:  N/A             |    Reviewer:              
     Merged:                  |  
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * upstream:  => N/A
  * author:  => spancratz


Comment:

 Attached a patch.  It introduces a new method in ``ring.pyx``,
 ``_random_nonzero_element``, which by default calls ``random_element``
 until a non-zero element has been obtained.

 On the matrix end, I've introduced a new parameter ``nonzero`` to the
 ``randomize`` methods in the various matrix implementations.  If this is
 set to ``True``, the modified entries are guaranteed to be non-zero,
 whereas if it is set to ``False`` they are not.  The method
 ``random_element`` on a matrix space now calls ``randomize`` on a zero
 matrix with ``nonzero=True``.

 Finally, this is now also used to ensure that generating a fraction field
 element does not cause a division by zero error.

 Sebastian

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