[Numpy-discussion] numpy.matlib.abs

Robert Kern robert.kern@gmail....
Sun Feb 4 19:12:44 CST 2007


Keith Goodman wrote:
> There's a numpy.abs but no numpy.matlib.abs.
> 
>>> import numpy as N
>>> import numpy.matlib as M
>>>
>>> N.abs?
> Type:           ufunc
> Base Class:     <type 'numpy.ufunc'>
> String Form:    <ufunc 'absolute'>
> Namespace:      Interactive
> Docstring:
>     y = absolute(x) takes |x| elementwise.
> 
>>> M.abs?
> Object `M.abs` not found.

numpy.abs() is not exported via "from numpy import *", which is where
numpy.matlib gets all of its non-overridden functions from. It is not exported
because it conflicts with the builtin abs().

Of course, absolute() is preferred for the same reason, and
numpy.matlib.absolute() does exist.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list