dense_to_sparse: Generate sparse matrix representation of a matrix

View source: R/RcppExports.R

dense_to_sparseR 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)

SparseChol documentation built on April 3, 2025, 10:51 p.m.