[SciPy-user] python (against java) advocacy for scientific projects

Sturla Molden sturla@molden...
Mon Jan 19 16:21:52 CST 2009

> 2009/1/19 Sturla Molden <sturla@molden.no>:

> And data must be copied between the JVM and the C code.

No, you can get a pointer to the raw data:

JNIEXPORT void JNICALL Java_ArrayExample_manipulateArray
(JNIEnv *env, jdoubleArray array)
   jdouble *data = (*env)->GetDoubleArrayElements(env, array, 0);
   jlen len = (*env)->GetArrayLength(env, array);
   foobar(data, &len); /* call Fortran */
   (*env)->ReleaseDoubleArrayElements(env, array, Data, 0);

But if you simulate a 2D array with an array of arrays, it will not be a
contiguous region and you possibly have to copy the data (or fake it
similary in C with a pointer of an array of pointers, cf. Numerical

Sturla Molden

More information about the SciPy-user mailing list