Dear all,

Thanks to everyone for their help with my question. In addition to the 
suggestions already made, I am forwarding a solution from Dr. Robert Lazar 
(with his kind permission). Basically, you can run GAP inside of Sage, and then 
use Sage to export a *.mat file. I guess this is possible because Sage is built 
on Python, and enough people do linear algebra with Python that one of them 
eventually figured out how to make it talk to MATLAB.

See below for sample Sage code to export a GAP matrix as a *.mat file.

All the best,
Joey Iverson

Assistant Professor
Department of Mathematics
Iowa State University


From: Robert Lazar <tyrus...@gmail.com>
Date: Thursday, October 17, 2019 at 12:35 PM
To: "Iverson, Joseph W [MATH]" <j...@iastate.edu>
Subject: Re: Robert Lazar// Dr.Songs old student

Note: This should be run inside sage. If you run this on butlers server you 
will get links to download the .mat. If you are working in gap first you can 
convert that code to run gap through sage and I can assist with that as well.

import scipy.io<http://scipy.io/> as sio
import numpy as np
A = gap([[1,0],[0,1]])
A= matrix(CC,A)
sio.savemat('test_A.mat', {'A':A})

B = gap([[E(4),0],[0,E(4)]])
B= matrix(CC,B)
sio.savemat('test_B.mat', {'B':B})


Explanation:

Matrix(CC,A) converts the cyclotomic to a matrix approximation over the complex 
numbers.

Please let me know if you need something more specific!



On Oct 17, 2019, at 11:08 AM, Iverson, Joseph W [MATH] 
<j...@iastate.edu<mailto:j...@iastate.edu>> wrote:
Hi Robert,

Thanks, that's great! How about a really simple example like
A:=[[1,0],[0,1];

Or to involve some cyclotomics:
B:=[[E(4),0],[0,E(4)]];

If I can just get the basic syntax, then I think I can figure out the rest for 
myself.

Thanks again for your help!

All the best,
Joey

Assistant Professor
Department of Mathematics
Iowa State University


On 10/17/19, 6:59 AM, "Robert Lazar" 
<tyrus...@gmail.com<mailto:tyrus...@gmail.com>> wrote:

   Hey Dr.Iverson,

   I saw your posts in the gap forum. I think I might be able to help or at 
least try. There is a python package called scipy.io<http://scipy.io> that can 
save as mat files.

   If you have the code in gap I should have some time to rewrite it accessing 
it via python (it’s as simple as wrapping the function in gap()) and save the 
files. Dr.Butlers sage sever has all of the necessary packages.

   If you have a smaller example it would be easier. So we can test it quicker.

   Best regards,
   Robert
_______________________________________________
Forum mailing list
Forum@gap-system.org
https://mail.gap-system.org/mailman/listinfo/forum

Reply via email to