A matrix formalism to run epidemiological simulations