Skip to content
Merged
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ INCLUDE(UseJava)

ADD_SUBDIRECTORY(src)

FILE(GLOB af_java_src "com/arrayfire/*.java")

ADD_JAR(${AF_JAR} ${af_java_src})
ADD_JAR(${AF_JAR}
com/arrayfire/Algorithm.java
com/arrayfire/Arith.java
com/arrayfire/ArrayFire.java
com/arrayfire/Array.java
com/arrayfire/Data.java
com/arrayfire/DoubleComplex.java
com/arrayfire/FloatComplex.java
com/arrayfire/Image.java
com/arrayfire/Signal.java
com/arrayfire/Util.java
com/util/JNIException.java
com/arrayfire/ArrayFireException.java
)

ADD_DEPENDENCIES(${AF_JAR} ${AF_LIB})

Expand Down
96 changes: 54 additions & 42 deletions com/arrayfire/Algorithm.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,57 @@
package com.arrayfire;

public class Algorithm extends Array {

// Scalar return operations
private native static double sumAll(long a);
private native static double maxAll(long a);
private native static double minAll(long a);

private native static long sum(long a, int dim);
private native static long max(long a, int dim);
private native static long min(long a, int dim);

// Scalar return operations
public static double sumAll(Array a) throws Exception { return sumAll(a.ref); }
public static double maxAll(Array a) throws Exception { return maxAll(a.ref); }
public static double minAll(Array a) throws Exception { return minAll(a.ref); }

public static void sum(Array res, Array a, int dim) throws Exception {
long ref = sum(a.ref, dim);
res.set(ref);
}

public static void max(Array res, Array a, int dim) throws Exception {
long ref = max(a.ref, dim);
res.set(ref);
}

public static void min(Array res, Array a, int dim) throws Exception {
long ref = min(a.ref, dim);
res.set(ref);
}

public static void sum(Array res, Array a) throws Exception {
sum(res, a, 0);
}

public static void max(Array res, Array a) throws Exception {
max(res, a, 0);
}

public static void min(Array res, Array a) throws Exception {
min(res, a, 0);
}
public class Algorithm extends ArrayFire {

// Scalar return operations
private native static double sumAll(long a);

private native static double maxAll(long a);

private native static double minAll(long a);

private native static long sum(long a, int dim);

private native static long max(long a, int dim);

private native static long min(long a, int dim);

// Scalar return operations
public static double sumAll(Array a) throws Exception {
return sumAll(a.ref);
}

public static double maxAll(Array a) throws Exception {
return maxAll(a.ref);
}

public static double minAll(Array a) throws Exception {
return minAll(a.ref);
}

public static void sum(Array res, Array a, int dim) throws Exception {
long ref = sum(a.ref, dim);
res.set(ref);
}

public static void max(Array res, Array a, int dim) throws Exception {
long ref = max(a.ref, dim);
res.set(ref);
}

public static void min(Array res, Array a, int dim) throws Exception {
long ref = min(a.ref, dim);
res.set(ref);
}

public static void sum(Array res, Array a) throws Exception {
sum(res, a, 0);
}

public static void max(Array res, Array a) throws Exception {
max(res, a, 0);
}

public static void min(Array res, Array a) throws Exception {
min(res, a, 0);
}
}
Loading