dense_to_sparse {SparseChol}R Documentation

Generate sparse matrix representation of a matrix

Description

Generate sparse matrix representation of a matrix

Usage

dense_to_sparse(mat)

Arguments

mat

A matrix

Value

A list with the matrix in compressed row storage format.

Examples

M <- diag(10)
#put a few random values in
M[lower.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
M[upper.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
L <- dense_to_sparse(M)

[Package SparseChol version 0.3.1 Index]