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.

Read sparse doubles matrices in gatewaysget<strong>Sparse</strong>MatrixR. a sp. mat.getComplex<strong>Sparse</strong>MatrixR. a complex sp. mat.readNamed<strong>Sparse</strong>MatrixR. a named sp. mat.readNamedComplex<strong>Sparse</strong>Matrix R. a named complex sp. mat.Write sparse doubles matrices in gatewayscreate<strong>Sparse</strong>MatrixW. a sp. mat.createComplex<strong>Sparse</strong>Matrix W. a complex sp. mat.createNamed<strong>Sparse</strong>Matrix W. a named sp. mat.createNamedComplex<strong>Sparse</strong>Matrix W. a named complex sp. mat.Read/Write sparse boolean matrices in gatewaysgetBoolean<strong>Sparse</strong>MatrixR. a boolean sp. mat.readNamedBoolean<strong>Sparse</strong>Matrix R. a named boolean sp. mat.createBoolean<strong>Sparse</strong>Matrix W. a boolean sp. mat.createNamedBoolean<strong>Sparse</strong>Matrix W. a named boolean sp. mat.Figure 8 – The sparse API, <strong>to</strong> be used in gateways.The following read_sparse function is a sample example of some of thefunctions which may be used in gateways which manage sparse matrices. Thisexample is extracted from the help pages of <strong>Scilab</strong>.The read_sparse function takes a sparse matrix of doubles as input argumentand prints its content in the console. The sparse matrix may be realor complex, which is taked in<strong>to</strong> account in the gateway, based on the outpu<strong>to</strong>f the isVarComplex function. If the matrix is complex, we call the getComplex<strong>Sparse</strong>Matrix,which sets the data structures of the sparse matrix. Thedata structures associated with sparse matrices are presented in the section2.2 :– iRows : the number of rows,– iCols : the number of columns,– iNbItem : the number of nonzero entries,– piNbItemRow : the number of nonzeros on each row,– piColPos : the column index of each nonzero entry,– pdblReal : the real part of the nonzero entry,– pdblImg : the imaginary part of the nonzero entry.The get<strong>Sparse</strong>Matrix function has the same effect on real matrices, but onlythe pdblReal array is set.20

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

Saved successfully!

Ooh no, something went wrong!