[Numpy-discussion] Half baked C API?

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Tue Mar 15 09:53:52 EST 2005


On Mar 15, 2005, at 18:04, Ralf Juengling wrote:

> Yes. Think of dynamic programming algorithms like forward, backward,
> and viterbi for Hidden Markov Models. In this case you cannot avoid
> a loop over one axis, yet the code in the loop can be expressed in
> a few lines by matrix operations like 'dot', 'sum', 'outerproduct',

How much do you expect to gain compared to a Python loop in such a case?

> I don't want to, if don't have to for performance reasons. In an ideal
> world, I'd spend most of my time prototyping the algorithms in Python,
> and then, if performance is a problem, translate parts to C (or hand
> them to weave.blitz) with only minor changes to the prototype code.

Did you consider Pyrex? It lets you move from pure Python to pure C 
with Python syntax, mixing both within a single function.

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
---------------------------------------------------------------------





More information about the NumPy-Discussion mailing list