arrays

Robert Kern rkern at ucsd.edu
Wed Nov 17 05:46:18 EST 2004


Rahul Garg wrote:
> Hi.
> Thanks for the help. Its really simple and i shud have thought it
> myself.
> Some clarifications :
> 1. I will mostly be storing floating point numbers in 2 dimensional
> arrays which i will pass to a custom module written in C. The
> application is for scientific computing purposes.I just need python +
> wxPython for the GUI.
> 
> 2.I am not using Numarray because i dont expect to do many operations
> on the matrices in Python itself. Most of that stuff will be handled
> in my C module.
> The decision of not doing the matrix operations in Python is because
> most of the C code is already ready. Though it is written as
> standalone command line app currently , converting it into an
> extension module shudnt be much of a problem.

You still might want to use numarray or Numeric in this case. The memory 
representation of a numarray/Numeric array is the same as in C. You 
won't have to duplicate memory and waste time converting between a 
memory block of doubles and lists of lists of Python floats. Speaking 
from experience, I would say that numarray/Numeric greatly eases the 
burden of communicating arrays between Python and C even if one does not 
need to do anything complicated with the arrays in Python.

-- 
Robert Kern
rkern at ucsd.edu

"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