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
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 h
On Sat, Jan 12, 2008 at 01:24:31PM -0800, Basilisk96 wrote:
[...]
> When is __array_finalize__ called? By adding some print traces, I can
> see it's called every time an array is modified in any way i.e.,
> reshaped, transposed, etc., and also during operations like u+v, u-v,
> A*u. But it's not
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.
>
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
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
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 i
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
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).
I'd like to hear comments about my use of this "class promotion"
statement in __new__:
ret