Matrix génération
(if taking long, click here)