buds  0.1
FORTRAN reference counted types
Modules
Compressed Sparse Row (CSR C-indexed)

Detailed Description

A compressed sparse row matrix implementation using C-indexing. This implementation relies on every index lookup to be 0-based.

This only contains the indices for the sparse matrix, the data for the sparse matrix should be contained in an additional data array of the corresponding data type.

The CSR sparsity pattern stored must be sorted in each row such that the columns are consecutively aligned. This will help ensure a fast access pattern in the matrix with a row-based access pattern.

Note The indices stored in the arrays are C-indexed but retrieving a pointer through attach is still fortran-indexed.

integer :: nr, nz, ir, idx
integer, pointer, contiguous :: rptr(:), col(:)
call attach(this, nr=nr, nz=nz, rptr=rptr, col=col)
do ir = 1 , nr
do idx = rptr(ir) + 1, rptr(ir+1)
! ir-1 == C-row
! col(idx) == C-column
! access M(ir-1,col(idx))
end do
end do

There are no data-consistency checks performed (for performance reasons) hence you can end up with multiple entries for the same matrix element. In such cases the developer must take care of these.

Collaboration diagram for Compressed Sparse Row (CSR C-indexed):

Modules

 Integer (int)
 integer(selected_int_kind(9)) data type
 
 Integer (long)
 integer(selected_int_kind(18)) data type