[GAP Forum] saving variables to a file

Stefan Kohl stefan at mcs.st-and.ac.uk
Fri Jun 17 00:14:07 BST 2016


On Thu, June 16, 2016 12:35 am, R.N. Tsai wrote:
> 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...

Yes -- if you take an integer matrix, you get a 24-bit color picture, where the
entries of the matrix are read as 256^2 * red value + 256 * green value + blue value.

    Stefan

>       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