Hi,
I want to solve a large set of linear equations using linear algebra, i.e., get x in Ax = b equation.
For small sets this procedure works well:
//N - size of the NxN matrix A
//NN - number of non-zero elements in matrix A
//I,J, V - arrays of matrix indices and values (non-zero elements only)
TMatrixD A(N,N);
for(Int_t i = 0; i<NN;i++){
A(I[i],J[i]) = V[i];
}
TDecompSVD de(A,0);
de.Solve(b);
And the b-vector contains the correct result.
For large sets of equations I want to use a sparse matrix:
yes, but I believe that the problem is in TDecompSparse. The TDecompSVD (or any other decomposition on dense matrix) works fine for my case. I also do not get any error/warning messages when using TDecompSparse, and I was unable to find much in the documentation. Is there any example code for using TDecompSparse? Thanks.
TDecompSparse solves a sparse linear system Ax=b where A is sparse and positive definite, i.e. A is symmetric and all its eigenvalues are positive real numbers. Does your matrix A fulfil this requirement?