speedup matrix generator