multiply_matrix_vector
- compas.geometry.multiply_matrix_vector(A, b)[source]
Multiply a matrix with a vector.
- Parameters:
- Alist[list[float]] |
compas.geometry.Transformation
The matrix.
- b[float, float, float] |
compas.geometry.Vector
The vector.
- Alist[list[float]] |
- Returns:
- [float, float, float]
The resulting vector.
- Raises:
- Exception
If not all rows of the matrix have the same length as the vector.
Notes
This is a Python version of the following linear algebra procedure:
\[\mathbf{A} \cdot \mathbf{x} = \mathbf{b}\]with \(\mathbf{A}\) a m by n matrix, \(\mathbf{x}\) a vector of length n, and \(\mathbf{b}\) a vector of length m.
Examples
>>> matrix = [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]] >>> vector = [1.0, 2.0, 3.0] >>> multiply_matrix_vector(matrix, vector) [2.0, 4.0, 6.0]