[SciPy-user] FW: Vector orientation (pedantry?)

Stephen Walton stephen.walton at csun.edu
Mon Nov 25 12:14:47 EST 2002


I think we're still blacklisted so the list won't see this.

On Fri, 2002-11-22 at 14:11, Alexander Schmolck wrote:

> OK, either I completely misunderstand you (in which case I apologize, I'm a
> bit tired) or maybe you are just mistaken in your assumptions :
> 
> (using Numeric 22)
> 
> >>> from Numeric import *
> >>>     # col. vec     # row vec.
> >>> dot([[1],[2],[3]], [[1,2,3]])
> array([[1, 2, 3],
>        [2, 4, 6],
>        [3, 6, 9]])
> >>> matrixmultiply([[1],[2],[3]], [[1,2,3]])
> array([[1, 2, 3],
>        [2, 4, 6],
>        [3, 6, 9]])

OK, I see what you did.  What I had tried in my naivete' was:

>>> from Numeric import *
>>> dot([1,2,3],[1,2,3])
14

You also wrote:

>Well, note that a row and column vector is nothing more than a 1xN or
> Nx1 array (as opposed to a what I'd call a 'flat' N-array).

So [1,2,3] denotes a 'flat' 3-array to Numeric, while [[1,2,3]] denotes
1-by-3 array?  Not sure I understand the distinction.

I agree that SciPy is awkward for linear algebra, but it's mainly syntax
in my case.  <HERESY> I find typing 'x=[1,2,3;4,5,6;7,8,9]' much more
straightforward than 'x=array([[1,2,3],[4,5,6],[7,8,9]]), especially
since Python/SciPy doesn't seem to have a 'blink matching brackets'
option. </HERESY>

-- 
Stephen Walton, Professor, Dept. of Physics & Astronomy, Cal State
Northridge
stephen.walton at csun.edu




More information about the SciPy-User mailing list