The rank of a subset S of a matroid is the size of a maximal independent subset of S. The map 2^E $\to \mathbb{N}$, S $\mapsto$ rank(S), is called the rank function, and completely determines the matroid.
Once the rank of a given subset is computed, it is cached in the matroid (under M.cache#"ranks"), so future computations of the rank of the same set are (essentially) instant.
The user may choose to install a custom rank function for a matroid (which should take in a list of integers (corresponding to a subset of M.groundSet), and output an integer), under M.cache#"rankFunction". This is done automatically when a matroid is constructed from a matrix or graph, or with setRepresentation.

