Updated SparseBinaryMatrix to support N-dimensional topology (and other improvements)

This is related to #118