Revert "Change Matrix from class to struct."

This reverts commit 95c44a356dcce43c0aacc1a13a421dc2f925cc65.