#4260: use LinBox as native matrix representation for dense matrices over GF(p)
------------------------------+---------------------------------------------
Reporter: malb | Owner: cpernet
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.7.1
Component: linear algebra | Keywords: linbox, linear algebra
Work_issues: | Upstream: N/A
Reviewer: | Author: Burcin Erocal
Merged: | Dependencies:
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):
* author: => Burcin Erocal
Comment:
I finally rebased the patch from SD16. The template class in the patch
contains the updates made to the modn_dense class since then, like changes
to the `sig_*` functions. Apparently the modn_dense class representation
now allows permuting the rows by changing pointers in the `_matrix` array.
We can't allow that if we want to pass the `_entries` to linbox, so I
skipped those changes.
Sage builds with the attached patches, and you can construct matrices.
However, there are lots of bugs, some linbox wrappers are still stubs,
etc. Expect crashes and wrong results.
With the patch applied, I get a crash with the following:
{{{
sage: a = matrix(GF(97),3,4,range(12))
sage: a.echelonize()
*** glibc detected *** python: free(): invalid next size (fast):
0x000000000270b370 ***
======= Backtrace: =========
<snip>
}}}
AFAICT, the new cython code is an exact copy of the wrapper function in
`linbox-sage.C`. Here is what valgrind says:
{{{
==3026== Invalid write of size 8
==3026== at 0x39E49EF1: T.4552 (ffpack_ludivine.inl:420)
==3026== by 0x39E49AA0: T.4552 (ffpack_ludivine.inl:486)
==3026== by 0x39E4ABBF:
__pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26M
atrix_modn_dense_template_20_echelonize_linbox(_object*, _object*)
(ffpack.h:113
2)
==3026== by 0x4E74082: PyObject_Call (abstract.c:2492)
==3026== by 0x39E2CA8A:
__pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26M
atrix_modn_dense_template_19echelonize(_object*, _object*, _object*)
(matrix_mod
n_dense_double.cpp:8738)
==3026== by 0x4F17FF9: PyEval_EvalFrameEx (ceval.c:3706)
==3026== by 0x4F19CDC: PyEval_EvalCodeEx (ceval.c:2968)
==3026== by 0x4F19DB1: PyEval_EvalCode (ceval.c:522)
==3026== by 0x4F19083: PyEval_EvalFrameEx (ceval.c:4401)
==3026== by 0x4F19CDC: PyEval_EvalCodeEx (ceval.c:2968)
<snip lots more Py* lines>
==3026== Address 0x6ca16e8 is 0 bytes after a block of size 24 alloc'd
==3026== at 0x4C267CE: malloc (vg_replace_malloc.c:236)
==3026== by 0x39E4AA5A:
__pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_20_echelonize_linbox(_object*,
_object*) (memory.h:32)
==3026== by 0x4E74082: PyObject_Call (abstract.c:2492)
==3026== by 0x39E2CA8A:
__pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_19echelonize(_object*,
_object*, _object*) (matrix_modn_dense_double.cpp:8738)
==3026== by 0x4F17FF9: PyEval_EvalFrameEx (ceval.c:3706)
==3026== by 0x4F19CDC: PyEval_EvalCodeEx (ceval.c:2968)
==3026== by 0x4F19DB1: PyEval_EvalCode (ceval.c:522)
==3026== by 0x4F19083: PyEval_EvalFrameEx (ceval.c:4401)
==3026== by 0x4F19CDC: PyEval_EvalCodeEx (ceval.c:2968)
==3026== by 0x4F18074: PyEval_EvalFrameEx (ceval.c:3802)
<snip lots of Py* lines>
}}}
I'd appreciate any pointers about the problem above, though I don't know
if I'll have the time to come back to this before the bug days in August
(when I presume Martin will take over?).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4260#comment:3>
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.