#13571: Matrix Entries Can Be Callable Objects not tested
---------------------------------+------------------------------------------
       Reporter:  startakovsky   |         Owner:  tbd     
           Type:  defect         |        Status:  closed  
       Priority:  minor          |     Milestone:  sage-5.5
      Component:  PLEASE CHANGE  |    Resolution:  invalid 
       Keywords:                 |   Work issues:          
Report Upstream:  N/A            |     Reviewers:          
        Authors:                 |     Merged in:          
   Dependencies:                 |      Stopgaps:          
---------------------------------+------------------------------------------
Changes (by mhansen):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 It gives examples of passing in a callable object:

 {{{

 sage: m = matrix(QQ, 3, 3, lambda i, j: i+j); m
 [0 1 2]
 [1 2 3]
 [2 3 4]
 sage: m = matrix(3, lambda i,j: i-j); m
 [ 0 -1 -2]
 [ 1  0 -1]
 [ 2  1  0]
 sage: matrix(QQ,2,3,lambda x, y: x+y)
 [0 1 2]
 [1 2 3]
 sage: matrix(QQ,3,2,lambda x, y: x+y)
 [0 1]
 [1 2]
 [2 3]
 }}}

 It is impossible to get a _matrix_ like
 {{{
 ['apple', 'frog']
 [[3,2]  , 3     ]
 }}}
 since a matrix requires that the entries be elements of a ring (so things
 like multiplication and addition are defined).  You could either use a
 list of lists or a numpy array like

 {{{
 sage: import numpy as np
 sage: a = np.array([['apple', 'frog'],[[3,2], 3]], dtype=object); a
 array([[apple, frog],
        [[3, 2], 3]], dtype=object)
 sage: a[1,0]
 [3, 2]
 sage: a.transpose()
 array([[apple, [3, 2]],
        [frog, 3]], dtype=object)
 }}}

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