Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can I import M2 matrices into sage?

I have thousands of matrices I computed in Macaulay2. They are scattered throughout sub-directories of ~/matrices/ one example of one of these matrices is

$ cat ~/matrices/foo/001-matrix

map((ZZ)^9,(ZZ)^7,{{1, 0, -1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0, 0}, {1, 0, 0, -1, -1, -1, -1}, {1, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0}})

I would like to write a script to convert each of these matrices into a format that sage can read. It seems like

sage: A = macaulay2(value get "~/matrices/foo/001-matrix")

should work but this returns the error invalid syntax. Is it possible to perform my desired conversions?