matrix printing function