1. Least squares
代码
from numpy import random
from scipy import linalg
A = random.randn(20, 20)
b = random.randn(20, 1)
x, residual, rank, s = linalg.lstsq(A, b)
print(x)
print(residual)
from numpy import random
from scipy import linalg
A = random.randn(20, 20)
b = random.randn(20, 1)
x, residual, rank, s = linalg.lstsq(A, b)
print(x)
print(residual)