#4932: fix solve_left_LU for matrix_double_dense, which was totally broken
forever
(?)
----------------------------+-----------------------------------------------
Reporter: was | Owner: jason
Type: defect | Status: assigned
Priority: major | Milestone: sage-3.2.3
Component: linear algebra | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by jason):
Okay, apparently lu_factor and lu in the scipy library return two
completely different things.
Some notes from some experimentation:
1. scipy.linalg.lu is usually significantly slower than
scipy.linalg.lu_factor
2. scipy.linalg.lu_factor returns a much more compact answer
3. scipy.linalg.lu_factor returns an answer directly suitable for
lu_solve, etc.
I say we cache the lu_factor results and then build the P,L,U from these
results if needed.
The strictly lower triangular part of the returned matrix is the L, the
upper triangular part is the U, so that the returned matrix is
(L-identity)+U.
The pivot array gives the row swaps needed. For example, the following
code constructs the new order of rows based on the pivot array piv:
{{{
arr=range(size)
for i in range(size):
arr[i],arr[piv[i]] = arr[piv[i]],arr[i]
}}}
The P matrix will then have a 1 in the (i,arr[i]) position (or the
(arr[i],i) position...).
THE LU MATRIX RETURNED FROM lu_factor MIGHT BE TRANSPOSED! It was in my
case, for some reason.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4932#comment:3>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---