[GAP Forum] saving variables to a file
R.N. Tsai
r_n_tsai at yahoo.com
Wed Jun 15 18:02:00 BST 2016
Dear all,I'll definitely look into using Sage and libGAP, but it also seems simple enough to add such a capability within GAP itself (save a single variable to a specific file even if restricting the variableto be numeric...)R.N.
From: Dima Pasechnik <dmitrii.pasechnik at cs.ox.ac.uk>
To: R.N. Tsai <r_n_tsai at yahoo.com>
Cc: GAP Forum <forum at gap-system.org>
Sent: Tuesday, June 14, 2016 4:19 AM
Subject: Re: [GAP Forum] saving variables to a file
Dear all,
On Tue, Jun 14, 2016 at 11:01:55AM +0200, Max Horn wrote:
> > On 14 Jun 2016, at 05:52, R.N. Tsai <r_n_tsai at yahoo.com> wrote:
> > I have same fairly large matrices that take a long time to calculate. Is there a way to save these efficiently?I read about saving the workspace but that won't help with this; I have many matrices and I want to load morethan one at a time. I tried printing to a text file but that takes a very long time because of the size of the matrices.
>
> To get a better feeling for your problem: How large are you matrices? Over which ring are they defined?
>
> > Here's how I would have done this in Ocatave/Matlab :
> > M1=(results of long calculations)save('M1.mat','M1);M2=...save('M2.mat','M2);
> > so in the future I can bring up these matrices into gap like this :
> > load('M1.mat','M1')
> > load('M2.mat','M2')
> >
> > and now I can process both say M3=M1+M2,....in the same gap session...
> > Any suggestions?
> > Also, is there an efficient way to pass data between gap and Octave/Matlab?
One way to pass data between GAP and Matlab (or Octave) is to use Sage(math)
(www.sagemath.org) which is a Python library with interfaces both to GAP
(and libGAP) and Matlab (or Octave).
And in fact you can do a lot with matrices using other Sagemath parts,
e.g. numpy.
Another thing I can think of is creating a Matlab mex interface to
libGAP, which allows you to load GAP as callable C library. See
https://bitbucket.org/vbraun/libgap
(not sure whether Octave has such capabilities)
By the way, this would be a great tool regardless of your task at hand.
HTH,
Dima
>
> One way to achieve this would be to use the IO_Pickle / IO_Unpickle functions from the GAP IO package. You can finde an example of using them here: <http://www.gap-system.org/Manuals/pkg/io-4.4.6/doc/chap10.html#X81BD8400832EE20B>. For details, see also <http://www.gap-system.org/Manuals/pkg/io-4.4.6/doc/chap5.html>
>
>
> Hope that helps,
> Max
>
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
More information about the Forum
mailing list