Bug 16151 - eigen(x) can give complex eigenvalues for numerically symmetric x if its dimnames are asymmetric.
Summary: eigen(x) can give complex eigenvalues for numerically symmetric x if its dimn...
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Accuracy (show other bugs)
Version: R 3.1.2
Hardware: Other Other
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-01-12 17:57 UTC by Bill Dunlap
Modified: 2015-01-13 07:52 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Dunlap 2015-01-12 17:57:48 UTC
I think that the presence of asymmetric dimnames should not affect
eigen's numerical results.  This is probably from using isSymmetric(x),
which pays attention to dimnames(x).

m <- structure(c(83, 41, 83, 41, 41, 83, 41, 83, 83, 41, 83, 41, 41,
  83, 41, 83), .Dim = c(4L, 4L), .Dimnames = structure(list(Row = c("R1",
  "R2", "R3", "R4"), Col = c("C1", "C2", "C3", "C4")), .Names = c("Row",
  "Col")))
all(m==t(m)) # TRUE
eigen(m)$values # complex, same as eigen(unname(m), symmetric=FALSE)
#[1] 2.480000e+02+0.000000e+00i 8.400000e+01+0.000000e+00i 5.756751e-15+4.872256e-15i 5.756751e-15-4.872256e-15i
eigen(unname(m))$values
#[1]  2.480000e+02  8.400000e+01  5.684342e-14 -1.598721e-14
Comment 1 Martin Maechler 2015-01-12 18:54:25 UTC
You are right.   unname(.) is one [of many] obvious workarounds.

I will commit that (together with more) for eigen(), as that always dropped dimnames eventually.