-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathAlgorithm.java
More file actions
63 lines (45 loc) · 1.45 KB
/
Algorithm.java
File metadata and controls
63 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.arrayfire;
class Algorithm {
// 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);
private native static long afWhere(long ref);
// 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 static Array where(final Array in) throws Exception {
return new Array(afWhere(in.ref));
}
}