Zac Diggum <[email protected]> writes:

> I didn`t know how to put together the indices for take(). Tried fancy
> indexing, which of course wouldn't work. Turns out indices is a 1D
> pyopencl array of dtype uint8. Indexing into a 2D array is done in a
> linear row-wise fashion. In a 3x3 array the central element would have
> the index 4.
> btw, there's no equivalent for setting elements with such an index
> array, is there? A put() function or something? setitem() can be used
> for single elements only, right?

There is a `multi_take_put` function in pyopencl.array. It's
undocumented (intentionally--because I don't know for sure that it's a
good idea to have it). The interface is a bit bizarre, but it should do
what you want.

Andreas

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to