[Numpy-discussion] Re: 1D ndarray to java double[]

2023-03-20 Thread Bill Ross
Getting back to this, byteswap() looks like a general endian solution for ndarrays: https://stackoverflow.com/questions/49578507/fast-way-to-reverse-float32-endianness-in-binary-file The examples there specify float32 format for opening a file, but that seemed to scramble the header that was o

[Numpy-discussion] Re: 1D ndarray to java double[]

2023-03-19 Thread Bill Ross
byteswap() looks like a general endian solution for ndarrays: https://stackoverflow.com/questions/49578507/fast-way-to-reverse-float32-endianness-in-binary-file numpy.memmap(infile, dtype=numpy.int32).byteswap().tofile(outfile) numpy.memmap(infile, dtype=numpy.int32).byteswap(inplace=True).flus

[Numpy-discussion] Re: 1D ndarray to java double[]

2023-01-01 Thread Jerome Kieffer
On Sun, 01 Jan 2023 05:31:55 -0800 Bill Ross wrote: > Thanks! > > > Java is known to be big-endian ... your CPU is probably little-endian. > > $ lscpu | grep -i endian > Byte Order: Little Endian > > > Numpy has the tools to represent an array of double BE. > > Is there a lower-level

[Numpy-discussion] Re: 1D ndarray to java double[]

2023-01-01 Thread Bill Ross
Thanks! > Java is known to be big-endian ... your CPU is probably little-endian. $ lscpu | grep -i endian Byte Order: Little Endian > Numpy has the tools to represent an array of double BE. Is there a lower-level ndarray method that writes an array that could be used this way? Bill -- P

[Numpy-discussion] Re: 1D ndarray to java double[]

2023-01-01 Thread Jerome Kieffer
On Sat, 31 Dec 2022 23:45:54 -0800 Bill Ross wrote: > How best to write a 1D ndarray as a block of doubles, for reading in > java as double[] or a stream of double? > > Maybe the performance of simple looping over doubles in python.write() > and java.read() is fine, but maybe there are represen