I have an application that involves large n-dimensional arrays which are very sparse. scipy.sparse
has a useful 'vectorized getting and setting' feature, so that Cython can be used to populate a sparse matrix quickly.
Of course the scipy package can't handle n-dimensions. There are two packages I have found that do n-dimensional sparse arrays in python sparray
and ndsparse
. However it seems neither has the vectorized getting and setting feature.
So I need either:
- a python package for n-dimensional arrays with vectorized get and set or
- a c library for sparse arrays which I can easily access with Cython or
- some 'roll your own' option which I guess would require a c equivalent to a python dict
For my purpose I think mapping the n-dimension coordinates back to 1 or two dimensions could work. What would be better though is to have a dict equivalent that i can access fast inside a Cython loop. I assume this rules out the python dict
.
Wondering if someone could give me an example of how to use the c++ map object from within Cython?
"asking us to recommend or find a tool, library or favorite off-site resource are off-topic"
close reason. The man has obviously done his research, what else can one do? – Apn
-dimensional coordinates to2
-dimensional coordinates, and vice-versa. I suspect this will wreck (or at least diminish) the worth of vectorized getting and setting but you might want to validate that. – Phraseology