Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Christopher Barker
Alan G Isaac wrote: > On Fri, 22 Feb 2008, Christopher Barker apparently wrote: >> because that's the whole point of a Matrix object in the >> first place. > > Do you really believe that? As phrased?? yes -- the matrix object is about style, not functionality -- not that style isn't important

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Alan G Isaac
> Alan G Isaac wrote: >> I propose that the user-friendly question is: >> why deviate needlessly from array behavior? >> (Needlessly means: no increase in functionality.) On Fri, 22 Feb 2008, Christopher Barker apparently wrote: > because that's the whole point of a Matrix object in the > first

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Christopher Barker
Alan G Isaac wrote: > I propose that the user-friendly question is: > why deviate needlessly from array behavior? because that's the whole point of a Matrix object in the first place. > (Needlessly means: no increase in functionality.) Functionally, you can do everything you need to do with nump

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Alan G Isaac
On Fri, 22 Feb 2008, Christopher Barker apparently wrote: > It makes me think that M[i] should not even be possible, > as you would always want one of: > row vector: M[i,:] > column vector: M[:,i] > element: M[i,j] I propose that the user-friendly question is: why deviate needlessly from a

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Christopher Barker
Travis E. Oliphant wrote: > to behave as you described in your previous post: where M[i] returned a > 1-d array My thoughts on this: As Konrad suggested, row vectors and column vectors are different beasts ,and both need to be easily and intuitively available. M[i] returning a 1-d array break

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Alan G Isaac
On Fri, 22 Feb 2008, "Travis E. Oliphant" apparently wrote: > Do I understand correctly, that by intuitive you mean > based on experience with lists, and NumPy arrays? Yes. In particular, array behavior is quite lovely and almost never surprising, so matrices should deviate from it only when th

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
Alan G Isaac wrote: > >> stop believing that M[0][0] and M[0,0] should return the >> same thing. There is nothing in Python that requires >> this. >> > > I never suggested there is. > My question "how to guess?" does not imply that. > > My point is: the matrix object could have more intui

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Alan G Isaac
On Fri, 22 Feb 2008, "Travis E. Oliphant" apparently wrote: > The point is that a matrix object is a > matrix object and not a generic container. I see the point a bit differently: there are costs and benefits to the abandonment of a specific and natural behavior of containers. (The kind of beha

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
> >> Could you explain to me how you'd like this to be fixed? If the >> matrix becomes a container of 1-d arrays, then you can no longer >> expect x[:,0] to return a column vector -- which was one >> of the reasons the matrix class was created. While not >> entirely consistent, one workaround

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
> On Fri, 22 Feb 2008, Stefan van der Walt apparently wrote: > >> This is exactly what I would expect for matrices: M[0] is >> the first row of the matrix. >> > > Define what "first row" means! > Konrad has shown that do "get it right" you really have to introduce three separate thing

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Konrad Hinsen
On Feb 22, 2008, at 15:55, Travis E. Oliphant wrote: >> ColumnVector, and RowVector. It would work like this: >> >> m = Matrix([[1, 2], [3, 4]]) >> >> m[0, :] --> ColumnVector([1, 3]) >> m[:, 0] --> RowVector([1, 2]) >> > These seem backward to me.I would think that m[0,:] would be the > RowV

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
Konrad Hinsen wrote: > On 22.02.2008, at 01:10, Alan G Isaac wrote: > > >> Someone once pointed out on this list that one might >> consider a matrix to be a container of 1d vectors. For NumPy, >> however, it is natural that it be a container of 1d arrays. >> (See the discussion for the distinct

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Alan G Isaac
>>> On Thu, Feb 21, 2008 at 12:08:32PM -0500, Alan G Isaac >>> wrote: a matrix behavior that I find bothersome and unnatural:: >>> M = N.mat('1 2;3 4') >>> M[0] matrix([[1, 2]]) >>> M[0][0] matrix([[1, 2]]) On Fri, 22 Feb 2008, Stefan van der Walt apparently wrote:

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Stefan van der Walt
On Thu, Feb 21, 2008 at 07:10:24PM -0500, Alan G Isaac wrote: > > On Thu, Feb 21, 2008 at 12:08:32PM -0500, Alan G Isaac wrote: > >> a matrix behavior that I find bothersome and unnatural:: > > >> >>> M = N.mat('1 2;3 4') > >> >>> M[0] > >> matrix([[1, 2]]) > >> >>> M[0][0] > >>

Re: [Numpy-discussion] matrix wart

2008-02-21 Thread Konrad Hinsen
On 22.02.2008, at 01:10, Alan G Isaac wrote: > Someone once pointed out on this list that one might > consider a matrix to be a container of 1d vectors. For NumPy, > however, it is natural that it be a container of 1d arrays. > (See the discussion for the distinction.) If I were to design a Pyth

Re: [Numpy-discussion] matrix wart

2008-02-21 Thread Alan G Isaac
> On Thu, Feb 21, 2008 at 12:08:32PM -0500, Alan G Isaac wrote: >> a matrix behavior that I find bothersome and unnatural:: >> >>> M = N.mat('1 2;3 4') >> >>> M[0] >> matrix([[1, 2]]) >> >>> M[0][0] >> matrix([[1, 2]]) On Fri, 22 Feb 2008, Stefan van der Walt apparently wrote