![](https://secure.gravatar.com/avatar/09ea2202a148196130137fefdbbf32c2.jpg?s=120&d=mm&r=g)
I wanted to thank all of you who helped me with my making my sparse matrix representation cross-platform in binary format! I ended up writing and reading everything explicitly in little endian. To recap, each row in the matrix is represented by three records: 1) row#, nn (number of non-zero elements) 2) col (indices of non-zero elements in row #) 3) values (doubles corresponding to indices provided in the previous array) I created the arrays using: a = array([values], '<l or d').tostring(); f.write(a) And read using: a = f.read(# of bytes, 8 for first record, nn*4 for longs, nn*8 for doubles); a = fromstring(a, '<l or d') The tofile() and fromfile() version work as well, but it wasn't any faster. So I went with what I thought was more intuitive in the context of the algorithm. So far, it has worked on the Windows, Linux, Solaris and Mac OSX boxes I have tried. I know it is hardware specific as opposed to platform, so I will continue to seek out the rarer vintages of machines that can run the software we provide. Again, thanks to all; and if there are any more suggestions as to how this process could be more optimized, please feel free to respond. Best wishes, Mark Janikas Product Engineer ESRI, Geoprocessing 380 New York St. Redlands, CA 92373 909-793-2853 (2563) mjanikas@esri.com
participants (1)
-
Mark Janikas