What do you actually want to accomplish
on these multi-dimensional memoryviews?
If you just want to perform a numeric
operation on every element then you're probably better doing
something like:
def implementation(double [:] x):
# work does here
def wrapper(x):
return
implementation(np.asarray(x).ravel())
i.e. flatten the multidimensional array
to a 1D array then operate element-by-element. If you're hoping to
modify the array in place then you'll probably have to be a bit
more careful with my example to avoid copying rather than passing
references.
Another option would be to use a fused
type:
cdef fused multiD:
double
double[:]
double[:,:]
double[:,:,:]
You may find it difficult to write a
function that can meaningfully operate on such a type though
(because what are you actually going to do with it that looks the
same for all those different types?)
A further option would be to look at
the C API of Numpy's nditer (which is what they use to work
efficiently on arrays with different dimensionality). You'll find
that quite complex though.