ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 20 Feb 2018 19:16:01 +0100Speed up calculation of left kernelhttps://ask.sagemath.org/question/41200/speed-up-calculation-of-left-kernel/ Is there any way to accelerate the calculation of the left kernel of a matrix? It could be by allowing sage to use more memory or using some parallelism, for instance.
I have a 1230 x 74 dense matrix over Integer Ring
A = Matrix(ZZ, 1230, 74)
and when I try to use
A.left_kernel()
the calculations doesn't finish (it has run for three days and then I interrupted the script).Tue, 20 Feb 2018 15:33:49 +0100https://ask.sagemath.org/question/41200/speed-up-calculation-of-left-kernel/Answer by John Palmieri for <p>Is there any way to accelerate the calculation of the left kernel of a matrix? It could be by allowing sage to use more memory or using some parallelism, for instance.</p>
<p>I have a 1230 x 74 dense matrix over Integer Ring</p>
<pre><code>A = Matrix(ZZ, 1230, 74)
</code></pre>
<p>and when I try to use</p>
<pre><code>A.left_kernel()
</code></pre>
<p>the calculations doesn't finish (it has run for three days and then I interrupted the script).</p>
https://ask.sagemath.org/question/41200/speed-up-calculation-of-left-kernel/?answer=41202#post-id-41202First, calculations over the integers will be slow, and the best way to speed them up is, if possible, work over a field (or several fields) instead. Can you get the information you need from `A.change_ring(QQ)` and `A.change_ring(GF(2))`?
If that won't work, then you should try some of the different available algorithms for `left_kernel`. I tried this with much smaller matrices, just to test things:
sage: %timeit random_matrix(ZZ, 123, 74).left_kernel()
1 loop, best of 3: 8.25 s per loop
sage: %timeit random_matrix(ZZ, 123, 74).left_kernel(algorithm='default')
1 loop, best of 3: 8.28 s per loop
sage: %timeit random_matrix(ZZ, 123, 74).left_kernel(algorithm='pari')
1 loop, best of 3: 1.07 s per loop
sage: %timeit random_matrix(ZZ, 123, 74).left_kernel(algorithm='flint')
1 loop, best of 3: 7.77 s per loop
sage: %timeit random_matrix(ZZ, 123, 74).left_kernel(algorithm='padic')
1 loop, best of 3: 7.93 s per loop
The different algorithms may not scale equally well, though, so experiment with different algorithms and with different sizes of matrices.Tue, 20 Feb 2018 19:16:01 +0100https://ask.sagemath.org/question/41200/speed-up-calculation-of-left-kernel/?answer=41202#post-id-41202