I sloved a least square problem (Ax=b for A ) using pinv in numpy and (pinv , lstsq) in scipy and "/" in matlab. I got some different answers, so what is the different between them?
problem :Ax=b for A
method:
pinv in numpy and scipy : A=b*pinv(x)
lstsq in scipy : A.T=lstsq(x.T,b.T) , the problem has changed to (x.T*A.T=b.T)
/ in matlab : A=b/x
matlab: https://cn.mathworks.com/help/matlab/ref/mrdivide.html
"x = B/A solves the system of linear equations xA = B for x. The matrices A and B must contain the same number of columns. If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with n columns, then x = B/A returns a least-squares solution of the system of equations xA = B. "
scipy.linalg.lstsq:Compute least-squares solution to equation Ax = b.
scipy.linalg.pinv:Compute the (Moore-Penrose) pseudo-inverse of a matrix. Calculate a generalized inverse of a matrix using a least-squares solver.
numpy.linalg.pinv:Calculate the generalized inverse of a matrix using its singular-value decomposition (SVD) and including all large singular values.