[R] matrix which results singular but at the same time positive definite
Giorgio Garziano
giorgio.garziano at ericsson.com
Thu Dec 10 11:35:22 CET 2015
Decrease the "tol" parameter specified into the "is.non.singular.matrix() call,
for example as:
m <- matrix(c( 1.904255e-12, -1.904255e-12, -8.238960e-13, -1.240294e-12,
-1.904255e-12, 3.637979e-12, 1.364242e-12, 1.818989e-12,
-8.238960e-13, 1.364242e-12, 4.809988e+00, 7.742369e-01,
-1.240294e-12, 1.818989e-12, 7.742369e-01, 1.090411e+00),
nrow=4, ncol=4)
> m
[,1] [,2] [,3] [,4]
[1,] 1.904255e-12 -1.904255e-12 -8.238960e-13 -1.240294e-12
[2,] -1.904255e-12 3.637979e-12 1.364242e-12 1.818989e-12
[3,] -8.238960e-13 1.364242e-12 4.809988e+00 7.742369e-01
[4,] -1.240294e-12 1.818989e-12 7.742369e-01 1.090411e+00
> print(is.non.singular.matrix(m, tol = 1e-24))
[1] TRUE
> print(is.positive.definite(m, tol=1e-18))
[1] TRUE
--
GG
http://around-r.blogspot.it
[[alternative HTML version deleted]]
More information about the R-help
mailing list