[SciPy-User] Numpy/Scipy: Avoiding nested loops to operate on matrix-valued images
Nathaniel Smith
njs@pobox....
Tue Mar 20 10:33:58 CDT 2012
On Mon, Mar 19, 2012 at 9:23 AM, tyldurd <dhondt.olivier@gmail.com> wrote:
> I have done a lot of research on this topic but it seems it is not feasible
> in terms of slicing or vectorizing. The only solution I found would be with
> generalized ufuncs but from what I understand, they require to write C code,
> which I would like to avoid :-)
I think the idea of generalized ufuncs is that linalg.logm should be
written as a generalized ufunc already out of the box, and then this
would be straightforward. However: (1) it isn't, and (2) even if it
were, I'm having trouble understanding from the available docs how you
would actually use it -- maybe calling logm would just work for your
case, but there don't seem to be any examples available of how it
chooses which dimensions to apply to. (Are there any generalized
ufuncs actually defined in the standard packages? For instance, is
np.dot implemented as a generalized ufunc? Should it be?)
> Therefore, I am going to stick to nested loops at least for now.
That seems like the best option to me. Nothing immoral about using a
loop when that's what you need :-).
-- Nathaniel
More information about the SciPy-User
mailing list