Pre-alocate matrix