# Open Source Linear Algebra Library

I am making a code in C that requires the equivalent of Matlab's '\' command for a linear system of the form AX=B where A is an NxN matrix and X, B are Nx1 vectors- i.e a code that performs X=A\B that is optimized to recognize it will be receiving a symmetric positive-definite sparse matrix. I was wondering if there is any open source code in C to do this operation.

• CHOLMOD from SuiteSparse (faculty.cse.tamu.edu/davis/suitesparse.html) will solve systems of this type, is written in C, and is open source. Jul 22, 2016 at 17:09
• Which, incidentally, is exactly what Matlab is using if backslash detects an spd matrix... Jul 22, 2016 at 17:24
• precisely what I was looking for! Works perfect thank you. Jul 22, 2016 at 17:34

However, you may not want to use a direct solver for large sparse matrices. Since direct solvers are $\mathcal{O}(n^3)$, they tend to not do very well as the problem grows in size. Instead, people use iterative methods to iterative get solutions $Ax_n \approx b$ where the solution $x_n \rightarrow x$ as the number of iterations $n \rightarrow \infty$.