convert jagged array with rectangular one

_matrix was set up as an array of arrays, meaning it did 'rows' allocations each of 'cols' length. Changed to a single allocation. The single allocation should be more cache-friendly, and will reduce the number of indirections in the accesses, at the cost of a multiply.

Documented GC allocations.