[Numpy-discussion] Detect subclass of ndarray

Charles R Harris charlesr.harris@gmail....
Sat Mar 24 18:59:55 CDT 2007


On 3/24/07, Alan G Isaac <aisaac@american.edu> wrote:
>
> On Sat, 24 Mar 2007, Anne Archibald apparently wrote:
> > Note that taking a vector and left-multiplying it by
> > a matrix is a very natural operation that won't work any
> > more if you treat all vectors as if they were row vectors.
>
> Can you be more specific on this "naturalness"?
> What is the cost of being explicit (in actual practice)?
>
> I am inclined to claim that this seems "natural" to us only
> when we abuse language and forget that our column vectors
> and row vectors are in fact matrices with two dimensions/axes.
>
> In what situation does a need or major convenience
> from being so implicit arise?


I committed a change that converts nonscalars to matrices before calling
dot. The following now raises an alignment error:

mat(eye(2))*ones(2)

On the other hand

mat(eye(2))*[[1],[1]]

now returns the expected (by me) result. Scream loudly if any of this
bothers you.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070324/6bc1bc16/attachment.html 


More information about the Numpy-discussion mailing list