spam (version 2.10-0)

print: Printing and Summarizing Sparse Matrices

Description

Printing (non-zero elements) of sparse matrices and summarizing the sparsity structure thereof.

Usage

# S4 method for spam
print(x, ...)
# S4 method for spam
summary(object, ...)

Value

NULL for print, because the information is printed with cat there is no real need to pass any object back.

A list containing the non-zero elements and the density for

summary

for class spam.

A list containing the non-zero elements of the factor, the density and the fill-in for summary for class spam.chol.NgPeyton.

Arguments

x

matrix of class spam or spam.chol.method.

object

matrix of class spam or spam.chol.method.

...

any other arguments passed to print.default. If the non-standard argument minimal is set to FALSE, an extended spam print is available with logical argument rowpointer to print rowpointers, and zerosymbol defining the character to display the zero element.

Author

Reinhard Furrer

Details

getOption('spam.printsize') determines if the sparse matrix is coerced into a matrix and the printed as an array or if only the non-zero elements of the matrix are given.

See Also

display or image for a graphical visualization; spam.options

Examples

Run this code
set.seed(13)
smat <- spam_random(8)
par(mfcol=c(1,2),pty='s')
options(spam.printsize=1000)
print(smat)
options(spam.printsize=10)
print(smat)
summary(smat)
summary(smat)$nnz

smat@entries[1:5] <- 0
print(smat, minimal = FALSE)
print(smat, minimal = FALSE, rowpointer = TRUE)
smat@rowpointers
print_nnzpos(smat)

Run the code above in your browser using DataLab