lumopt2.utils.sparse_helpers#

Stateless utility functions for sparse-dense index conversions.

These functions convert between flattened sparse indices and multi-dimensional dense indices for N-dimensional arrays. They have no dependency on Lumerical or any simulation state.

Functions#

dense_to_sparse_indices(dense_indices, ...)

Convert multi-dimensional dense indices to flattened sparse indices.

sparse_to_dense_indices(sparse_indices, ...)

Convert flattened sparse indices to multi-dimensional dense indices.

sparse_to_sparse(sparse_indices, ...)

Re-index sparse indices from one dense shape to another with offsets.