Skip to content

Commit b65f7a3

Browse files
ShadyBoukharyumar456
authored andcommitted
Added wrapper for af_where in Algorithm
1 parent 17ca994 commit b65f7a3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

com/arrayfire/Algorithm.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class Algorithm {
1515

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

18+
private native static long afWhere(long ref);
19+
1820
// Scalar return operations
1921
public static double sumAll(Array a) throws Exception {
2022
return sumAll(a.ref);
@@ -54,4 +56,8 @@ public static void max(Array res, Array a) throws Exception {
5456
public static void min(Array res, Array a) throws Exception {
5557
min(res, a, 0);
5658
}
59+
60+
public static Array where(final Array in) throws Exception {
61+
return new Array(afWhere(in.ref));
62+
}
5763
}

src/algorithm.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ ARRAY_RET_OP_DEF(sum)
2828
ARRAY_RET_OP_DEF(max)
2929
ARRAY_RET_OP_DEF(min)
3030

31+
JNIEXPORT jlong JNICALL ALGO_FUNC(afWhere)(JNIEnv *env, jclass clazz, jlong arr) {
32+
af_array ret = 0;
33+
AF_CHECK(af_where(&ret, ARRAY(arr)));
34+
return JLONG(ret);
35+
}
36+
3137
END_EXTERN_C

0 commit comments

Comments
 (0)