[Numpy-discussion] numpy.matlib.abs

Keith Goodman kwgoodman at gmail.com
Sun Feb 4 20:28:48 EST 2007


On 2/4/07, Robert Kern <robert.kern at gmail.com> wrote:
> 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.

Could numpy.matlib get the same functions as numpy? Would that have to
be done with a manually maintained import list?

I always use "import numpy.matlib as M" and then search for function
names in ipython (M.a[TAB]). I didn't realize that some functions are
missing.



More information about the NumPy-Discussion mailing list