ANN: Release of NumPy 0.9.5

Robert Kern robert.kern at gmail.com
Fri Feb 17 14:32:12 EST 2006


vinjvinj wrote:
> I use Numeric extensivly and have been thinking of migrating to Numpy.
> I have a couple of questions:
> 
> 1. Will the speed of creating new arrays, copying new arrays and
> slicing new arrays be similar  to Numeric?

Various benchmark comparisons with Numeric and numarray have been done. Check
the archives of the numpy-discussion and scipy-dev lists. Of course, if you're
interested in performance on your problems, you need to time code that's
appropriate to your uses. Since numpy installs alongside Numeric, you should be
able to do this relatively easily.

> 2. I have some pyrex code that uses Numeric header files. will they be
> compatible with numpy?

Yes. Just change the header file from "Numeric/arrayobject.h" to
"numpy/arrayobject.h".

> 3. I use they following tow functions from scipy.core: extract, insert.
> Are there similar functions in Numpy?

Most, if not all, of the functions in scipy_base have been moved into numpy.

In [1]: import numpy

In [2]: numpy.extract?
Type:           function
Base Class:     <type 'function'>
String Form:    <function extract at 0x6e2870>
Namespace:      Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.5.2085-py2.4-macosx-10.4-ppc.egg/numpy/lib/function_base.py
Definition:     numpy.extract(condition, arr)
Docstring:
    Return the elements of ravel(arr) where ravel(condition) is True
    (in 1D).

    Equivalent to compress(ravel(condition), ravel(arr)).


In [3]: numpy.insert?
Type:           function
Base Class:     <type 'function'>
String Form:    <function insert at 0x6e28b0>
Namespace:      Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.5.2085-py2.4-macosx-10.4-ppc.egg/numpy/lib/function_base.py
Definition:     numpy.insert(arr, mask, vals)
Docstring:
    Similar to putmask arr[mask] = vals but the 1D array vals has the
    same number of elements as the non-zero values of mask. Inverse of
    extract.

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list