matrix_1 = matrix_2 * matrix_3
Fernando Pérez
fperez528 at yahoo.com
Mon Aug 26 13:25:43 EDT 2002
Anton Vredegoor wrote:
> From this it seems that redefining the star operator to do what is
> called matrixmultiply here could cause problems. But maybe not. Could
> someone please inform me whether it would be possible to adapt numeric
> to use the star operator for matrixmultiply.
In [1]: from Matrix import Matrix
In [2]: A=Matrix([[1,2],[3,4]])
In [3]: B=Matrix([[0,1],[1,0]])
In [4]: A*B
Out[4]:
Matrix([[2, 1],
[4, 3]])
Matrix comes with Numeric, no need to redefine anything. Numeric implements
element-wise operations, Matrix implements regular Linear-algebra type
matrices.
cheers,
f
More information about the Python-list
mailing list