Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SparseM.image

Image Plot for Sparse Matrices


Description

Display the pattern of non-zero entries of a matrix of class matrix.csr.

Usage

## S4 method for signature 'matrix.csr'
image(x, col=c("white","gray"),
      xlab="column", ylab="row", ...)

Arguments

x

a matrix of class matrix.csr.

col

a list of colors such as that generated by rainbow. Defaults to c("white","gray")

xlab,ylab

each a character string giving the labels for the x and y axis.

...

additional arguments.

Details

The pattern of the non-zero entries of a sparse matrix is displayed. By default nonzero entries of the matrix appear as gray blocks and zero entries as white background.

References

Koenker, R and Ng, P. (2002). SparseM: A Sparse Matrix Package for R,
http://www.econ.uiuc.edu/~roger/research/home.html

See Also

SparseM.ops, SparseM.solve, SparseM.ontology

Examples

a <- rnorm(20*5)
A <- matrix(a,20,5)
A[row(A)>col(A)+4|row(A)<col(A)+3] <- 0
b <- rnorm(20*5)
B <- matrix(b,20,5)
B[row(A)>col(A)+2|row(A)<col(A)+2] <- 0
image(as.matrix.csr(A)%*%as.matrix.csr(t(B)))

SparseM

Sparse Linear Algebra

v1.81
GPL (>= 2)
Authors
Roger Koenker [cre, aut], Pin Tian Ng [ctb] (Contributions to Sparse QR code), Yousef Saad [ctb] (author of sparskit2), Ben Shaby [ctb] (author of chol2csr)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.