SuiteSparse by Tim Davis is a high quality sparse linear algebra library written in C that provides CHOLMOD which allows you to solve Ax=b ( in MATLAB CHOLMOD is used for x = A \ b). According to the README, CHOLMOD is a set of routines for factorizing sparse symmetric positive definite matrices of the form A or AA’, updating/downdating a sparse Cholesky factorization, solving linear systems, updating/downdating the solution to the triangular system Lx=b, and many other sparse matrix functions for both symmetric and unsymmetric matrices. The library is quite confusing to get started with and the examples don’t really help, So I wrote a simple program to illustrate how to solve a Generalized Least Squares Problem. Here are the following resources:
- A cpp file with the example code. Download and change extension to .cpp.
- A Makefile to compile the code. Download and remove .txt extension.
- A MATLAB script to verify the same. Download and change extension to .m.
To build, download SuiteSparse to your home folder. Then in the SuiteSparse folder type make. In your home folder, create a directory “TEST_SS” and put the files you downloaded from above into that folder. Change the extensions as needed and then in the terminal type make to build. To run simply type ./test_ss