#13555: Doctests of random functions needs to be improved.
---------------------------------------------------------------------------------------------+
       Reporter:  JoalHeagney                                                   
             |         Owner:  mvngu   
           Type:  defect                                                        
             |        Status:  new     
       Priority:  major                                                         
             |     Milestone:  sage-5.5
      Component:  doctest                                                       
             |    Resolution:          
       Keywords:  random, matrices, random_matrix, properties of random 
objects, properties  |   Work issues:          
Report Upstream:  N/A                                                           
             |     Reviewers:          
        Authors:                                                                
             |     Merged in:          
   Dependencies:                                                                
             |      Stopgaps:          
---------------------------------------------------------------------------------------------+

Comment (by jhpalmieri):

 You might consider using `all` or `any`:
 {{{
 A = random_matrix(ZZ,5); A
 def checkfunc(matrix, func):
     return any(func(val)==True for val in matrix.list()) # untested
 }}}
 Also, I'm not sure that there is an iterator for the elements of a matrix.
 I guess there's one for the rows (`mat.__iter__()`), and then I guess for
 each row there's one (`row.iteritems()`). I don't see one for all of the
 elements, though. (I tried searching the files in the `matrix` directory
 for "yield" and didn't find much.)

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