[QUESTION] how to multiply matrix?


from mathutils import Matrix

Matrix_a = Matrix([1,0,0,0,],[0,1,0,0,],[0,0,1,0],[0,0,1/1.2,0])
Matrix_b = Matrix([1],[1],[1],[1])
Matrix_c = Matrix_a*Matrix_b
print(Matrix_c)


Not right?

Matrix_b is not a matrix in your code, it’s a vector.

from mathutils import Matrix
from mathutils import Vector
a = Matrix([1,0,0,0,],[0,1,0,0,],[0,0,1,0],[0,0,1/1.2,0])
b = Vector([1,1,1,1])
c = a*b
print(c)

you did look up the matrix at wikipedia and/or wolfram?
> http://en.wikipedia.org/wiki/Matrix_multiplication
> http://mathworld.wolfram.com/MatrixMultiplication.html

The functions/objects in the blender mathutils package are
only a subset (restricted, a part).
From mathutils
the Vector is special,
same goes to a 3x3-Matrix
or the 4x4-Matrix.
You can normaly say a Vector is the same like a 3x1-Matrix, but the
Vector in mathutils has different properties.
mathutils is limited to 3D-objects and special usage.
So a 3x3-Matrix is in mathutils always a rotation-part and you can
only multiply the same kind of blender-matrix.
Same is vor other combinations, like a vector-product.

Hope this helps…

Update, cause the blender-python-api changed it:
a Vector-Matrix multiplication is only possible
as
Vector * Matrix
and not the commuted like: Matrix * Vector
since ?2.55 rev.338xx?

But in blender 2.49 there’s no mathutils lib…use Math instead?

use

from Blender.Mathutils import Matrix
from Blender.Mathutils import Vector
in blender 2.49