Linux Today: Linux News On Internet Time.

More on LinuxToday

developerWorks: Numerical Python: Numeric and Numarray Packages

Nov 07, 2003, 07:00 (0 Talkback[s])
(Other stories by David Mertz)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

"The first thing to know about the Numerical Python package is that it doesn't let you do anything you cannot already do with standard Python. It does let you do many of the same things a heck of a lot faster. Actually, that's not quite all; there are a number of operations on arrays that are much more elegant to express in Numeric or Numarray than they are with standard Python data types and syntax. But mostly it is the impressive speed that draws users to Numerical Python.

"In essence, Numerical Python just gives you a new data type, the array. In contrast to lists, tuples, and dictionaries, which may contain heterogeneous elements, Numarray arrays contain only elements of a homogeneous data type. The other useful thing about Numarray arrays is that they may be multi-dimensional -- but the dimensionality of arrays is a bit different from the simple nestability of lists. Numerical Python draws on the experience of programmers--particularly those from scientific backgrounds--who have abstracted the best features of arrays in languages such as APL, FORTRAN, MATLAB, and S--and created arrays whose shape and dimensionality are easily changeable. Back to this soon.

"Operations on arrays in Numerical Python are performed elementwise. Even though two-dimensional arrays are similar to matrices from linear algebra, operations (such as multiply) have nothing to do with the operations in linear algebra (such as matrix multiplication)..."

Complete Story

Related Stories: