I have a symmetric matrix (4x4) in memory. Unfortunately, sum (originalMatrix! = T (originalMatrix)) = 6. So, I subtract this matrix and read it back into memory. Now sum (dputMatrix! = T (dputMatrix)) = 0. How is this possible and how can I check the symmetry with my matrix in memory?
originalMatrix = ... sum( originalMatrix != t( originalMatrix ) ) # results in 6 dput( originalMatrix ) dputMatrix = structure(c(0.00117771346463494, -1.57864028664711e-05, 0.000293652924987303, -9.85387333663002e-05, -1.57864028664711e-05, 0.000194782042576016, 6.9133672862693e-05, 4.23792732612071e-05, 0.000293652924987303, 6.9133672862693e-05, 0.00046216043028767, 2.70172523991749e-05, -9.85387333663002e-05, 4.23792732612071e-05, 2.70172523991749e-05, 0.00017694896679169), .Dim = c(4L, 4L), .Dimnames = list(c("a00088630", "a0091n", "a01010", "a01307810"), c("a00088630", "a0091n", "a01010", "a01307810"))) sum( dputMatrix != t( dputMatrix ) ) # results in 0!!!
SFun28
source share