[GAP Forum] saving variables to a file

R.N. Tsai r_n_tsai at yahoo.com
Thu Jun 16 00:35:28 BST 2016


This is actually perfect for GF(2) matrices (which is all I need for now).Interestingly enough if I convert the GF(2) matrix to 1 and 0's (using "Int") the bitmapfile is 24x larger...that was just an experiment so it's actually better to stay in GF(2).I should be able to process a .bmp file in matlab so this could be one way to passthe matrices between the two.Thanks for your help.R.N.

      From: Stefan Kohl <stefan at mcs.st-and.ac.uk>
 To: R.N. Tsai <r_n_tsai at yahoo.com> 
Cc: Max Horn <max at quendi.de>; GAP Forum <forum at gap-system.org>
 Sent: Wednesday, June 15, 2016 1:51 PM
 Subject: Re: [GAP Forum] saving variables to a file
   
On Tue, June 14, 2016 5:20 pm, R.N. Tsai wrote:
> Thanks for the response Max,The matrices are over GF(2), so hopefully they can be
> managed more efficiently than generic matrices.R.N

One thing you could do specifically for matrices over GF(2) is to save them
as monochrome bitmap pictures -- this uses just one bit per entry (plus a tiny
overhead for the description block for the picture):

gap> M := NullMat(10000,10000,GF(2));; # just some GF(2) matrix, could be any
gap> file := Filename(DirectoryTemporary(),"matrix.bmp"); # pick a file name
"/tmp/tmIthaXA/matrix.bmp"
gap> SaveAsBitmapPicture(M,file); # save the matrix to the file, 12.5 MB in this case
gap> time;
18392
gap> N := LoadBitmapPicture(file);; # read it in again
gap> time;
8320
gap> N = M;
true

Hope this helps,

    Stefan




  


More information about the Forum mailing list