[SciPy-user] convolve2d.. or Numeric to numarray conversion

Francesc Alted falted at openlc.org
Fri Feb 14 11:19:02 EST 2003


A Divendres 14 Febrer 2003 15:40, Kasper Souren va escriure:
> Is there another easy way to convert Numeric arrays to numarray arrays?
> (And the reverse would also be handy to have, but that's for later.)

I find this way specially fast as no actual data should be copied in the
process:

naarr = numarray.array(buffer(arr), type=arr.typecode(), shape=arr.shape)

that works for any Numeric object (except for typecode 'c').

And for the reverse case, this should work just fine:

arr=Numeric.array(naarr.tolist(), typecode=naarr.typecode())

although in this case, a data buffer copy is actually made.

Hope that helps,

-- 
Francesc Alted



More information about the SciPy-User mailing list