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

setRepresentation -- stores user-defined representation

Synopsis

Description

This function provides a way for the user to specify a representation of a matroid (given by a matrix). The matrix is cached in the matroid (under M.cache.storedRepresentation), and can be retrieved using getRepresentation.

This function will also create a custom rank function for the matroid, using the given representation (this is also cached in the matroid, under M.cache.rankFunction). This can lead to faster computations of rank.

i1 : M = uniformMatroid(4, 6)

o1 = a "matroid" of rank 4 on 6 elements

o1 : Matroid
i2 : A = random(QQ^4,QQ^6)

o2 = | 9/2 1   7/4  7/10 5/2 2   |
     | 1/2 3/4 7/9  7/3  6/7 6   |
     | 9/4 3/2 7/10 7    2/3 5/4 |
     | 1/2 3/4 1/2  3/7  1   2/9 |

              4       6
o2 : Matrix QQ  <-- QQ
i3 : setRepresentation(M, A)

o3 = a "matroid" of rank 4 on 6 elements

o3 : Matroid
i4 : getRepresentation M

o4 = | 9/2 1   7/4  7/10 5/2 2   |
     | 1/2 3/4 7/9  7/3  6/7 6   |
     | 9/4 3/2 7/10 7    2/3 5/4 |
     | 1/2 3/4 1/2  3/7  1   2/9 |

              4       6
o4 : Matrix QQ  <-- QQ
i5 : keys M.cache

o5 = {groundSet, rankFunction, storedRepresentation}

o5 : List
i6 : elapsedTime fVector M
 -- .00864738s elapsed

o6 = HashTable{0 => 1 }
               1 => 6
               2 => 15
               3 => 20
               4 => 1

o6 : HashTable

See also

Ways to use setRepresentation:

For the programmer

The object setRepresentation is a method function.