[Numpy-discussion] Optimizing recursive loop - updated example

Pauli Virtanen pav at iki.fi
Mon Jul 25 06:35:05 EDT 2011


Mon, 25 Jul 2011 12:30:34 +0200, Robert Elsner wrote:
> Thanks for the hint. I thought about Cython myself but I was unable to
> get even the slightest speed gain out of it. Here is the equivalent
> Cython code with the timing and setup.py. I typed (I think). Am I
> missing something obvious?

Cython doesn't vectorize the slice operations such as

	b[:,j-g]

but falls back to Numpy on them. You'll need to convert the slice
notation to a loop to get speed gains.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list