mat2crs {kexpmv}R Documentation

Convert matrix to CRS format using SparseM function

Description

The EXPOKIT's expokit_dmexpv and expokit_dgexpv functions both deal with sparse matrices. These matrices have a lot of zeros, and can therefore be stored more efficiently by converting the matrix into CRS (Compressed Row Storage) format.

Usage

mat2crs(mat)

Arguments

mat

A square matrix.

Details

In EXPOKIT and its wrapper functions, a CRS-formatted matrix is input as 3 vectors:

ia = row pointer. This vector stores the location in the ‘a’ vector that is the first non-zero element in a row.
ja = column indices for non-zero elements.
a = non-zero elements of the matrix.

Author(s)

Meabh G. McCurdy mmccurdy01@qub.ac.uk

Examples

# Make a square matrix
mat=matrix(c(-0.071207, 0, 0, 0.065573, -0.041206, 0, 0.005634, 0.014206, 0), nrow=3, byrow=TRUE)

# Covert to CRS format
mat2crs(mat)
print(mat)


[Package kexpmv version 0.0.3 Index]