Setting up matrix generater.