mat.util {GeneTS} | R Documentation |
is.positive.definite
tests whether all eigenvalues of a matrix
are positive.
is.square
tests whether a matrix
has squared form.
is.symmetric
tests whether a matrix is symmetric.
rank.condition
estimates the rank and the condition
of a matrix by
computing its singular values D[i] (using svd
).
The rank of the matrix is the number of singular values D[i] > tol*max(D)
and the condition is the ratio of the largest and the smallest
singular value.
is.positive.definite(m, eps = .Machine$double.eps) is.square(m) is.symmetric(m, eps = .Machine$double.eps) rank.condition(m, tol = sqrt(.Machine$double.eps))
m |
matrix |
eps |
values smaller than < eps are considered zero (e.g., eigenvalues in is.positive.definite() and matrix differences in is.symmetric() |
tol |
relative tolerance - singular values larger than tol times
the maximum singular value are considered non-zero |
For is.positive.definite
, is.square
, and is.symmetric
a logical value (TRUE
or FALSE
).
For rank.condition
a list object with the following components:
rank |
Rank of the matrix. |
condition |
Condition number. |
Korbinian Strimmer (http://www.stat.uni-muenchen.de/~strimmer/).
# load GeneTS library library(GeneTS) # Hilbert matrix hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") } # positive definite ? m <- hilbert(8) is.positive.definite(m) # numerically ill-conditioned m <- hilbert(15) rank.condition(m) # square and symmetric ? is.square(m) is.symmetric(m)