On Thu, 2011-07-14 at 05:32 +0200, William Stein wrote: > Sage is probably just using some completely generic general > implementation of "kernel" for matrices. > There is an SVD implementation in Sage, which computes the Singular > Value Decomposition of your matrix quickly: > > sage: M = matrix(RDF, 200,400, lambda i,j: i+j) > sage: time S = M.SVD() > Time: CPU 0.10 s, Wall: 0.07 s > sage: > > One can read off the kernel of a matrix from the SVD (exercise in > google or linear algebra). > Hopefully you can consider writing a little function for yourself to > do this, and even better submit > a patch to trac.sagemath.org... > > http://sagemath.org/doc/developer/walk_through.html
Thanks -- I'll look into the process of writing a patch over the weekend. Also, is there a way to profile the time Sage is spending while it's computing the kernel? Trying to find the kernel of rational matrices, I get strange results: sage: M = matrix(QQ,500,500,lambda i,j: 1/(i+j+1)) sage: %time K = M.kernel().basis_matrix() CPU times: user 0.33 s, sys: 0.06 s, total: 0.38 s Wall time: 0.35 s sage: M2 = magma(M) sage: %time K = magma.KernelMatrix(M2) CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.71 s sage: M = matrix(QQ,500,1,lambda i,j: 1/(i+j+1)) sage: %time K = M.kernel().basis_matrix() CPU times: user 14.62 s, sys: 1.34 s, total: 15.96 s Wall time: 14.33 s sage: M2 = magma(M) sage: %time K = magma.KernelMatrix(M2) CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.01 s In general, Sage seems to take a long time when the kernel is large, even if the actual matrix is smaller. Henry de Valence -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org