converted matricies to use heap allocations

-still need to convert strassens