sparsax.set_num_cache_size¶
- sparsax.set_num_cache_size(n)[source]¶
Cap the value-keyed numeric-factor cache per CHOLMOD pattern (default 32).
Every CHOLMOD call —
solve(),logdet(),factor_solve(),factor()and the rest — takes its factor from a per-pattern cache keyed onAx, so a repeated call with identical values skips the factorization. When the cache is full the oldest entry is evicted. A token fromfactor()holds its own reference, so eviction never invalidates it; onlyclear_cache()does. Each entry is a whole Cholesky factor, so the cap bounds memory.As with
set_lu_cache_size(), hold at least one factor pervmapbatch element: avmap(value_and_grad(logp))over more chains than the cap silently refactors on every solve and logdet within an evaluation.