From c7e4e78e65d1221a5c830e6468ed676cc7cf0ed8 Mon Sep 17 00:00:00 2001 From: Shashwat Singh Date: Sun, 13 Feb 2022 22:09:53 +0530 Subject: [PATCH] Trac #12595: eigenmatrix_left of complex floating point matrix add doctest to demonstrate that the trac issue has already been resolved. --- src/sage/matrix/matrix2.pyx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 7c5cd644d43..8061f3969f8 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -6936,6 +6936,21 @@ 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: mm = p.inverse() * d * p # This should be equal to m up to numerical noise + sage: norm(mm - m) < 1e-12 + True """ from sage.misc.flatten import flatten from sage.matrix.constructor import diagonal_matrix, matrix