Dom::SparseMatrix_LinBox – Interface to the sparse matrix C++ library LinBox

Dom::SparseMatrix_LinBox(R) creates a domain for sparse matrices over the ring R, with computations done by http://linalg.org/linbox.

→ Examples

Creating the Type

Dom::SparseMatrix_LinBox(R)

Parameters:

R

a ring

Details:

Experimental. You need to have Linbox installed separately. More precisely, our interface currently uses the little binary smithform_gap that Jean-Guillaume Dumas wrote for his gap interface. All you have to do is to download the appropriate homology binary package form http://www.linalg.org/gap.html, and put the included smithform_gap binary somewhere on your path.

Creating Elements

SparseMatrix_LinBox(n)(l)

Parameters:

l

 

Categories

Entries

"linbox"

the name of the LinBox executable.

Access Methods

matdim – size of a matrix

(Dom::SparseMatrix_LinBox(R))::matdim({dom})

Returns the size of the matrix as a list of two integers [nrows, ncols].

rank – rank of a matrix

(Dom::SparseMatrix_LinBox(R))::rank(dom m)

Returns the rank of the matrix. Computed by LinBox using blackbox method.

rankGauss – rank of a matrix

(Dom::SparseMatrix_LinBox(R))::rankGauss(dom m)

Returns the rank of the matrix. Computed by LinBox using gauss elimination.

characteristicColumns – characteristic columns of a matrix

(Dom::SparseMatrix_LinBox(R))::characteristicColumns(dom m)

Returns a list of indexes of columns of the matrix which are linearly independent. Computed by LinBox using elimination.

Example 1:

Here is a sample session:

Z5 := Dom::IntegerMod(5):

M:=Dom::SparseMatrix_LinBox(Z5):

M::verboseLevel := "10 10":

m:=M():

m:=m::appendRow([[4,Z5(3)]]):

m:=m::appendRow([[2,Z5(7)],[3,Z5(4)]]):

m:=m::appendRow([[1,Z5(3)],[2,Z5(8)]]):

m:=m::fix();

m::matdim();

m::file();

fprint(Unquoted, 0, shell::system("cat ".m::file()));

m::rankBlackBox(); // broken

m::rankGauss();

m::characteristicColumns();

m::_delete():

                             [3, 4]

 

                          "/tmp/matrix"

0 0 M

1 4 3

2 2 2

2 3 4

3 1 3

3 2 3

0 0 0

#I:D   Wiedemann: Computing rank via Wiedemann algorithm

#I:D   Wiedemann: Computing rank mod 5 in GF(15625).

#I:D   Wiedemann: Rank 0, computed deterministically.

#I:T   Wiedemann: cpu  time : 0.13 seconds

#I:T   Wiedemann: sys  time : 0 seconds

#I:T   Wiedemann: real time : 0.168739 seconds

 

                                3

#I:D   Gauss Reordering: 4 x 3

#I:R   Gauss Reordering: Rank : 3 over GF(5)

#I:T   Gauss Reordering: cpu  time : 0 seconds

#I:T   Gauss Reordering: sys  time : 0 seconds

#I:T   Gauss Reordering: real time : 9.0003e-05 seconds

 

                                3

#I:D   Gauss Reordering: 4 x 3

#I:R   Gauss Reordering: Rank : 3 over GF(5)

#I:T   Gauss Reordering: cpu  time : 0 seconds

#I:T   Gauss Reordering: sys  time : 0 seconds

#I:T   Gauss Reordering: real time : 0.00518698 seconds

 

                            [0, 1, 3]