Description Usage Arguments Details Value Author(s) Examples
This routine checks the definiteness of a two dimensional, real-valued matrix.
1 | definiteness(x)
|
x |
matrix of type double - A real-valued, 2D matrix. |
This routine takes the symmetric part of the given matrix and decomposes its spectrum to find an answer.
character string - A character string indicating the definiteness of the given matrix.
Philipp van Wickevoort Crommelin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # positive definite
A = matrix(data = c(1,0,0,0,7,0,0,0,2),
ncol = 3)
definiteness(A)
# negative definite
definiteness(-A)
# positive semi-definite
A = matrix(data = c(1,0,0,0,0,0,0,0,2),
ncol = 3)
definiteness(A)
# negative semi-definite
definiteness(-A)
# Example, that demonstrates the importance of symmetry of the given matrix:
B = matrix(data = c(4,1,9,4),
ncol = 2) #Eigenvalues all positive but not symmetric
definiteness(B)
eigen(B)$values
# Scalar product maps to negative value
v = c(-1,1)
t(v)%*%B%*%v
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.