Hid the arrays needed for matrices behind structs.

This gets rid of some ugly code and memcpys, and makes it more library-ish.
Specifically, we can pass a struct by value but not an array, so by putting
the array in the struct, we can have read-only in parameters.