From: Francesc A. <fa...@op...> - 2003-01-20 12:16:25
|
A Dissabte 18 Gener 2003 21:12, Todd Miller va escriure: > >By the way, is it safe to assume that CharArray objects are contiguous= ? or > >RawCharArray?. > > Mostly no. Each fixed length element is stored as a contiguous > sequence of bytes. Anything goes for the rest, so you need to look at > the strides arrays and byteoffset. > > >The same question goes for RecArray objects. > > No. It's possible to select every 10th record, for instance, in a > slice. I believe the resulting decimated array would be a discontiguou= s > view of the original. > > >Or it is always > >convenient to check with iscontiguous() method if they are or not?. > > I'm not even certain the method works correctly for chararray and > recarray. Well, during my tests with numarray 0.4, iscontiguous() seems to work wel= l, both for chararrays and recarrays. > In both cases, I think I'd just forget about > contiguity and use the strides arrays. Yeah, but I still want to use iscontiguous() method just to speed-up a bi= t the code. > You might argue that records contain > byteswapped and misaligned fields. I don't have an immediate answer t= o > that. Exactly, I am pondering how to deal with HDF5 objects coming from machine= s with a different endianess (misalignment is not a problem in my case) tha= n the local machine. But I think I can manage that by creating recarrays buffers with the byteorder parameter set appropriately during the HDF5 ta= ble reads. Then, all the data can be read correctly because numarray will byteswap the data whenever this recarray will be accessed. Moreover, if this object is to be used frequently, I can speed-up the acc= ess to this recarray by byteswapping the columns (as arrays) using their byteswap() method. In the future it would be nice to provide a generica byteswap method for recarrays. Thanks, --=20 Francesc Alted |