Macaulay2 » Documentation
Packages » Matroids :: saveMatroid
next | previous | forward | backward | up | index | toc

saveMatroid -- save matroid to file

Synopsis

Description

This method stores a matroid in string format in an output file, including much of the auxiliary data used in computations in this package (such as circuits, flats, representations, etc.)

The name of the output file can be specified. If no output file is specified, then a random filename is chosen (using temporaryFileName - note that in this case, such files are automatically deleted when the M2 session ends, so make sure to copy the temporary file before exiting M2).

The saved matroid can be read back into a later M2 session using the function readFromFile, which is a synonym for the composite of value and get. This takes a filename (as a String) and returns the value of its contents, as interpreted by M2.

i2 : V = specificMatroid "vamos"

o2 = a "matroid" of rank 4 on 8 elements

o2 : Matroid
i3 : betti ideal V

            0  1
o3 = total: 1 41
         0: 1  .
         1: .  .
         2: .  .
         3: .  5
         4: . 36

o3 : BettiTally
i4 : saveMatroid(V, "vamos.txt")

o4 = vamos.txt
i5 : clearAll()
i6 : V = readFromFile "vamos.txt"

o6 = a "matroid" of rank 4 on 8 elements

o6 : Matroid
i7 : keys V.cache

o7 = {groundSet, ideal}

o7 : List

Ways to use saveMatroid:

For the programmer

The object saveMatroid is a method function.