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);
 -- .000373523s elapsed
i3 : elapsedTime jacobiTrudi({4,3,2,1}, R, Memoize => true);
 -- .000013751s 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);
 -- .000367292s elapsed
i5 : elapsedTime jacobiTrudi({5,3,2}, R, Memoize => true);
 -- .000012352s 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);
 -- .000011112s elapsed
i7 : elapsedTime jacobiTrudi({4,3,2,1}, R);
 -- .000010141s 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 /build/macaulay2-ih1poA/macaulay2-1.26.05+ds/M2/Macaulay2/packages/SchurRings.m2:7709:0.