11.07.2015 Views

Introduction to Sparse Matrices In Scilab - Projects

Introduction to Sparse Matrices In Scilab - Projects

Introduction to Sparse Matrices In Scilab - Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

chfactchsolvespcholsparse Cholesky fac<strong>to</strong>rizationsparse Cholesky solversparse cholesky fac<strong>to</strong>rization with permutationsFigure 3 – Cholesky fac<strong>to</strong>rizations for sparse matrices.4 Cholesky fac<strong>to</strong>rizationsThe figure 3 presents the functions which allow <strong>to</strong> compute the Choleskydecomposition of sparse matrices.The chfact and chsolve functions can be combined in order <strong>to</strong> solvesparse linear systems of equations, if the matrix is symmetric positive definite.<strong>In</strong> the following example, we solve the equation Ax = b where A is a sparse5-by-5 symmetric definite positive matrix.Afull = [2 -1 0 0 0;-1 2 -1 0 0;0 -1 2 -1 0;0 0 -1 2 -1;0 0 0 -1 2];A = sparse ( Afull );h = chfact (A);b = [0 ; 0; 0; 0; 6];chsolve (h,b)The [R,P]=spchol(X) statement produces a sparse lower triangular matrixR and a sparse permutation matrix P such that P RR T P T = X. <strong>In</strong> thefollowing session, we use the spchol function <strong>to</strong> compute the sparse Choleskydecomposition of a symmetric definite positive matrix.--> Afull = [--> 2 -1 0 0 0;--> -1 2 -1 0 0;--> 0 -1 2 -1 0;--> 0 0 -1 2 -1;--> 0 0 0 -1 2-->];-->A = sparse ( Afull );-->[R,P]= spchol (A)P =( 5, 5) sparse matrix15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!