Use Numpy arrays instead of `ForEachObject` instances
We currently use
ForEachSC objects to hold values (scalars or arrays) for each of the MOSAs or SC. This is backed by plain Python dictionaries, and wrapped with a few convenience functions (utility functions around indices, or to transform the mapping between indices and values -- to adjacent or distant MOSAs, etc). In addition, we define basic arithmetics on
ForEachObject so that we can perform operations MOSA-per-MOSA or SC-per-SC. Other functions can be mapped using the
However, this is a bit reinventing the wheel, as the element-per-element operations are already implemented by Numpy, as well as many operations extensively used in numerical codes. It might slow things down and take up more memory than needed.
We propose to deprecate the use of the
ForEachObject class, and use multi-dimensional Numpy arrays instead.
Helper functions can provide
- index processing (
- conversion between SC and MOSA (
- transformation of indices (