[GAP Forum] Problem with TransposedMat

Frank Lübeck Frank.Luebeck at math.rwth-aachen.de
Fri Jul 6 09:56:58 BST 2007


On Thu, Jul 05, 2007 at 08:38:49AM +0200, Gábor Nagy wrote:
> When trying to transpose large matrices with TransposedMat(), GAP4 often 
> runs out of memory, even if I start it with a workspace size of 300M.
> 
> The matrices we have been working were:
> 
> a) approx. 16.000 x 15.000 binary matrix over GF(2), and
> 
> b) 6.500 x 6.500 square matrix with elements from [1..6500].

Dear Gábor, dear Forum,

Ad case a):  There is special function (method) in GAP to transpose compressed
matrices over GF(2). But you have to help GAP to detect that this method can
be used. If m is your matrix call 'ConvertToMatrixRep(m, 2);' first.
In this case your matrix needs 15000*16000/8 bytes (~ 30MB) plus some small
overhead. In a GAP with about 140MB I had no problem to transpose such a
matrix.

Ad case b): This matrix needs (on a 32bit system) 6500*6500*4 bytes plus
some small overhead (double on a 64bit system), that is ~170MB.
Therefore you cannot hold your matrix and its transpose in 300MB.
Actually, the current GAP allocates ~200MB for the resulting transposed 
matrix due to GAPs strategy to allocate memory for growing lists 
(I will change this with the next update).

If you do no longer need the first matrix, there is
TransposedMatDestructive which does the transposing almost in place. 
This works nicely in your case b), but it takes a very long time in case a),
so for a) transpose with the fast method and Unbind the first matrix
afterwards.

With best regards,

   Frank

-- 
///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Templergraben 64,  ///
\\\                    52062 Aachen, Germany                          \\\
///  E-mail: Frank.Luebeck at Math.RWTH-Aachen.De                        ///
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/           \\\



More information about the Forum mailing list