Finite automata for caching in matrix product algorithms | Synapse