Oct-29-2019, 12:06 AM
Ok,
if you try to execute the following code
if you try to execute the following code
import numpy as np a = np.array([10, 10, 10]) b = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]) a @ np.linalg.pinv(b)you get
Output:array([0.71428571, 1.42857143, 2.14285714])
np.linalg.pinv(x)
returns Moore-Penrose inversion of a matrix x
. x @ y
denotes matrix product between x
and y
. Moore-Penrose inversion is used to obtain least squares solution for over-determined (or under-determined) linear systems. Octave knows: if you are trying to divide one matrix onto another, you are likely trying to solve system of linear equations. E.g.: Ax=b, then x = b / A; in Python you should do this: x = np.linalg.pinv(A) @ b
.