Thrameos / jpype

Thrameos personal sandbox for enhancements to jpype to send to originell.
Other
0 stars 1 forks source link

Numpy to array conversion #28

Closed desertfrog closed 3 years ago

desertfrog commented 6 years ago

Numpy arrays of are not being properly handled and converted into java arrays when passed to a constructor, resulting in a "No matching overloads found" error. Small example code and java class is below:

import numpy as np
arr = np.arange(0, 10, dtype=np.int32)
n2a = Numpy2Array(arr)
Traceback (most recent call last):

  File "<ipython-input-11-b39ee7ec0b3b>", line 1, in <module>
    n2a = Numpy2Array(arr)

  File "/Users/monterial1/anaconda3/lib/python3.6/site-packages/JPype1-0.6.3-py3.6-macosx-10.7-x86_64.egg/jpype/_jclass.py", line 111, in _javaInit
    *args)

RuntimeError: No matching overloads found for [init in find. at native/common/jp_method.cpp:127

And the java class is:

public class Numpy2Array
{

  private int[] data = null;

  public Numpy2Array(int[] data)
  {
    this.data = data;
  }

  public void PrintArray()
  {
    for (int i = 0; i < this.data.length; i++)
    {
      System.out.println(this.data[i]);
    }
  }
}
Thrameos commented 4 years ago

Is this one still an issue?