-
-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add doctest for eigenmatrix of complex floating-point matrix #12595
Comments
comment:2
Somewhat smaller example, and evidence that something's wrong in RDF too:
|
comment:3
[Of course even if m is over RDF d and p can be over CDF.] |
comment:4
Appears the computed results in both of the above examples are correct for the transpose of the matrix. Digging deeper....... |
Changed keywords from eigenmatrix, CDF to eigenmatrix, CDF, sd40.5 |
Changed keywords from eigenmatrix, CDF, sd40.5 to eigenmatrix CDF sd40.5 |
comment:10
Still getting
on Sage 6.6. FYI, doing the same but over QQbar gives |
Stopgaps: todo |
comment:12
I think this is no longer a problem
The answer for the norm is now close enough to |
comment:14
Could a doctest be added for that? |
Author: Shashwat Singh |
Commit: |
New commits:
|
comment:16
Replying to @slel:
Just added The doctest tests if it is within 10^(-12) That precision has been chosen arbitrarily. I hope this suffices. |
comment:17
Currently your commit looks like this $ git show
commit d1ed045943d68...
Author: ...
Date: ...
Trac #12595: elgennmatrix of complex floating-point matrix
Add doctest to demonstrate that the issue is already resolved
diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx
index 7c5cd644d4..3ed18eb108 100644
--- a/src/sage/matrix/matrix2.pyx
+++ b/src/sage/matrix/matrix2.pyx
@@ -6936,6 +6936,14 @@ cdef class Matrix(Matrix1):
Traceback (most recent call last):
...
RuntimeError: failed to compute eigenvectors for eigenvalue ..., check eigenvectors_left() for partial results
+________
+ The following example shows that :trac:`12595` has been resolved_
+____________
+ 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: norm(p.inverse() * d * p - m) < 10^(-12)
+ True
+
"""
from sage.misc.flatten import flatten
from sage.matrix.constructor import diagonal_matrix, matrix Comments:
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]])
Can you take all these comments into account and send a new commit? |
Reviewer: Samuel Lelièvre |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:19
Replying to @slel:
Just did, please check :) |
comment:20
Please
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:22
Replying to @slel:
I have dealt with the white discrepancies. Please check :) |
comment:23
Looks good to me. |
Changed branch from u/gh-shashwat1002/wrong-eigenmatrix to |
Sage seems to return the complex conjugate of
d
or something of the sort. Perhapsd
is simply wrongly permuted (but real eigenvalues seem to be correct).p.inverse() * d * p
should be at least approximately equal tom
.This was reported on the public bug reports from the notebook interface by [email protected] on 1/24/2012.
CC: @rbeezer @slel
Component: linear algebra
Keywords: eigenmatrix CDF sd40.5
Stopgaps: todo
Author: Shashwat Singh
Branch/Commit:
c7e4e78
Reviewer: Samuel Lelièvre
Issue created by migration from https://trac.sagemath.org/ticket/12595
The text was updated successfully, but these errors were encountered: