Skip to content

Commit 80fd922

Browse files
committed
Converting the API to be more C like
1 parent ed01d0f commit 80fd922

10 files changed

Lines changed: 276 additions & 342 deletions

File tree

com/arrayfire/Algorithm.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,30 @@ public class Algorithm extends Array {
1616
public static double maxAll(Array a) throws Exception { return maxAll(a.ref); }
1717
public static double minAll(Array a) throws Exception { return minAll(a.ref); }
1818

19-
public static Array sum(Array a, int dim) throws Exception {
20-
Array ret_val = new Array();
21-
ret_val.ref = sum(a.ref, dim);
22-
return ret_val;
19+
public static void sum(Array res, Array a, int dim) throws Exception {
20+
long ref = sum(a.ref, dim);
21+
res.set(ref);
2322
}
2423

25-
public static Array max(Array a, int dim) throws Exception {
26-
Array ret_val = new Array();
27-
ret_val.ref = max(a.ref, dim);
28-
return ret_val;
24+
public static void max(Array res, Array a, int dim) throws Exception {
25+
long ref = max(a.ref, dim);
26+
res.set(ref);
2927
}
3028

31-
public static Array min(Array a, int dim) throws Exception {
32-
Array ret_val = new Array();
33-
ret_val.ref = min(a.ref, dim);
34-
return ret_val;
29+
public static void min(Array res, Array a, int dim) throws Exception {
30+
long ref = min(a.ref, dim);
31+
res.set(ref);
3532
}
3633

37-
public static Array sum(Array a) throws Exception {
38-
return sum(a, -1);
34+
public static void sum(Array res, Array a) throws Exception {
35+
sum(res, a, 0);
3936
}
4037

41-
public static Array max(Array a) throws Exception {
42-
return max(a, -1);
38+
public static void max(Array res, Array a) throws Exception {
39+
max(res, a, 0);
4340
}
4441

45-
public static Array min(Array a) throws Exception {
46-
return min(a, -1);
42+
public static void min(Array res, Array a) throws Exception {
43+
min(res, a, 0);
4744
}
4845
}

0 commit comments

Comments
 (0)