While trying to write code for a Dirichlet process Gibbs Sampler, using a Normal-Wishart model, I got an error that the matrix I want to use as scale matrix for the posterior is not symmetric. I also tried it by myslef and got the following
is.symmetric.matrix(solve(cov(data)))
resulted FALSE as output. Also, the cov(data) is a symmetric matrix, which should make solve(cov(data)) a symmetric matrix too. While I tried the base packaage equivalent function for checking whether a matrix is symmetric
isSymmetric.matrix(solve(cov(data)))
I got a TRUE as an answer
Any ideas why this happens?