I have the following matrix
M <- structure(c(0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0), .Dim = c(5L, 5L))
I want to find the eigenvalues that are exactly 1. I thought this would work:
Re(eigen(M)$values) == 1 & Im(eigen(M)$values) == 0
but Re(eigen(M)$values) == 1
doesn't think the 5th eigenvalues equals 1, even though it does. What am I missing?
EDIT: As soon as it's pointed out as a floating point problem, I investigate a bit more and find out about several solution, including using abs(value) < tol
, all.equal
, and signif
. Could an answer discuss these options?