Re: [Numpy-discussion] subclassing matrix

2008-01-12 Thread Basilisk96
On Jan 12, 1:36 am, Timothy Hochberg [EMAIL PROTECTED] wrote: I believe that you need to look at __array_finalize__ and __array_priority__ (and there may be one other thing as well, I can't remember; it's late). Search for __array_finalize__ and that will probably help get you started. Well

Re: [Numpy-discussion] subclassing matrix

2008-01-12 Thread Colin J. Williams
Basilisk96 wrote: On Jan 12, 1:36 am, Timothy Hochberg [EMAIL PROTECTED] wrote: I believe that you need to look at __array_finalize__ and __array_priority__ (and there may be one other thing as well, I can't remember; it's late). Search for __array_finalize__ and that will probably help get

Re: [Numpy-discussion] subclassing matrix

2008-01-12 Thread Basilisk96
Thanks Stefan and Colin, The subclass documentation made this a little clearer now. Instead of using a super() call in __new__, I now do this: #construct a matrix based on the input ret = _N.matrix(data, dtype=dtype) #promote it to Vector ret = ret.view(cls) The second statement

Re: [Numpy-discussion] subclassing matrix

2008-01-11 Thread Basilisk96
On Jan 11, 2008, Colin J. Williams wrote: You make a good case that it's good not to need to ponder what sort of vector you are dealing with. My guess is that the answer to your question is no but I would need to play with your code to see that. My feeling is that, at the bottom of the

Re: [Numpy-discussion] subclassing matrix

2008-01-11 Thread Timothy Hochberg
On Jan 11, 2008 9:59 PM, Basilisk96 [EMAIL PROTECTED] wrote: On Jan 11, 2008, Colin J. Williams wrote: You make a good case that it's good not to need to ponder what sort of vector you are dealing with. My guess is that the answer to your question is no but I would need to play

Re: [Numpy-discussion] subclassing matrix

2008-01-10 Thread Colin J. Williams
Basilisk96 wrote: Hello folks, In the course of a project that involved heavy use of geometry and linear algebra, I found it useful to create a Vector subclass of numpy.matrix (represented as a column vector in my case). Why not consider a matrix with a shape of (1, n) as a row vector and

Re: [Numpy-discussion] subclassing matrix

2008-01-10 Thread Basilisk96
Yes, that certainly meets the need. In previous applications, I never thought to use Vector because it was sufficient for me to adopt the convention of a column vector to represent XY points. That way, I could do things like c * R * u + t. Isn't that simple? Not only is it easy on the eyes, but