Generate large matrix, then store it in project memory instead of flash

you can use "progmem" for that.