This is an archival dump of old wiki content --- see scipy.org for current material

numpy is intended to replace numarray and Numeric. It comes with a script to convert most adjustments for numarray (except for strings and records).

To have an overview of (some) changes needed to convert a numarray based program, this page will document the list of necessary changes that must be made to your code .

Python Changes

Numarray

NumPy

import numarray

import numpy

numarray.array(shape=s,type=t)

numpy.empty(shape=s,dtype=t)

numarray.abs(x)

numpy.absolute(x)

.type()

.dtype.type or .dtype or .dtype.name or ...

.rank

.ndim

.itemsize()

.itemsize

._byteorder == sys.byteorder

.dtype.byteorder == '='

NumArray

ndarray

ComplexType

complexfloating

NumericType

number

type=

dtype=

UInt16 (etc)

uint16 (etc)

Complex32

complex64 (!)

Complex64

complex128 (!)

.iscontiguous()

.flags.contiguous

.linear_algebra.inverse

.linalg.inv

.linear_algebra.generalized_inverse

.linalg.pinv

Some module functions and/or array methods have changed bahaviour

Extension module Changes

Numarray provided two separate APIs to write C extensions. One was inherently "new" (numarray specific) while the other was intended for easier transition from Numeric. (note/check: if I'm not mistaken, this second one was more feature limited)

#include "numpy/libnumarray.h" instead of #include "numarray/libnumarray.h"

backward-compatible support is available using #include "numpy/oldnumeric.h" instead of "include "numarray/libnumeric.h"

SciPy: Converting_from_numarray (last edited 2015-10-24 17:48:25 by anonymous)