WIP: Clean up linear algebra code

This PR attempts to clean up the base linear algebra code.

General principles:
- Throw specific `Exception`s in favor of generic `error()` messages
- Remove redundant syntax, e.g. extraneous `return`s and semicolons
- Turn simple methods into one-liners
- Consolidate tests of matrix properties using assertion macros to throw errors for singular matrices, lack of positive definiteness, rank deficiency, etc.
- Fix typos