From 887d9eeafc8cfdf453f4ea6a29b3f26c23033d90 Mon Sep 17 00:00:00 2001 From: Baozeng Ding Date: Tue, 28 Jun 2011 20:01:04 +0800 Subject: [PATCH 1/3] support ujmp types other than float/double --- src/java_modular/swig_typemaps.i | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/java_modular/swig_typemaps.i b/src/java_modular/swig_typemaps.i index fae915c6cd9..e62383c44ed 100644 --- a/src/java_modular/swig_typemaps.i +++ b/src/java_modular/swig_typemaps.i @@ -344,7 +344,16 @@ TYPEMAP_SGMATRIX(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa %enddef /*Define concrete examples of the TYPEMAP_SGMATRIX macros */ - +TYPEMAP_SGMATRIX(bool, boolean, Boolean, jboolean, "toBooleanArray", "()[[Z", "org/ujmp/core/booleanmatrix/impl/DefaultDenseBooleanMatrix2D", "([BII)V") +TYPEMAP_SGMATRIX(char, byte, Byte, jbyte, "toByteArray", "()[[B", "org/ujmp/core/bytematrix/impl/DefaultDenseByteMatrix2D", "([BII)V") +TYPEMAP_SGMATRIX(uint8_t, byte, Byte, jbyte, "toByteArray", "()[[B", "org/ujmp/core/bytematrix/impl/DefaultDenseByteMatrix2D", "([BII)V") +TYPEMAP_SGMATRIX(int16_t, short, Short, jshort, "toShortArray", "()[[S", "org/ujmp/core/shortmatrix/impl/DefaultDenseShortMatrix2D", "([SII)V") +TYPEMAP_SGMATRIX(uint16_t, int, Int, jint, "toIntArray", "()[[I", "org/ujmp/core/intmatrix/impl/DefaultDenseIntMatrix2D", "([III)V") +TYPEMAP_SGMATRIX(int32_t, int, Int, jint, "toIntArray", "()[[I", "org/ujmp/core/intmatrix/impl/DefaultDenseIntMatrix2D", "([III)V") +TYPEMAP_SGMATRIX(uint32_t, long, Long, jlong, "toLongArray", "()[[J", "org/ujmp/core/longmatrix/impl/DefaultDenseLongMatrix2D", "([JII)V") +TYPEMAP_SGMATRIX(int64_t, int, Int, jint, "toIntArray", "()[[I", "org/ujmp/core/intmatrix/impl/DefaultDenseIntMatrix2D", "([III)V") +TYPEMAP_SGMATRIX(uint64_t, long, Long, jlong, "toLongArray", "()[[J", "org/ujmp/core/longmatrix/impl/DefaultDenseLongMatrix2D", "([JII)V") +TYPEMAP_SGMATRIX(long long, long, Long, jlong, "toLongArray", "()[[J", "org/ujmp/core/longmatrix/impl/DefaultDenseLongMatrix2D", "([JII)V") TYPEMAP_SGMATRIX(float32_t, float, Float, jfloat, "toFloatArray", "()[[F", "org/ujmp/core/floatmatrix/impl/DefaultDenseFloatMatrix2D", "([FII)V") TYPEMAP_SGMATRIX(float64_t, double, Double, jdouble, "toDoubleArray", "()[[D", "org/ujmp/core/doublematrix/impl/DefaultDenseDoubleMatrix2D", "([DII)V") From 9baa20324a2a458368b200568d8025f1424febc2 Mon Sep 17 00:00:00 2001 From: Baozeng Ding Date: Tue, 28 Jun 2011 20:25:37 +0800 Subject: [PATCH 2/3] add package import --- src/java_modular/swig_typemaps.i | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/java_modular/swig_typemaps.i b/src/java_modular/swig_typemaps.i index e62383c44ed..940c08bd72a 100644 --- a/src/java_modular/swig_typemaps.i +++ b/src/java_modular/swig_typemaps.i @@ -8,7 +8,7 @@ * */ -#ifdef HAVE_JBLAS +#ifndef HAVE_JBLAS %pragma(java) jniclassimports=%{ import org.jblas.*; %} @@ -21,16 +21,26 @@ import org.jblas.*; import org.ujmp.core.*; import org.ujmp.core.doublematrix.impl.DefaultDenseDoubleMatrix2D; import org.ujmp.core.floatmatrix.impl.DefaultDenseFloatMatrix2D; +import org.ujmp.core.intmatrix.impl.DefaultDenseIntMatrix2D; +import org.ujmp.core.longmatrix.impl.DefaultDenseLongMatrix2D; +import org.ujmp.core.shortmatrix.impl.DefaultDenseShortMatrix2D; +import org.ujmp.core.bytematrix.impl.DefaultDenseByteMatrix2D; +import org.ujmp.core.booleanmatrix.impl.DefaultDenseBooleanMatrix2D; %} %typemap(javaimports) SWIGTYPE%{ import org.ujmp.core.*; import org.ujmp.core.doublematrix.impl.DefaultDenseDoubleMatrix2D; import org.ujmp.core.floatmatrix.impl.DefaultDenseFloatMatrix2D; +import org.ujmp.core.intmatrix.impl.DefaultDenseIntMatrix2D; +import org.ujmp.core.longmatrix.impl.DefaultDenseLongMatrix2D; +import org.ujmp.core.shortmatrix.impl.DefaultDenseShortMatrix2D; +import org.ujmp.core.bytematrix.impl.DefaultDenseByteMatrix2D; +import org.ujmp.core.booleanmatrix.impl.DefaultDenseBooleanMatrix2D; %} #endif #endif /* One dimensional input/output arrays */ -#ifdef HAVE_JBLAS +#ifndef HAVE_JBLAS /* Two dimensional input/output arrays */ %define TYPEMAP_SGVECTOR(SGTYPE, JTYPE, JAVATYPE, JNITYPE, TOARRAY, CLASSDESC, CONSTRUCTOR) @@ -142,7 +152,7 @@ TYPEMAP_SGVECTOR(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa #undef TYPEMAP_SGVECTOR #endif -#ifdef HAVE_JBLAS +#ifndef HAVE_JBLAS /* Two dimensional input/output arrays */ %define TYPEMAP_SGMATRIX(SGTYPE, JTYPE, JAVATYPE, JNITYPE, TOARRAY, CLASSDESC, CONSTRUCTOR) From d561923de43d828664fc07652ed773f62bdbf909 Mon Sep 17 00:00:00 2001 From: Baozeng Ding Date: Tue, 28 Jun 2011 20:29:55 +0800 Subject: [PATCH 3/3] add package import --- src/java_modular/swig_typemaps.i | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java_modular/swig_typemaps.i b/src/java_modular/swig_typemaps.i index 940c08bd72a..8e07f4bd585 100644 --- a/src/java_modular/swig_typemaps.i +++ b/src/java_modular/swig_typemaps.i @@ -8,7 +8,7 @@ * */ -#ifndef HAVE_JBLAS +#ifdef HAVE_JBLAS %pragma(java) jniclassimports=%{ import org.jblas.*; %} @@ -40,7 +40,7 @@ import org.ujmp.core.booleanmatrix.impl.DefaultDenseBooleanMatrix2D; #endif #endif /* One dimensional input/output arrays */ -#ifndef HAVE_JBLAS +#ifdef HAVE_JBLAS /* Two dimensional input/output arrays */ %define TYPEMAP_SGVECTOR(SGTYPE, JTYPE, JAVATYPE, JNITYPE, TOARRAY, CLASSDESC, CONSTRUCTOR) @@ -152,7 +152,7 @@ TYPEMAP_SGVECTOR(float64_t, double, Double, jdouble, "()[D", "org/jblas/DoubleMa #undef TYPEMAP_SGVECTOR #endif -#ifndef HAVE_JBLAS +#ifdef HAVE_JBLAS /* Two dimensional input/output arrays */ %define TYPEMAP_SGMATRIX(SGTYPE, JTYPE, JAVATYPE, JNITYPE, TOARRAY, CLASSDESC, CONSTRUCTOR)