#5174: _repr_ for large matrices should indicate how to see the entries
------------------------------+---------------------------------------------
   Reporter:  jason           |       Owner:  was          
       Type:  enhancement     |      Status:  needs_review 
   Priority:  major           |   Milestone:  sage-4.3     
  Component:  linear algebra  |    Keywords:               
Work_issues:                  |      Author:  John Palmieri
   Upstream:  N/A             |    Reviewer:               
     Merged:                  |  
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * author:  => John Palmieri


Comment:

 Here's a patch.  The docstring to the {{{__repr__}}} method for matrices
 illustrates what the patch does:
 {{{
         EXAMPLES::

             sage: A = matrix([[1,2], [3,4], [5,6]])
             sage: A.__repr__()
             '[1 2]\n[3 4]\n[5 6]'
             sage: print A
             [1 2]
             [3 4]
             [5 6]

         If the matrix is too big, don't print all of the elements::

             sage: A = random_matrix(ZZ, 100)
             sage: A.__repr__()
             "100 x 100 dense matrix over Integer Ring (type 'print
 A.str()' to see all of the entries)"
             sage: print A
             100 x 100 dense matrix over Integer Ring (type 'print A.str()'
 to see all of the entries)

         If there are several names for the same matrix, write it as
 "obj"::

             sage: B = A; print B
             100 x 100 dense matrix over Integer Ring (type 'print
 obj.str()' to see all of the entries)
 }}}

 I actually think that this looks a little funny in some situations; for
 example, in chain_complex.py, the old version did this:
 {{{
             sage: C.differential()
             {0: 40 x 40 dense matrix over Integer Ring, 1: []}
 }}}
 while the new version does this:
 {{{
             sage: C.differential()
             {0: 40 x 40 dense matrix over Integer Ring (type 'print
 obj.str()' to see all of the entries), 1: []}
 }}}
 It would be pretty easy to change the print representation so if there
 were no name attached to the object (e.g., if it were produced by another
 method, as in this example), then the extra message about "print ..."
 would be omitted.  Opinions?

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