Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Charles R Harris
On Wed, Apr 30, 2008 at 9:16 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > > > Some operations on stacks of small matrices are easy to get, for > instance, > > +,-,*,/, and matrix multiply. The last is the interesting one. If A and > B > > are st

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Timothy Hochberg
On Wed, Apr 30, 2008 at 8:16 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > > > Some operations on stacks of small matrices are easy to get, for > instance, > > +,-,*,/, and matrix multiply. The last is the interesting one. If A and B > > are stac

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Anne Archibald
2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > Some operations on stacks of small matrices are easy to get, for instance, > +,-,*,/, and matrix multiply. The last is the interesting one. If A and B > are stacks of matrices with the same number of dimensions with the matrices > stored in the las

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Charles R Harris
On Tue, Apr 29, 2008 at 1:22 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > Let me throw out a couple of more thoughts: > > First, there seems to be disagreement about what a row_vector and > column_vector are (and even if they are sensible concepts, but let's leave > that aside for moment).

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 30/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 2:18 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: > > It is actually pretty unreasonable to hope that > > > > A[0] > > > > and > > > > A[[1,2,3]] > > or > > A[[True,False,True]] > > > > should re

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Christopher Barker apparently wrote: > a really good argument for: > A * B.col[i] Also see the syntax discussed in Proposal 5. (I am not expressing an opinion.) http://www.scipy.org/MatrixIndexing#proposal-5> One possibility is to let the rows and cols methods

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, "Travis E. Oliphant" apparently wrote: > x[i,:] * A * x[:,i] This need is also fully met by Proposal 5. It is just a matter of syntax and sticking with matrices. http://www.scipy.org/MatrixIndexing#proposal-5> E.g., x.rows(i) * A * x.cols(i) Cheers, Alan Isaac __

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Keith Goodman
On Tue, Apr 29, 2008 at 2:18 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > On 29/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > > 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

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 03:03:51PM -0700, Christopher Barker wrote: > Gael Varoquaux wrote: > > However I would find it nice that, for linear algebra, > > x[i, :] == x[:, i].T > > This is the kind of behavior I expect, and we won't be getting it with 1D > > arrays. > But you WOULD get it with 1-

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Timothy Hochberg
On Tue, Apr 29, 2008 at 2:43 PM, Christopher Barker <[EMAIL PROTECTED]> wrote: > Timothy Hochberg wrote: > > However, there is matrix related > > stuff that is at best poorly supported now, namely operations on stacks > > of arrays (or vectors). > > Tim, this is important, but also appears to be a

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Gael Varoquaux wrote: > However I would find it nice that, for linear algebra, > x[i, :] == x[:, i].T > > This is the kind of behavior I expect, and we won't be getting it with 1D > arrays. But you WOULD get it with 1-d row/column objects. I'm going to try to summarize what I think is clear fro

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Bruce Southey wrote: > The ability to treat vectors as matrices would be sufficient for my > needs because these are almost always used in the context of > vector-matrix multiplication. There is no additional benefit from > having row or column shapes or metadata because the row/column nature > is

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Keith Goodman wrote: > It would seem odd to me if x[i,:] > returned different types of objects based on the type of i: I think this is where matrices should act like arrays: >>> a array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> a[:,[1]] array([[1], [4], [7]]) >>>

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Travis E. Oliphant
> I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > object? Does this not require many special-case bits of code as well? > What about a[i,...]? That is what I would use to make a hierarchical > bit of code, and I would be startled to find myself in an infinite > loop waitin

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Timothy Hochberg wrote: > However, there is matrix related > stuff that is at best poorly supported now, namely operations on stacks > of arrays (or vectors). Tim, this is important, but also appears to be an orthogonal issue to me -- whatever we do with matrices, rows, columns, whatever, we st

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 11:16:15PM +0200, Anne Archibald wrote: > On 29/04/2008, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > > > object? > > It breaks

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
> It breaks A*B[i, :] where A and B are matrices. > > A*B[:,i], surely. right. which is a really good argument for: A * B.col[i] (and .row, or course) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Travis E. Oliphant
Gael Varoquaux wrote: > On Tue, Apr 29, 2008 at 10:49:50AM -0500, Travis E. Oliphant wrote: > >> As the number of special-case work-arounds grows the more I'm convinced >> the conceptualization is wrong. So, I now believe we should change the >> a[i] for matrices to return a 1-d array. >>

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Charles R Harris
On Tue, Apr 29, 2008 at 3:07 PM, Gael Varoquaux < [EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > > object? > > It breaks A*B[i, :] where A and B are matrices. A*B[:,i], surel

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > 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

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Timothy Hochberg
On Tue, Apr 29, 2008 at 2:07 PM, Gael Varoquaux < [EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > > object? > > It breaks A*B[i, :] where A and B are matrices. Shouldn't that

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > > object? > > It breaks A*B[i, :] where A and B are matrices. Really? How? In [26]: A = np.matr

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > object? It breaks A*B[i, :] where A and B are matrices. Gaël ___ Numpy-discussion mailing list Numpy-discussion@sc

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > I'm quite persuaded now that a[i] should return a 1-d object for > arrays.In addition to the places Chuck identified, there are at > least 2 other places where special code was written to work-around the > expectation that ite

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Keith Goodman apparently wrote: > here's a use case that currently doesn't work but would be nice > (for me) if it did: > x[idx,i] = M.rand(2,1) I think this is another example of the kind of thing we are trying to fix ... Cheers, Alan Isaac _

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > I think the only correct option is the oriented 1D > objects. The second best option is not to change anything > in order not to break backward compatibility. Maybe the extant ``matrix`` class should be available for a while as ``oldmatri

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Keith Goodman
On Tue, Apr 29, 2008 at 12:50 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:46 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > > On Tue, 29 Apr 2008, Keith Goodman apparently wrote: > > >

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Bruce Southey
Hi, On Tue, Apr 29, 2008 at 2:22 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > Let me throw out a couple of more thoughts: > > First, there seems to be disagreement about what a row_vector and > column_vector are (and even if they are sensible concepts, but let's leave > that aside for momen

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Keith Goodman
On Tue, Apr 29, 2008 at 11:46 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > 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 hop

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 03:32:17PM -0400, Alan G Isaac wrote: > On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > > Could you remind me which one it is? > Proposal #6 at > http://www.scipy.org/MatrixIndexing#list-of-proposals> > is my effort to summarize what Tim was proposing. > It does n

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 12:22:18PM -0700, Timothy Hochberg wrote: >First, there seems to be disagreement about what a row_vector and >column_vector are (and even if they are sensible concepts, but let's leave >that aside for moment). One school of thought is that they are >one-dimen

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > Could you remind me which one it is? Proposal #6 at http://www.scipy.org/MatrixIndexing#list-of-proposals> is my effort to summarize what Tim was proposing. It does not include the oriented 1d vectors that I think you need (if I have under

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 03:20:02PM -0400, Alan G Isaac wrote: > On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > > x[i, :]*A*x[:, i] > > I find this cleaner, because more explicit, than x[i]*A*x[:, i]. > >> a. would e.g. ``x[i:i+1,:]`` > > No way. > So *if* ``x[0]`` is going to

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Timothy Hochberg
Let me throw out a couple of more thoughts: First, there seems to be disagreement about what a row_vector and column_vector are (and even if they are sensible concepts, but let's leave that aside for moment). One school of thought is that they are one-dimensional objects that have some orientation

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > x[i, :]*A*x[:, i] > I find this cleaner, because more explicit, than x[i]*A*x[:, i]. >> a. would e.g. ``x[i:i+1,:]`` > No way. So *if* ``x[0]`` is going to be 1d to fix the many anomalies that have surfaced, then you would still

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 02:41:45PM -0400, Alan G Isaac wrote: > On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > > I really don't like a[i] != a[i,:]. > Tim H's proposal avoids that problem. > What do you think of it? Sorry, I guess I am lost. Could you remind me which one it is? Given ho

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
I will answer this question too, because I feel like Keith. On Tue, Apr 29, 2008 at 02:21:34PM -0400, Alan G Isaac wrote: > 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.

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Charles R Harris
On Tue, Apr 29, 2008 at 12:41 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > > I really don't like a[i] != a[i,:]. > > Tim H's proposal avoids that problem. > What do you think of it? > > Of course, now we will have to remove all that special

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Keith Goodman
On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > 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 circumst

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Gael Varoquaux apparently wrote: > I really don't like a[i] != a[i,:]. Tim H's proposal avoids that problem. What do you think of it? > I also don't like loosing the information that you are > doing linear algebra. Hmmm. Is it a given that asking for ``a[i]`` is "doing

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread 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? 2. Would any or all of the following be just as good a result?

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Gael Varoquaux
On Tue, Apr 29, 2008 at 10:49:50AM -0500, Travis E. Oliphant wrote: > As the number of special-case work-arounds grows the more I'm convinced > the conceptualization is wrong. So, I now believe we should change the > a[i] for matrices to return a 1-d array. > The only down-side I see is that

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Keith Goodman
On Tue, Apr 29, 2008 at 10:11 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > indexing should should work just like ndarray indexing, > except that when it produces a 2d result then a matrix > is returned. (This means giving up the current behavior > of ``x[0,:]``.) I often use x[i,:] and x[:,i] wh

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Alan G Isaac wrote: > Perhaps I should note that I have come around to what > I take to be Tim H's view that matrix indexing should should > work just like ndarray indexing, except that when it > produces a 2d result then a matrix is returned. (This means > giving up the current behavior of ``

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
>> http://www.scipy.org/MatrixIndexing#guidelines> On Tue, 29 Apr 2008, Christopher Barker apparently wrote: > Here are a few comments on that text In response, I have modified http://www.scipy.org/MatrixIndexing#guidelines> to try to clarify what was meant and perhaps to address your core c

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Christopher Barker
Alan G Isaac wrote: > For useful reference, these are now here: > http://www.scipy.org/MatrixIndexing#guidelines> Thanks Alan, Here are a few comments on that text (I know, I really should go dig up my scipy password...) > 1. Do we want to be able to extract a single row or column from a > m

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Travis E. Oliphant
Charles R Harris wrote: > > > On Tue, Apr 29, 2008 at 7:24 AM, Stéfan van der Walt <[EMAIL PROTECTED] > > wrote: > > Hi Charles > > 2008/4/29 Charles R Harris <[EMAIL PROTECTED] > >: > > May I add that if I edit defmatrix.py to ac

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Charles R Harris
On Tue, Apr 29, 2008 at 7:24 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > Hi Charles > > 2008/4/29 Charles R Harris <[EMAIL PROTECTED]>: > > May I add that if I edit defmatrix.py to act like an array for scalar > > indexing, then the following works. > > > > In [1]: a = matrix(eye(2)) > >

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Stéfan van der Walt apparently wrote: > We were thinking of raising a warning on scalar indexing > for 1.1, but given the above, would that be sensical? There seem to be three basic proposals for scalar indexing: - raise an error - return a 1d array - return a new type of 1

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Alan G Isaac
On Tue, 29 Apr 2008, Charles R Harris apparently wrote: > There are recursive routines that expect the dimensions to > decrease on each call. I have added your example as anomaly #2 at the very top of the discussion page: http://www.scipy.org/MatrixIndexing> Cheers, Alan Isaac _

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Stéfan van der Walt
Hi Charles 2008/4/29 Charles R Harris <[EMAIL PROTECTED]>: > May I add that if I edit defmatrix.py to act like an array for scalar > indexing, then the following works. > > In [1]: a = matrix(eye(2)) > > In [2]: array([a,a]) > Out[2]: > array([[[ 1., 0.], > [ 0., 1.]], > >[[ 1.,

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-28 Thread Charles R Harris
On Tue, Apr 29, 2008 at 12:20 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Mon, 28 Apr 2008, Christopher Barker apparently wrote: > > I'm going to try to put down what I think are the key, > > very simple, questions: > > For useful reference, these are now here: > http://www.scipy.org/MatrixIn

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-28 Thread Alan G Isaac
On Mon, 28 Apr 2008, Christopher Barker apparently wrote: > I'm going to try to put down what I think are the key, > very simple, questions: For useful reference, these are now here: http://www.scipy.org/MatrixIndexing#guidelines> Cheers, Alan ___ N

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-28 Thread Christopher Barker
oops, typo! Christopher Barker wrote: > Gael Varoquaux wrote: >> I don't know why people are indexing matrices with A[x][y], but they >> shouldn't. > > I think there has been a misunderstanding here. I don't think anyone is > suggesting that if a coder wants an element of a matrix, that s/he >

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-28 Thread Christopher Barker
Gael Varoquaux wrote: > * to use a syntax similar to dictionnaries: > > for row in A.rows(): > for col in row.cols() > > I actually think this is much better than the code you currently use, > > * or implement row and column objects. > > The problem in your code is that you do not d

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-28 Thread Christopher Barker
Gael Varoquaux wrote: > On Fri, Apr 25, 2008 at 01:40:29PM -0400, Alan G Isaac wrote: >> In contrast, there *is* universal agreement that >> x[0][0]==x[0,0] is desirable. Or so I've understood the >> discussion. > I don't know why people are indexing matrices with A[x][y], but they > shouldn't.

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, "Travis E. Oliphant" apparently wrote: > I'm not personally persuaded by the iteration argument, because we can > change iteration independently of mapping (__getitem__) access. Would that not impose another deviation from array behavior? I just do not see the purpose. I s

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Travis E. Oliphant
Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > >> For me this is wrong. list and tuples are not 2D. Numpy >> arrays happen to offer this feature, but you should not >> use it do to multiple dimension indexing. >> > > But there is no proposal that people sho

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 02:32:01PM -0400, Alan G Isaac wrote: > A list of lists is naturally conceived as 2d, > which is why you can initialize a 2d matrix > with a list of lists. > Try a Google search on "python two dimensional list" > to confirm that I am not promoting an anomalous view. > So I

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
>> On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: >>> I don't see where you get your universality. > On Sat, Apr 26, 2008 at 11:15:14AM -0400, Alan G Isaac > wrote: >> Lists, tuples, arrays ... >> Where is the exception? >> Only matrices are the only 2d container I can >> think of tha

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 02:01:45PM -0400, Alan G Isaac wrote: > >>> A > matrix([[1, 2], > [ 3, 4]]) > >>> A = np.mat(x) > >>> for row in A: > ... for col in row: > ... print col > ... > [[1 2]] > [[3 4]] > So are you saying that one should not

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > For me this is wrong. list and tuples are not 2D. Numpy > arrays happen to offer this feature, but you should not > use it do to multiple dimension indexing. But there is no proposal that people should index like this. The underlying issue

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 11:15:14AM -0400, Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > > I don't see where you get your universality. > Lists, tuples, arrays ... > Where is the exception? > Only matrices are the only 2d container I can > think of that are broken t

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Sat, Apr 26, 2008 at 11:13:12AM -0400, Alan G Isaac wrote: > On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > > I claim b is more important than a. IMHO, a is plain > > wrong: you should't be indexing x with x[0][0]. > Why?? Because a 2D object is not a list of list. It is more than

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > We may desagree on what is Right, but the breaks backward > compatibility, and thus is a breakage and should be given > a lot of thought. I agree with this. I am a matrix user, and I have given it a lot of thought. I have been making t

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > I don't see where you get your universality. Lists, tuples, arrays ... Where is the exception? Only matrices are the only 2d container I can think of that are broken this way. Cheers, Alan Isaac __

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Alan G Isaac
On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote: > I claim b is more important than a. IMHO, a is plain > wrong: you should't be indexing x with x[0][0]. Why?? Would you say this about a 2d array? Why the difference? The core argument has been that it is a **basic expectation** of the be

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Fri, Apr 25, 2008 at 01:40:29PM -0400, Alan G Isaac wrote: > On Fri, 25 Apr 2008, Stéfan van der Walt wrote: > > workaround would break x[0] == x[0,:] > But there is not universal agreement that x[0] == x[0,:] is > desirable. In contrast, there *is* universal agreement that > x[0][0]==x[0,0

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-26 Thread Gael Varoquaux
On Fri, Apr 25, 2008 at 01:04:53PM -0400, Alan G Isaac wrote: > On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote: > > The agreement was: > > a) That x[0][0] should be equal to x[0,0] and > > b) That x[0,:] should be equal to x[0] (as for ndarrays) > 1. This is **not** what I understood a

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
>> On Fri, 25 Apr 2008, Christopher Barker apparently wrote: >>> I think a Vector object would allow both of: >>> M[i,j] == M[i][j] >>> and >>> M[i] == M[i,:] > On Fri, Apr 25, 2008 at 2:57 PM, Alan G Isaac > <[EMAIL PROTECTED]> wrote: >> The problem is that it would be a crime to give up >>

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Charles R Harris
On Fri, Apr 25, 2008 at 2:57 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Fri, 25 Apr 2008, Christopher Barker apparently wrote: > > I think a Vector object would allow both of: > > M[i,j] == M[i][j] > > and > > M[i] == M[i,:] > > The problem is that it would be a crime to give up > the natura

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
On Fri, 25 Apr 2008, Christopher Barker apparently wrote: > I think a Vector object would allow both of: > M[i,j] == M[i][j] > and > M[i] == M[i,:] The problem is that it would be a crime to give up the natural production of submatrices. The NATURAL RULE is: to get a submatrix, use nonscalar

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Christopher Barker
Alan G Isaac wrote: > Please return 1d arrays in response to scalar > indexing as the provisional arrangement. +1 (for the provisional solution) This has clarified it a bit for me. The current situation allows one to create "row vectors" and "column vectors" by generating matrices (in various w

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Anne Archibald
On 25/04/2008, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On Fri, Apr 25, 2008 at 12:02 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > I think we have discovered that there is a basic conflict > > between two behaviors: > > > >x[0] == x[0,:] > >vs. > > > >x[0][0] ==

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Charles R Harris
On Fri, Apr 25, 2008 at 12:02 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote: > > Reverted in r5084. > > Thank you. > > I think we have discovered that there is a basic conflict > between two behaviors: > >x[0] == x[0,:] >vs.

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote: > Reverted in r5084. Thank you. I think we have discovered that there is a basic conflict between two behaviors: x[0] == x[0,:] vs. x[0][0] == x[0,0] To my recollection, everyone has agree that the second beha

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
On Fri, 25 Apr 2008, Stéfan van der Walt wrote: > workaround would break x[0] == x[0,:] But there is not universal agreement that x[0] == x[0,:] is desirable. In contrast, there *is* universal agreement that x[0][0]==x[0,0] is desirable. Or so I've understood the discussion. As you know, my

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Stéfan van der Walt
2008/4/25 Alan G Isaac <[EMAIL PROTECTED]>: > 1. This is **not** what I understood as the agreement > (and I think the current solution is bad). Reverted in r5084. Cheers Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://proje

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
On Fri, 25 Apr 2008, Jarrod Millman apparently wrote: > I would like, so I can't tell if there is anything so > uncontroversial that it would make sense to change for the > 1.1.0 release. I think it is clear from reactions that the revision r5072 to matrix behavior should NOT go into any releas

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Alan G Isaac
> 2008/4/25 Alan G Isaac <[EMAIL PROTECTED]>: >> I must have misunderstood: >> I thought the agreement was to >> provisionally return a 1d array for x[0], >> while we hashed through the other proposals. On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote: > The agreement was: > a) That x