[Pyrex] Numeric and Pyrex

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 20 05:01:27 CEST 2005


Nitin Madnani wrote:

> So my question is that now that I have an Numeric array that I have  
> created, how do I access its C internals since 'm' is now a python  
> object right? Things like 'm.data' etc. don't seem to work.

You need to declare the variable holding the reference
to the array as being of type ArrayType, e.g.

   def estimate_future_costs(phrase_dict, sent):
     ...
     cdef ArrayType m
     m = Numeric.zeros((3, 3), Numeric.Float)
     # can now access m.data etc.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list