Skip to content

Commit

Permalink
Fixes for java typemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Aug 26, 2011
1 parent 9c4972b commit 911732f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/interfaces/java_modular/swig_typemaps.i
Expand Up @@ -138,6 +138,7 @@ import org.ujmp.core.booleanmatrix.impl.DefaultDenseBooleanMatrix2D;
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, jarr, 0, cols, arr);

res = JCALL5(NewObject, jenv, cls, mid, rows, cols, jarr);
SG_FREE(arr);
$result = (jobject)res;
}

Expand Down Expand Up @@ -272,6 +273,8 @@ TYPEMAP_SGVECTOR(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, jarr, 0, cols, arr);

res = JCALL5(NewObject, jenv, cls, mid, jarr, rows, cols);

SG_FREE(arr);
$result = (jobject)res;
}

Expand Down Expand Up @@ -386,6 +389,7 @@ TYPEMAP_SGVECTOR(float64_t, double, Double, jdouble, "toDoubleArray", "()[[D", "
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, jarr, 0, len, arr);

res = JCALL5(NewObject, jenv, cls, mid, rows, cols, jarr);
SG_FREE(arr);
$result = (jobject)res;
}

Expand Down Expand Up @@ -468,7 +472,7 @@ TYPEMAP_SGMATRIX(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa
}
JCALL3(Release##JAVATYPE##ArrayElements, jenv, jarr, carr, 0);
}

$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols);
}

Expand All @@ -477,7 +481,7 @@ TYPEMAP_SGMATRIX(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa
int32_t rows = $1.num_rows;
int32_t cols = $1.num_cols;
int32_t len = rows * cols;
JNITYPE* arr = SG_MALLOC(float64_t,len);
JNITYPE* arr = SG_MALLOC(JNITYPE,len);
jobject res;
int32_t i;

Expand All @@ -502,6 +506,7 @@ TYPEMAP_SGMATRIX(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, jarr, 0, len, arr);

res = JCALL5(NewObject, jenv, cls, mid, jarr, rows, cols);
SG_FREE(arr);
$result = (jobject)res;
}

Expand Down

0 comments on commit 911732f

Please sign in to comment.