Macaulay2 » Documentation
Packages » SchurRings :: Memoize
next | previous | forward | backward | up | index | toc

Memoize -- Option to record values of the jacobiTrudi function

Description

This is an optional argument for the jacobiTrudi function, allowing one to store its values in order to speed up computations. When Memoize => true, every computed value is cached in a hash table on the symmetric ring, so repeated calls on the same partition return the cached value in constant time.

i1 : R = symmetricRing(QQ, 10);
i2 : elapsedTime jacobiTrudi({4,3,2,1}, R, Memoize => true);
 -- .000417926s elapsed
i3 : elapsedTime jacobiTrudi({4,3,2,1}, R, Memoize => true);
 -- .00001756s elapsed

The cache is attached to the ring R. After one partition is memoized, subsequent calls with a different partition perform the full Jacobi-Trudi determinant expansion, then cache it as well:

i4 : elapsedTime jacobiTrudi({5,3,2}, R, Memoize => true);
 -- .000410285s elapsed
i5 : elapsedTime jacobiTrudi({5,3,2}, R, Memoize => true);
 -- .0000152s elapsed

Without Memoize => true, each call recomputes the determinant from scratch; for large partitions this can be substantially more expensive than a single cached lookup.

i6 : elapsedTime jacobiTrudi({4,3,2,1}, R);
 -- .00001056s elapsed
i7 : elapsedTime jacobiTrudi({4,3,2,1}, R);
 -- .00001116s elapsed

See also

Functions with optional argument named Memoize:

For the programmer

The object Memoize is a symbol.


The source of this document is in SchurRings.m2:7709:0.