[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 representational diffs?
> Maybe there's a better solution for the use case?  

Java is known to be big-endian ... but your CPU is probably little-endian.
Numpy has the tools to represent an array of double BE. 

> Use case: I get the ndarray from keras, and it represents a 2D distance
> matrix. I want to find the top-50 matches for each item, per row and
> column. I'm looking at moving the top-50 task to java for its superior
> parallel threading. (Java doesn't fork processes with a copy of the
> array, which is ~5% of memory; rather one gets 1 process with e.g. 1475%
> CPU.) 

What about numba or cython then ?

Happy new year

Jerome
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[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

--

Phobrain.com 

On 2023-01-01 05:13, Jerome Kieffer wrote:

> 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 representational diffs?
>> Maybe there's a better solution for the use case?
> 
> Java is known to be big-endian ... but your CPU is probably little-endian.
> Numpy has the tools to represent an array of double BE. 
> 
>> Use case: I get the ndarray from keras, and it represents a 2D distance
>> matrix. I want to find the top-50 matches for each item, per row and
>> column. I'm looking at moving the top-50 task to java for its superior
>> parallel threading. (Java doesn't fork processes with a copy of the
>> array, which is ~5% of memory; rather one gets 1 process with e.g. 1475%
>> CPU.)
> 
> What about numba or cython then ?
> 
> Happy new year
> 
> Jerome
> ___
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: bross_phobr...@sonic.net___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[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 ndarray method that writes an array that could be
> used this way? 

One example:

numpy.array([1,2,3], dtype=">d").tobytes()
b'?\xf0\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x08\x00\x00\x00\x00\x00\x00'

numpy.array([1,2,3], dtype="https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Documentation team meeting - Monday 2 January at 12 PM (noon) UTC

2023-01-01 Thread Mukulika Pahari
Hi all! 

Our next Documentation Team meeting will happen on *Monday, January 2* at
***12PM UTC***. We now alternate the meeting times to be a bit more
inclusive. This means that we'll have a meeting at 12pm UTC every 28 days,
and a meeting at 4pm UTC every 28 days.

All are welcome - you don't need to already be a contributor to join. If
you have questions or are curious about what we're doing, we'll be happy to
meet you!

If you wish to join on Zoom, use this (updated) link:

https://numfocus-org.zoom.us/j/85016474448?pwd=TWEvaWJ1SklyVEpwNXUrcHV1YmFJQT09

Here's the permanent hackmd document with the meeting notes (still being
updated):

https://hackmd.io/oB_boakvRqKR-_2jRV-Qjg
https://www.google.com/url?q=https%3A%2F%2Fhackmd.io%2FoB_boakvRqKR-_2jRV-Qj...

Hope to see you around!

* You can also visit https://scientific-python.org/calendars to add the
NumPy community calendar as an .ics file to your preferred calendar
manager. *

Wishing everyone a very happy new year!
- Mukulika
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com