문제

I am using Jama API for solving a problem with Linear Algebra. But it is giving me an error: java.lang.RuntimeException: Matrix is singular.

I suppose when the matrix is singular there are multiple solutions possible. Is there a way in Jama API to get one of these solutions or is there any other API that can help me here.

Below is a code snippet I am using:

Matrix A = new Matrix(input);
Matrix B = new Matrix(startState);
Matrix X = A.solve(B);
answer = X.getArray();
return answer;
도움이 되었습니까?

해결책

check the determinant of the matrix - if zero, it means that the matrix does not have an inverse (rows making up the matrix are not independent). In that case, you can look into SVD, Gauss-Siedel, Jacobi iteration etc. Also, as an alternate library, you could look into apache commons math if it helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top