sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.21k stars 421 forks source link

Make Gram-Schmidt work again #12646

Open 1659f18b-8e7f-4ace-87e0-ea435f3ce618 opened 12 years ago

1659f18b-8e7f-4ace-87e0-ea435f3ce618 commented 12 years ago
sage: M = Matrix(RealField(100), 2, 2, [1, 2, 3, 4])
sage: M.gram_schmidt()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
...
NotImplementedError: Gram-Scmidt orthogonalization not implemented for matrices over inexact rings, except for RDF and CDF

This used to work in older Sage versions. And Schmidt lacks an h in the error message.

CC: @rbeezer

Component: linear algebra

Keywords: Gram-Schmidt

Issue created by migration from https://trac.sagemath.org/ticket/12646

koffie commented 12 years ago
comment:1

I ran in to this also when trying to use Johan his code at http://www.sagenb.org/home/pub/3154/ . It seems that this was changed in #10791 . I added Rob Beezer as a CC since he might probably have something usefull to say on how to fix this (I'm not blaming you Rob, reading the ticket the general implementation was broken and the old code is still available in modules.misc).

ps. Johan: you might find the following code snippet usefull:

#this broke because of #10791
#G, _ = M.gram_schmidt()
#this is a workaround:
from sage.modules.misc import gram_schmidt
G, _ = gram_schmidt(list(M))
v = []
1d7ec08f-60ae-4512-91a6-8324c06eab9f commented 12 years ago
comment:2

Replying to @koffie:

I added Rob Beezer as a CC since he might probably have something useful to say

Thanks, Marten, for including me.

  1. I wouldn't trust the old code on RealField(100) (or much else for that matter).
  2. The QR decomposition for RDF/CDF matrices would be my alternate suggestion. That's only 53-bit so that could be a downside if you need more precision.
  3. Or as Marten has suggested, all the old code is still available and unharmed if you want to take the extra step to import it.

Rob