spam-class {spam}R Documentation

Class "spam"

Description

The spam class is a representation of sparse matrices.

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].

Slots

entries:
Object of class "numeric" contains the nonzero values
colindices:
Object of class "integer" ordered indices of the nonzero values
rowpointers:
Object of class "integer" pointer to the beginning of each row in the arrays entries and colindices
dimension:
Object of class "integer" ~~

Methods

as.matrix
signature(x = "spam"): transforming a sparse matrix into a regular matrix.
as.spam
signature(x = "spam"): cleaning of a sparse matrix.
[<-
signature(x = "spam", i,j, value): assigning a sparse matrix. The negative vectors are not implemented yet.
[
signature(x = "spam", i, j): subsetting a sparse matrix. The negative vectors are not implemented yet.
%*%
signature(x, y): matrix multiplication, all combinations of sparse with full matrices or vectors are implemented.
c
signature(x = "spam"): vectorizes the sparse matrix and takes account of the zeros. Hence the lenght of the result is prod(dim(x)).
cbind
signature(x = "spam"): binds sparse matrices.
chol
signature(x = "spam"): see chol for details.
diag
signature(x = "spam"): see diag for details.
dim<-
signature(x = "spam"): truncates or augments the matrix see dim for details.
dim
signature(x = "spam"): gives the dimension of the sparse matrix.
image
signature(x = "spam"): see image for details.
display
signature(x = "spam"): see display for details.
length<-
signature(x = "spam"): Is not implemented and causes an error.
length
signature(x = "spam"): gives the number of non-zero elements.
lower.tri
signature(x = "spam"): see lower.tri for details.
Math
signature(x = "spam"): see Math for details.
Math2
signature(x = "spam"): see Math2 for details.
norm
signature(x = "spam"): calculates the norm of a matrix.
plot
signature(x = "spam", y): same functionality as the ordinary plot.
print
signature(x = "spam"): see print for details.
rbind
signature(x = "spam"): binds sparse matrices.
solve
signature(a = "spam"): see solve for details.
summary
signature(object = "spam"): small summary statement of the sparse matrix.
Summary
signature(x = "spam"): All functions of the Summary class (like min, max, range...) operate on the vector x@entries and return the result thereof. See Examples.
t
signature(x = "spam"): transpose of a sparse matrix.
upper.tri
signature(x = "spam"): see lower.tri for details.

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.

Author(s)

Reinhard Furrer, some of the Fortran code is based on A. George, J. Liu, E. S. Ng, B.W Peyton and Y. Saad (alphabetical)

Examples

showMethods("as.spam")

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

[Package spam version 0.15-3 Index]