zzz_SparseM_coo_to_REXPOKIT_coo: Convert a SparseM COO matrix to a plain matrix

SparseM_coo_to_REXPOKIT_cooR Documentation

Convert a SparseM COO matrix to a plain matrix

Description

Converts a SparseM COO-formatted matrix (an S4 object) to a plain matrix, with
column #1 = ia = i index
column #2 = ja = j index
column #3 = a = nonzero values of the matrix

Usage

  SparseM_coo_to_REXPOKIT_coo(tmpmat_in_SparseMcoo_fmt)

Arguments

tmpmat_in_SparseMcoo_fmt

A square matrix S4 object derived from SparseM's as.matrix.coo

Details

Background: COO (coordinated list) format, is described here:

https://en.wikipedia.org/wiki/Sparse_matrix#Coordinate_list_.28COO.29

In EXPOKIT and its wrapper functions, a COO-formated matrix is input as 3 vectors (first two integer, the third double):

ia = row number
ja = column number
a = value of that cell in the matrix (skipping 0 cells)

Value

tmpmat_in_REXPOKIT_coo_fmt A cbind of ia, ja, and a

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

See Also

mat2coo_forloop

Examples

# Example use:
# Make a Q matrix
tmpmat = matrix(c(-1.218, 0.504, 0.336, 0.378, 0.126, -0.882, 0.252, 0.504, 0.168,
0.504, -1.05, 0.378, 0.126, 0.672, 0.252, -1.05), nrow=4, byrow=TRUE)

# Covert to SparseM coo format
tmpmat_in_REXPOKIT_coo_fmt <- mat2coo(tmpmat)

rexpokit documentation built on Nov. 22, 2023, 5:07 p.m.