On Feb 9, 2008 1:41 PM, Shunsuke Tsuchioka <[EMAIL PROTECTED]> wrote: > > Dear Linbox Support team, > > I am a graduate student in the math department of Kyoto university, > and want to calculate a basis of the nullspace > > \{ x\in F^n \mid Ax=0 \} > > for a given m times n matrix A whose entries are in a field F. > What is a good way to calculate a nullspace basis > for a given matrix A by LinBox? >
You might want to try doing this with Sage (http://sagemath.org), which is a free open source program with a very nice interpreter interface that is built on top of Linbox and provides the above functionality. E.g., dhcp46-76:hnf was$ sage ---------------------------------------------------------------------- | SAGE Version 2.10.1, Release Date: 2008-02-02 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: a = random_matrix(QQ, 5,3); a [ -1 -2 1] [-1/2 0 0] [ 1/2 -2 1] [ 1 2 1] [ 0 -2 -1/2] sage: a.kernel() Vector space of degree 5 and dimension 2 over Rational Field Basis matrix: [ 1 0 -8/5 9/5 12/5] [ 0 1 -1/5 3/5 4/5] sage: a.kernel().basis() [ (1, 0, -8/5, 9/5, 12/5), (0, 1, -1/5, 3/5, 4/5) ] Note that kernel returns the set of row vectors v such that v*A = 0. You can do quite large problems using Sage (which again, builds on Linbox, so it's OK that I'm posting here): sage: a = random_matrix(QQ, 100, 102) sage: time v = a.kernel() CPU times: user 0.04 s, sys: 0.02 s, total: 0.06 s sage: a = random_matrix(QQ, 400, 402) sage: time v = a.kernel() CPU times: user 0.59 s, sys: 0.09 s, total: 0.68 s Working modulo 97: sage: a = random_matrix(GF(97), 100, 102) sage: time v = a.kernel() CPU times: user 0.04 s, sys: 0.00 s, total: 0.04 s Wall time: 0.06 If the specific functionality (the field etc) that you need isn't available in Sage or is too slow, let me know, and Clement Pernet (one of the main Linbox developers) and I can very likely add support for using that functionality of Linbox in Sage. > The following is what I have tried: > > Fortunately in my research, a nullspace is mathematically guaranteed > to be 1-dimensional. Thus, I first thought "linbox/solutions/solve.h" > may help. But the code like the following > > -------------------------------------------------------------- > typedef LinBox::Modular< double > Field; > Field F(q); > LinBox::DenseMatrix< Field > A(F,row,col); > std::vector<Field::Element> x( A.coldim() ),b( A.rowdim() ); > A.setEntry( abracadabra, xyz, ... ) > for( std::vector<Field::Element>::iterator it=b.begin(); it != b.end(); ++it > ) { *it = 0; } > LinBox::solve( x, A, b, LinBox::Method::BlasElimination() ); > --------------------------------------------------------------- > > always returns the solution x = 0 (of course, it is a valid solution). > > I am sorry for such a basic question, but > it would be great if you colud help me. > > Shunsuke, TSUCHIOKA > Research Institute for Mathematical Sciences Kyoto University > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---