[SciPy-User] Numpy/Scipy: Avoiding nested loops to operate on matrix-valued images
josef.pktd@gmai...
josef.pktd@gmai...
Tue Mar 20 10:38:42 CDT 2012
On Tue, Mar 20, 2012 at 11:33 AM, Nathaniel Smith <njs@pobox.com> wrote:
> 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?)
only in a test case, AFAIK
from numpy.core.umath_tests import matrix_multiply
Josef
>
>> 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
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list