multiply_matrices
- compas.geometry.multiply_matrices(A, B)[source]
Mutliply a matrix with a matrix.
- Parameters:
- Alist[list[float]] |
compas.geometry.Transformation
The first matrix.
- Blist[list[float]] |
compas.geometry.Transformation
The second matrix.
- Alist[list[float]] |
- Returns:
- list[list[float]]
The result matrix.
- Raises:
- Exception
If the shapes of the matrices are not compatible. If the row length of B is inconsistent.
Notes
This is a pure Python version of the following linear algebra procedure:
\[\mathbf{A} \cdot \mathbf{B} = \mathbf{C}\]with \(\mathbf{A}\) [m x n], \(\mathbf{B}\) [n x o], and \(\mathbf{C}\) [m x o].
Examples
>>> A = [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]] >>> B = [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]] >>> multiply_matrices(A, B) [[4.0, 0.0, 0.0], [0.0, 4.0, 0.0], [0.0, 0.0, 4.0]]