Tensors and Stochastic Automata Networks with Application to Chemical Kinetics