测试对称矩阵的对称性失败

时间:2011-10-05 14:54:22

标签: r

我在内存中有一个对称矩阵(4x4)。不幸的是,sum(originalMatrix!= t(originalMatrix))= 6.所以我输入该矩阵并将其读回内存。现在求和(dputMatrix!= t(dputMatrix))= 0.这怎么可能?我如何用内存矩阵测试对称性?

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!!!

1 个答案:

答案 0 :(得分:3)

这是FAQ 7.31的一种表现形式。请注意,如果要将R对象保存为完全精度,则应使用save()。

请勾选!