Completed definition of matrix types.
Converted macro to function.
Added some tests of the matrix functionality and squashed some bugs.