Replaced duplicated matrix preallocation with list comprehension