Learn R Programming

spam (version 0.20-3)

spam-class: Class "spam"

Description

The spam class is a representation of sparse matrices.

Arguments

Objects from the Class

Objects can be created by calls of the form new("spam", entries, colindices, rowpointes, dimension). The standard "old Yale sparse format" is used to store sparse matrices. The matrix x is stored in row form. The first element of row i is x@rowpointers[i]. The length of row i is determined by x@rowpointers[i+1]-x@rowpointers[i]. The column indices of x are stored in the x@colindices vector. The column index for element x@entries[k] is x@colindices[k].

Details

The compressed sparse row (CSR) format is often described with the vectors a, ia, ja. To be a bit more comprehensive, we have chosen longer slot names.

Note

The slots colindices and rowpointers are tested for proper integer assignments. This is not true for entries.

Examples

Run this code
showMethods("as.spam")


smat <- diag.spam(runif(15))
range(smat)
cos(smat)

Run the code above in your browser using DataLab