I have a method on a C++ object that treats all elements the same and
modifies the array in-place (quantizes each value). Usually I just have a
vector, i.e. a 1D array. But today I wanted to quantize a 2D array, and the

(DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)

failed to do the trick, because of the require_dimensions(array, 1) call.

So I created a new typemap in numpy.i

(DATA_TYPE* INPLACE_ARRAY_FLAT, DIM_TYPE DIM_FLAT)

that omits the call to "require_dimensions", and behold! It works for both
1D and 2D (and really any D).

Does this seem like a reasonable addition to numpy.i? Or is there another
way to do this that I am missing?

Regards,
  Tom
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to