#11274: Cholesky matrix decomposition breaks over the rationals
----------------------------------+-----------------------------------------
Reporter: rbeezer | Owner: jason, was
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-5.1
Component: linear algebra | Resolution:
Keywords: sd40.5 | Work issues:
Report Upstream: N/A | Reviewers: Dan Drake
Authors: Rob Beezer | Merged in:
Dependencies: #12966, #13018 | Stopgaps:
----------------------------------+-----------------------------------------
Changes (by rbeezer):
* status: needs_work => needs_review
Old description:
> The matrix E is clearly symmetric, and by looking at its eigenvalues and
> the determinants of principal submatrices it is clearly positive
> definite.
>
> {{{
> sage: E = matrix(QQ, [[2, 1], [1, 1]])
> sage: E.is_symmetric()
> True
> sage: E.eigenvalues()
> [0.3819660112501051?, 2.618033988749895?]
> sage: E.det()
> 1
> sage: E.cholesky_decomposition()
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call
> last)
>
> <snip>
>
> ValueError: The input matrix was not symmetric and positive definite
> }}}
>
> At best the error message is misleading.
>
> The try/except block needs to be more careful. It should be checking if
> square roots are contained in the base ring, or it should first convert
> to an algebraically closed field, or something like that.
>
> In this example, the error is raised because the square root of a
> rational is not again a rational, when I think the test should be if the
> argument to the square root is negative.
>
> Perhaps for {{{QQ}}}, the base ring should be promoted to the Real
> Algebraic Field, {{{AA}}}.
>
> '''Depends''': #12966, #13018
>
> '''Apply''':
> 1. [attachment:trac_11274-cache-indefinite-factors-v1.patch]
> 1. [attachment:trac_11274-exact-cholesky-v1.patch]
New description:
The matrix E is clearly symmetric, and by looking at its eigenvalues and
the determinants of principal submatrices it is clearly positive definite.
{{{
sage: E = matrix(QQ, [[2, 1], [1, 1]])
sage: E.is_symmetric()
True
sage: E.eigenvalues()
[0.3819660112501051?, 2.618033988749895?]
sage: E.det()
1
sage: E.cholesky_decomposition()
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
<snip>
ValueError: The input matrix was not symmetric and positive definite
}}}
At best the error message is misleading.
The try/except block needs to be more careful. It should be checking if
square roots are contained in the base ring, or it should first convert to
an algebraically closed field, or something like that.
In this example, the error is raised because the square root of a rational
is not again a rational, when I think the test should be if the argument
to the square root is negative.
Perhaps for {{{QQ}}}, the base ring should be promoted to the Real
Algebraic Field, {{{AA}}}.
'''Depends''': #12966, #13018
'''Apply''':
1. [attachment:trac_11274-cache-indefinite-factors-v1.patch]
1. [attachment:trac_11274-exact-cholesky-v1.patch]
1. [attachment:trac_11274-exact-cholesky-two-by-two.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11274#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.