Learn R Programming

Matrix (version 0.999375-46)

diagonalMatrix-class: Class "diagonalMatrix" of Diagonal Matrices

Description

Class "diagonalMatrix" is the virtual class of all diagonal matrices.

Arguments

Objects from the Class

A virtual Class: No objects may be created from it.

Extends

Class "sparseMatrix", directly.

See Also

ddiMatrix and ldiMatrix are actual classes extending "diagonalMatrix".

Examples

Run this code
I5 <- Diagonal(5)
D5 <- Diagonal(x = 10*(1:5))
## trivial (but explicitly defined) methods:
stopifnot(identical(crossprod(I5), I5),
          identical(tcrossprod(I5), I5),
          identical(crossprod(I5, D5), D5),
          identical(tcrossprod(D5, I5), D5),
          identical(solve(D5), solve(D5, I5)),
          all.equal(D5, solve(solve(D5)), tol = 1e-12)
          )
solve(D5)

Run the code above in your browser using DataLab