[Numpy-discussion] numexpr: where function

David M. Cooke cookedm at physics.mcmaster.ca
Sun Jun 4 20:23:18 EDT 2006

On Mon, Jun 05, 2006 at 08:52:17AM +0100, Simon Burton wrote:
> Is it possible to use the where function in numexpr ?
> I see some code there for it, but not sure how to use it.

Yes; 'where(expression, a, b)' will return an element from 'a' when
'expression' is non-zero (true), and the corresponding element from 'b' when
it's 0 (false).

> While I'm asking, it seems numexpr only does pointwise
> operations ATM, ie there is no .sum ?

Adding reducing functions is on the list of things to-do. I don't have much
time for it now, unfortunately.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the NumPy-Discussion mailing list