Macaulay2 » Documentation
Packages » Posets :: Precompute
next | previous | forward | backward | up | index | toc

Precompute -- a package-wide configuration that toggles precomputation

Description

Many routines in this package are written to take advantage of known structure on some posets to quickly precompute some of the cached data. However, this may not always be desirable, and so this flag toggles whether precomputation occurs. It can be set with the setPrecompute method.

As an example, chain posets are known to be distributive lattices. If the precomputation flag is set, then the method fills this in automatically.

i1 : setPrecompute true;
i2 : C = chain 10;
i3 : peek C.cache

o3 = CacheTable{connectedComponents => {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}                                      }
                coveringRelations => {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}}
                filtration => {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}
                greeneKleitmanPartition => Partition{10}
                isAtomic => false
                isDistributive => true
                isEulerian => false
                isLowerSemilattice => true
                isLowerSemimodular => true
                isUpperSemilattice => true
                isUpperSemimodular => true
                maximalAntichains => {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}
                maximalChains => {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}
                maximalElements => {9}
                minimalElements => {0}
                name => C
                rankFunction => {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
i4 : P = poset apply(9, i -> {i+1, i+2});
i5 : peek P.cache

o5 = CacheTable{name => P}
i6 : C == P

o6 = true
i7 : time isDistributive C
     -- used 2.869e-6 seconds

o7 = true
i8 : time isDistributive P
     -- used 2.7796 seconds

o8 = true

We also know that the dual of a distributive lattice is again a distributive lattice. Other information is copied when possible.

i9 : C' = dual C;
i10 : time isDistributive C'
     -- used 2.35e-6 seconds

o10 = true
i11 : peek C'.cache

o11 = CacheTable{connectedComponents => {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}                                      }
                 coveringRelations => {{1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5}, {7, 6}, {8, 7}, {9, 8}}
                 filtration => {{9}, {8}, {7}, {6}, {5}, {4}, {3}, {2}, {1}, {0}}
                 greeneKleitmanPartition => Partition{10}
                 isDistributive => true
                 isEulerian => false
                 isLowerSemilattice => true
                 isLowerSemimodular => true
                 isUpperSemilattice => true
                 isUpperSemimodular => true
                 maximalAntichains => {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}
                 maximalChains => {{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}}
                 maximalElements => {0}
                 minimalElements => {9}
                 name => C'
                 rankFunction => {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}

See also

For the programmer

The object Precompute is a symbol.