Learn R Programming

bdsmatrix (version 1.3-7)

bdsI: Sparse identity matrices

Description

This function will create an identitiy matrix, in the sparse bdsmatrix format.

Usage

bdsI(id, blocksize)

Value

an identity matrix.

Arguments

id

the identifier list. This will become the dimnames of the final matrix, and must be a set of unique values. It's length determines the dimension of the final matrix

blocksize

the blocksize vector of the final matrix. If supplied, the sum of blocksizes must equal the dimension of the matrix. By default, the created matrix is as sparse as possible.

Examples

Run this code
imat <- bdsI(1:10)

Run the code above in your browser using DataLab