Giter Site home page Giter Site logo

No numpy checklist about jpype HOT 2 CLOSED

thrameos avatar thrameos commented on August 27, 2024
No numpy checklist

from jpype.

Comments (2)

Thrameos avatar Thrameos commented on August 27, 2024
  • JArray must inherit from PyJPArray
  • Remove numpy includes
  • JPArray::GetSlice will return JArray instance
  • JPArray::SetSlice must support sequence and memory view
  • PyJPArray must support memory view
  • Slice must replicate on Java call usage
  • Slice must replicate on copy ctor
  • Object arrays handle special
  • JPArray must have start, stop, step,
  • Backport PyJPArray from 0.8
  • Rework getArrayRange
  • Rework setArrayRange
  • Clone on cast
  • Slice assignment must be safe from self assignment
  • Figure out how to extract data from struct API in C++
  • Figure out how to get Python devs to respond regarding missing buffer API in the ABI
  • Incorporate type conversion table for setSlice from buffers to support numpy
  • Test getSlice against list with slices and compound slices
  • Test setSlice from buffers
  • Test getSlice to buffers

https://docs.python.org/3/c-api/typeobj.html#buffer-structs
https://docs.python.org/3/library/struct.html#module-struct

from jpype.

Thrameos avatar Thrameos commented on August 27, 2024

@marscher One big challenge on this is trying to match which rules array set slice should use. The closest equivalent I can find is

https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.astype.html

My best guess currently given the prior implementation is unsafe if sizes match otherwise no conversion as we dont appear to check the Python format codes. It only checks itemsize. This is mostly safe but does automatically turn floats to gibberish as a buggy side effect if you try to cast to int.

If I have to redo it then it needs to make some sense while not blatently replicating useless bugs. Java rules would require safe with same type (double to float) but they dont specify what to do with unsigned.
Thus i am guessing safe with same type plus automatic unsigned to signed on same size would be the most compatible to our current implementation and still not allow insane conversions (double to short)

Bool and char is also weird edge cases. The most permissive bool cases is anything that is not zero is true. That would seem like Python valid syntax, but not Java safe. Char has encoding requirements and like should not take buffer syntax at all.

Do you have any opinions on this?

from jpype.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.