powered by
Check if a square symmetric matrix is positive definite
isPosDef(amat)
TRUE if amat is positive definite, FALSE otherwise
symmetric matrix
a1 = matrix(c(1,.5,.5,1),2,2) a2 = matrix(c(1,1.5,1.5,1),2,2) t1 = try(chol(a1)) t2 = try(chol(a2)) print(isPosDef(a1)) print(isPosDef(a2))
Run the code above in your browser using DataLab