Feature/shareable indexing

we check for Matrix singularity in a few places. Perhaps it's worth refactoring into a checkSingularMatrix static method.