| 1 |
#include "SparseMatrixExponential.h" |
| 2 |
#include <jni.h> |
| 3 |
|
| 4 |
|
| 5 |
extern "C" void dgexpvms_(long *n, long *nz, long *m, double *t, double *v, double *w, double *tol, double *anorm, long *ia, long *ja, double *a, double *wsp, long *lwsp, long *iwsp, long *liwsp, long *itrace, long *iflag); |
| 6 |
|
| 7 |
JNIEXPORT void JNICALL Java_dr_math_SparseMatrixExponential_executeDGEXPV |
| 8 |
(JNIEnv *env, jobject, jint order, jint nz, jint maxBasis, jdouble time, jdoubleArray operandVector, jdoubleArray resultVector, jdouble tolerance, jdouble matrixNorm, jdoubleArray rate, jintArray indexX, jintArray indexY, jdoubleArray workspace, jint lengthWorkspace, jintArray intWorkspace, jint lengthIntWorkspace, jint flag) { |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
// jdouble* operandVectorPtr = env->GetDoubleArrayElements(operandVector,0); |
| 14 |
// jdouble* resultVectorPtr = env->GetDoubleArrayElements(resultVector,0); |
| 15 |
// jdouble* ratePtr = env->GetDoubleArrayElements(rate,0); |
| 16 |
// jdouble* workspacePtr = env->GetDoubleArrayElements(workspace,0); |
| 17 |
// jint* indexXPtr = env->GetIntArrayElements(indexX,0); |
| 18 |
// jint* indexYPtr = env->GetIntArrayElements(indexY,0); |
| 19 |
// jint* intWorkspacePtr = env->GetIntArrayElements(intWorkspace,0); |
| 20 |
|
| 21 |
jdouble* operandVectorPtr = (jdouble*)env->GetPrimitiveArrayCritical(operandVector,0); |
| 22 |
jdouble* resultVectorPtr = (jdouble*)env->GetPrimitiveArrayCritical(resultVector,0); |
| 23 |
jdouble* ratePtr = (jdouble*)env->GetPrimitiveArrayCritical(rate,0); |
| 24 |
jdouble* workspacePtr = (jdouble*)env->GetPrimitiveArrayCritical(workspace,0); |
| 25 |
jint* indexXPtr = (jint*)env->GetPrimitiveArrayCritical(indexX,0); |
| 26 |
jint* indexYPtr = (jint*)env->GetPrimitiveArrayCritical(indexY,0); |
| 27 |
jint* intWorkspacePtr = (jint*)env->GetPrimitiveArrayCritical(intWorkspace,0); |
| 28 |
|
| 29 |
long itrace = 0; |
| 30 |
|
| 31 |
dgexpvms_(&order, &nz, &maxBasis, &time, operandVectorPtr, resultVectorPtr, |
| 32 |
&tolerance, &matrixNorm, indexXPtr, indexYPtr, ratePtr, |
| 33 |
workspacePtr, &lengthWorkspace, intWorkspacePtr, |
| 34 |
&lengthIntWorkspace, &itrace, &flag); |
| 35 |
|
| 36 |
env->ReleasePrimitiveArrayCritical(operandVector,operandVectorPtr,0); |
| 37 |
env->ReleasePrimitiveArrayCritical(resultVector,resultVectorPtr,0); |
| 38 |
env->ReleasePrimitiveArrayCritical(rate,ratePtr,0); |
| 39 |
env->ReleasePrimitiveArrayCritical(workspace,workspacePtr,0); |
| 40 |
env->ReleasePrimitiveArrayCritical(indexX,indexXPtr,0); |
| 41 |
env->ReleasePrimitiveArrayCritical(indexY,indexYPtr,0); |
| 42 |
env->ReleasePrimitiveArrayCritical(intWorkspace,intWorkspacePtr,0); |
| 43 |
|
| 44 |
// env->ReleaseDoubleArrayElements(operandVector,operandVectorPtr,0); |
| 45 |
// env->ReleaseDoubleArrayElements(resultVector,resultVectorPtr,0); |
| 46 |
// env->ReleaseDoubleArrayElements(rate,ratePtr,0); |
| 47 |
// env->ReleaseDoubleArrayElements(workspace,workspacePtr,0); |
| 48 |
// env->ReleaseIntArrayElements(indexX,indexXPtr,0); |
| 49 |
// env->ReleaseIntArrayElements(indexY,indexYPtr,0); |
| 50 |
// env->ReleaseIntArrayElements(intWorkspace,intWorkspacePtr,0); |
| 51 |
|
| 52 |
|
| 53 |
} |