Added a WIP matrix class.

Very much a work-in-progress with incomplete methods and some anomalies. May need to rethink the approach and switch from templates to something else, as this kind of concept introduces some severe limitations.