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

Travis Oliphant oliphant at ee.byu.edu
Tue Dec 10 16:32:21 EST 2002


> I'm replying to a long-ago message by Alexander here.  I do understand
> the difference between rank and dimensionality, if I've used the right
> terms here, and I'm now persuaded that Numarray/Numeric is more
> mathematically correct than MATLAB, where as Alexander points out, 1,
> [1] and [[1]] are all the same thing, namely a 1-by-1 matrix.
>
> But I want to strongly encourage Alexander to release his matrix
> package.  I really like the ideas which I've kept below from his reply.
> More to the point, it would help me wean users from MATLAB and IDL to
> SciPy if they could use his more compact notation.

Note, SciPy has matrix functionality already included (borrowed from
Numeric actually).

Contributions from Alexander should really start from that base.

The simple command mat() (a SciPy reference to Matrix.Matrix() from
Numeric) will return a matrix object

Note you can also define a matrix using MATLAB-like syntax if you enclose
it in quotes first.

>>> a = mat('[1,2,3;4,5,6]')
>>> print a
Matrix([[1,2,3],
       [4,5,6]])

a.T  is the transpose of the matrix
a.H  is the Hermitian transpose
a.I  is the inverse
a.A  is the array equivalent of the Matrix

and

a*b is matrix multiplication.
a**k  is matrix power (using an efficient algorithm).


I find it a little amusing that everyone is constantly re-inventing the
wheel here.  Syntax and implementation can always be discussed, but we
should discuss it from what is already present.

Best regards,

-Travis






More information about the SciPy-User mailing list