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

setRepresentation -- stores user-defined representation

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 7/9  7   5/4  5    7/8 |
     | 9/4 7/10 3/7 2/9  10/9 5/6 |
     | 3/4 7/10 6/7 3/10 10   5   |
     | 7/4 7/3  6   3/7  3/2  2/5 |

              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 7/9  7   5/4  5    7/8 |
     | 9/4 7/10 3/7 2/9  10/9 5/6 |
     | 3/4 7/10 6/7 3/10 10   5   |
     | 7/4 7/3  6   3/7  3/2  2/5 |

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

o5 = {groundSet, rankFunction, storedRepresentation}

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

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

o6 : HashTable

See also

Ways to use setRepresentation:

  • setRepresentation(Matroid,Matrix)

For the programmer

The object setRepresentation is a method function.


The source of this document is in Matroids/doc-Matroids.m2:2253:0.