I used to perform Cholesky/LU decompostion to solve linear problem with Eigen but now I have to solve an Linear homogeneous system (the right hand side of my linear system is the null vector). I have to do an Gaussian reduction on my square Matrix in order to find a space of solution, but I can not find any gaussian reduction algorithm on Eigen's documentation. So Is this any Gaussian reduction algorithm on Eigen ?
If you have the eigen decomposition of the coefficient matrix A
, the solution for the homogeneous system will be any vector that can be written as a linear combination of eigenvectors associated with eigenvalue 0.
The function eig gives you the eigen decomposition of a matrix. Numerical errors will result in the eigenvectors not being exact so you simply choose the eigenvector with smallest magnitude, and you solve the least squares problem this way.
So your problem boils down to
w, v = np.linalg.eig(A)
x = v[:,np.argmin(abs(v))]
Then A @ x
is approximately the null vector.