Learn R Programming

EigenR (version 1.2.3)

SparseMatrix: Sparse matrix

Description

Constructs a sparse matrix, real or complex.

Usage

SparseMatrix(i, j, Mij, nrows, ncols)

# S3 method for SparseMatrix print(x, ...)

asSparseMatrix(M)

Arguments

i, j

indices of the non-zero coefficients

Mij

values of the non-zero coefficients; must be a vector of the same length as i and j or a single number which will be recycled

nrows, ncols

dimensions of the matrix

x

a SparseMatrix object

...

ignored

M

a matrix, real or complex

Value

A list with the class SparseMatrix.

Examples

Run this code
# NOT RUN {
set.seed(666)
( M <- matrix(rpois(50L, 1), 10L, 5L) )
asSparseMatrix(M)
# }

Run the code above in your browser using DataLab