On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac
On Tue, 29 Apr 2008, Keith Goodman apparently wrote:
I often use x[i,:] and x[:,i] where x is a matrix and i is a scalar. I hope this continues to return a matrix.
1. Could you give an example of the circumstances of this use?
In my use i is most commonly an array (i = M.where(y.A)[0] where y is a nx1 matrix), sometimes a list, and in ipython when debugging or first writing the code, a scalar. It would seem odd to me if x[i,:] returned different types of objects based on the type of i: array index idx = M.where(y.A)[0] where y is a nx1 matrix x[dx,:] --> matrix list index idx = [0] x[idx,:] --> matrix? scalar index idx = 0 x[idx,:] --> not matrix
2. Would any or all of the following be just as good a result? a. 1d matrix b. row and column vectors (1d but "oriented" for linear algebra purposes)
For me, having arrays and matrices is confusing enough. Adding row and column objects sounds even more confusing.
3. If 2a. and 2b. are no good for you, a. would e.g. ``x[i:i+1,:]`` be too burdensome?
Yes.
b. would ``rows`` and ``columns`` attributes that yielded matrics be an offsetting convenience?
I like the idea, from earlier in the thread, of row and col being iterators for those time when you want to work on one column or row at a time.