sparse 3d matrix/array in Python?
Happy to suggest a (possibly obvious) implementation of this, which could be made in pure Python or C/Cython if you’ve got time and space for new dependencies, and need it to be faster. A sparse matrix in N dimensions can assume most elements are empty, so we use a dictionary keyed on tuples: class NDSparseMatrix: … Read more