Matrix#invert: Move out matrix instantiation outside the loop

Making a new Matrix instance for every iteration of the loop is
not necessary, so it can be moved out and reused.
Matrix#invert: Don't create matrix instance with preset data

Setting the data on instantiation is totally unnecessary in this
case, as we're setting the data manually after creation.
Matrix#invert: Add caching to not create too many Matrix instances
Matrix#getDeterminant: Move out matrix creation outside the loop
Matrix#getDeterminant: Add caching to not create too many instances
2.0.1