#6358: use numpy to optimize RDF and CDF solve_right functions
----------------------------+-----------------------------------------------
Reporter: was | Owner: was
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0.3
Component: linear algebra | Keywords:
Reviewer: | Author:
Merged: |
----------------------------+-----------------------------------------------
{{{
> Does sage have a way to use a numeric method (such as Jacobi, or Gauss-
> Sidel) to solve matrix equations of the form A*x = b? (CDF matrices by
> the way). the A.solve_right(b) method is too slow.
>
> Thanks,
> Ethan
Here is an example of how to convert back/forth to numpy to solve A*x
= b very quickly. Below we do this with A a 1000x1000 matrix, and it
takes about a half second. It would be *great* if somebody made it
so this would work in Sage automatically without having to explicitly
use numpy like I've done before. But for you, I bet this is a minor
inconvenience.
sage: n = 1000
sage: a = random_matrix(CDF,n); v = random_matrix(CDF,n,1)
sage: aa = a.numpy(); vv = v.numpy()
sage: import numpy
sage: time ww = numpy.linalg.solve(aa, vv)
Time: CPU 0.57 s, Wall: 0.41 s
sage: w = matrix(CDF, ww)
sage: max([abs(z) for z in a*w - v])
5.46740430707e-12 + 8.431033649e-13*I
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6358>
Sage <http://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
-~----------~----~----~----~------~----~------~--~---