June 2015
Beginner
348 pages
8h 44m
English
Let's compute the pseudo inverse of a matrix:
A = np.mat("4 11 14;8 7 -2")
print("A\n", A)The matrix we created looks like the following:
A [[ 4 11 14] [ 8 7 -2]]
pinv() function:pseudoinv = np.linalg.pinv(A)
print("Pseudo inverse\n", pseudoinv)The pseudo inverse result is as follows:
Pseudo inverse [[-0.00555556 0.07222222] [ 0.02222222 0.04444444] [ 0.05555556 -0.05555556]]
print("Check", A * pseudoinv)What we get is not an identity matrix, but it comes close to it:
Check [[ 1.00000000e+00 0.00000000e+00] [ 8.32667268e-17 1.00000000e+00]]
We computed ...
Read now
Unlock full access