/usr/lib/R/site-library/expm/demo/expm.R is in r-cran-expm 0.99-1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | require("expm")
#diagonalisable matrix
T <- cbind(c(-2, -3, 2), c(2, -2, 1), c(0, 2, -2))
expm(T)
# numerically singular matrix
T <- cbind(c(-2, 0, 0), c(2, -2, 0), c(0, 2, -2))
expm(T)
#solve shows T is numerically singular
try(solve(eigen(T)$vectors))
#singular matrix
T <- cbind(c(0, 0, 0), c(2, 0, 0), c(1, 2, 0))
expm(T)
stopifnot(all.equal(logm(expm(T)), T))
## and show how close it is
all.equal(logm(expm(T)), T, tol=0)# 2.39e-15 {64b ubuntu 12-04}
|