Learn R Programming

gallery (version 1.0.0)

spdiags: Create sparse diagonal matrix

Description

Creates a sparse representation of multiple diagonal matrix

Usage

spdiags(A, d, m, n)

Value

sparse diagonal matrix of class 'dgcMatrix'

Arguments

A

matrix where columns correspond to the desired diagonals

d

indices of the diagonals to be filled in. 0 is main diagonal. -1 is first subdiagonal and +1 is first superdiagonal.

m

row dim

n

col dim