1. To install the package in Ubuntu
>>sudo apt-get install libsuitesparse-dev
2. Add library flag -lumfpack
3. Include header file
#include
4. Solve Ax=b in csparse format as following
void IPSparse::setDir(FP_TYPE* dir,cs_ColSparse* coeffMat,FP_TYPE* rhs){
void *Symbolic, *Numeric;
(void) umfpack_di_symbolic(coeffMat->n, coeffMat->n, coeffMat->p, coeffMat->i, coeffMat->x, &Symbolic, NULL,NULL);
(void) umfpack_di_numeric(coeffMat->p, coeffMat->i, coeffMat->x, Symbolic, &Numeric, NULL, NULL);
umfpack_di_free_symbolic(&Symbolic);
(void) umfpack_di_solve(UMFPACK_A, coeffMat->p, coeffMat->i, coeffMat->x, dir, rhs, Numeric, NULL, NULL);
umfpack_di_free_numeric(&Numeric);
}
No comments:
Post a Comment