Skip to content

Stdlib Sparse matrix API

Williams A. Lima edited this page May 16, 2020 · 43 revisions

Stdlib Sparse matrix API

Goals

To be compact instead of being exhaustive. It aims at supplying Fortran users with a minimum (yet useful) number of routines and data structures related to sparse matrices storage and operations. This library is particularly targeted at a non-expert in numerical computation public. Thus we aim at having a simple and easy to use API.

Sparse matrix representations supported

This section is based on Saad (1994). In that work, a much more complete and extensive list of formats is described. Here we take only the ones that we think are most useful at the moment.

Coordinate format (COO)

Given an m by n real or complex matrix A containing nnz nonzero elements with each element denoted by a_ij this format represents A using a set of three arrays: values, rows, and columns, as described below.

values A real/complex array of size nnz containing the matrix elements a_ij in any order.

rows An integer array of size nnz containing the row indices of the elements a_ij.

columns An integer array of size nnz containing the column indices of the elements a_ij.

Compressed Sparse Row (CSR)

Given an m by n real or complex matrix A containing nnz nonzero elements with each element denoted by a_ij this format represents A using a set of three arrays: values, ja, and ia, as described below.

values A real/complex array of size nnz containing the matrix elements a_ij stored row by row from row 1 to row n.

ja An integer array of size nnz containing the column indices of the elements a_ij as stored in the array values.

ia An integer array of size n+1 containing the index in the arrays values and ja where each row starts. The value at ia(n+1) always has the value ia(1)+nnz.

Clone this wiki locally