Interactive intelligence

I would like to use Clojure Incanter, but I would like to mix extensive Numpy / Scipy Python number libraries in calls. Is there a compatible bridge between Incanter and Numpy that allows you to run CPython's built-in runtime environment from Clojure and which transforms the matrix data structures of Numpy and Incanter?

Jython is not enough since Numpy requires CPython.

I know (but never used) http://jepp.sourceforge.net/ that allows Java programs to manage the CPython embedded runtime - but Numpy / Matrix incubator interconversion is still needed.

I'm looking for something similar to https://github.com/jolby/rincanter (which I haven't used yet), but for CPython / Numpy instead of R.

+4
source share
1 answer

There is no finished bridge with countless numbers . You must write your own.

One way is to use JNI accordingly. Jepp and, as you said, convert raw ndarray bytes into what the Java Colt library can use (and vice versa, incanter builds on Colt). In addition, you have all the features that interest you.

Another way would be to serialize ndarrays and send them between CPython and Jython (e.g. with Pyro, which works with CPython and Jython: http://packages.python.org/Pyro4/alternative.html#jython ). Again you have to translate the raw bytes into something "Incanter resp. Numpy can understand, but you can use Python code on the Java side without having to wrap each individual function in numpy / scipy using JNI.

+1
source

Source: https://habr.com/ru/post/1386401/


All Articles