Opened 9 years ago

eigenmatrix of complex floating-point matrix is wrong

Reported by: Owned by: dkrenn jason, was major sage-6.4 linear algebra eigenmatrix CDF sd40.5 rbeezer N/A todo

Description

```sage: m = Matrix(CDF, 8, [[-1, -1, -1, -1, 1, -3, -1, -1], [1, 1, 1, 1, -1, -1, 1, -3], [-1, 3, -1, -1, 1, 1, -1, -1], [-1, -1, -1, 3, 1, 1, -1, -1], [1, 1, -3, 1, -1, -1, 1, 1], [1, 1, 1, 1, -1, -1, -3, 1], [3, -1, -1, -1, 1, 1, -1, -1], [1, 1, 1, 1, 3, -1, 1, 1]])
sage: d, p = m.eigenmatrix_left()
sage: (p[1] * m)[0] / p[1][0]
1.2360679775 - 3.80422606518*I
sage: d[1][1]
1.2360679775 + 3.80422606518*I
```

Sage seems to return the complex conjugate of `d` or something of the sort. Perhaps `d` is simply wrongly permuted (but real eigenvalues seem to be correct).

`p.inverse() * d * p` should be at least approximately equal to `m`.

This was reported on the public bug reports from the notebook interface by <david+bugs@…> on 1/24/2012.

comment:2 Changed 9 years ago by dsm

Somewhat smaller example, and evidence that something's wrong in RDF too:

```sage: M = [[1,-1],[1, 1]]
sage: rings = SR, ZZ, QQ, RDF, CDF
sage: for ring in rings:
....:     m = Matrix(ring, M)
....:     d, p = m.left_eigenmatrix()
....:     print m- (~p)*d*p
....:
[0 0]
[0 0]
[0 0]
[0 0]
[0 0]
[0 0]
[ 0.0 -2.0]
[ 2.0  0.0]
[2.22044604925e-16 + 1.96068977308e-16*I              -2.0 - 2.22044604925e-16*I]
[              2.0 + 8.14867788484e-17*I                      -2.22044604925e-16]

```

comment:3 Changed 9 years ago by dsm

[Of course even if m is over RDF d and p can be over CDF.]

comment:4 Changed 9 years ago by rbeezer

Appears the computed results in both of the above examples are correct for the transpose of the matrix. Digging deeper.......

comment:5 Changed 9 years ago by rbeezer

• Keywords changed from eigenmatrix, CDF, sd40.5 to eigenmatrix CDF sd40.5

comment:6 Changed 7 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

comment:7 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

comment:8 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

comment:9 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

comment:10 Changed 6 years ago by dkrenn

Still getting

```sage: norm(p.inverse() * d * p - m)
7.608452130361234
```

on Sage 6.6.

FYI, doing the same but over QQbar gives `1.3060006046871026e-37`.

comment:11 Changed 5 years ago by jakobkroeker

• Stopgaps set to todo
Note: See TracTickets for help on using tickets.