Open galashin opened 1 month ago
Note: that’s my first encounter with Sage codebase, maybe I’ll miss something trivial or use incorrect terminology
I’ve debugged why it happens:
echolize
method ([code]())scaled_partial_pivoting
method is used (code).SR
classical
method is used (code)classical
is used for SR
is implementation of echelonize
for Matrix_symbolic_dense
(code). Which is probably correct, since there is no absolute value in SR
.So in general it seems that everything worked as expected, it seems there is no way in general to use scaled_partial_pivoting
for SR
(or am I missing something?). It’s just that classical
method can’t work here. Maybe some other method?
One of the possible approaches here is to use Maxima for inverting, AFAIU Matrix_symbolic_dense
heavily uses Maxima anyway. And Maxima handles this inversion.
I’ve checked adding to Matrix_symbolic_dense
class method:
def __invert__(self):
return self._maxima_().invert()._sage_()
fixes this problem. Though, this probably requires thorough testing (including performance) for comparing Maxima inversion vs the existing algorithm.
Steps To Reproduce
Expected Behavior
Identity matrix expected
Actual Behavior
Does not output anything close to the identity matrix. Removing
SR,
from the matrix definition produces the identity matrix.Additional Information
No response
Environment
Checklist