#12689: Segfault in solve_left for sparse matrices over ZZ
------------------------------+---------------------------------------------
Reporter: davidloeffler | Owner: jason, was
Type: defect | Status: new
Priority: critical | Milestone: sage-5.0
Component: linear algebra | Keywords: segfault
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
------------------------------+---------------------------------------------
Comment(by dsm):
Ah, okay. I think I see what's going on. In matrix_sparse.pyx's augment:
{{{
cdef Matrix_sparse other = right.sparse_matrix()
[...]
if not (self._base_ring is right.base_ring()):
right = right.change_ring(self._base_ring)
}}}
attemps to change the right base ring to agree, but during the insertion
process, it still uses the old unchanged one:
{{{
for i, j in right.nonzero_positions(copy=False):
Z.set_unsafe(i, j + self._ncols, other.get_unsafe(i,j))
}}}
If we instead use
{{{
other = other.change_ring(self._base_ring)
}}}
then everything seems to work:
{{{
sage: z = A.change_ring(QQ).augment(B)
[skipping debugging output]
sage: z
[1 0 1 0]
[0 1 0 1]
}}}
and
{{{
sage: A.solve_left(B)
[1 0]
[0 1]
sage: parent(_)
Full MatrixSpace of 2 by 2 sparse matrices over Rational Field
}}}
So I think the fix is a one-liner. Any takers?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12689#comment:2>
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.