-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathArrayFire.java
More file actions
1657 lines (1496 loc) · 48.6 KB
/
ArrayFire.java
File metadata and controls
1657 lines (1496 loc) · 48.6 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package com.arrayfire;
import com.arrayfire.Index;
public class ArrayFire extends AFLibLoader {
public static final Seq SPAN = Seq.span();
/* ************* Algorithm ************* */
/**
* Sum all the elements in an Array, wraps
* {@link http://arrayfire.org/docs/group__reduce__func__sum.htm }
*
* @param a the array to be summed
* @return the sum
* @throws Exception
* @see Array
*/
public static double sumAll(Array a) throws Exception {
return Algorithm.sumAll(a);
}
/**
* Finds the maximum value in an array, wraps
* {@link http://arrayfire.org/docs/group__reduce__func__max.htm}
*
* @param a the input array
* @return the maximum value
* @throws Exception
* @see Array
*/
public static double maxAll(Array a) throws Exception {
return Algorithm.maxAll(a);
}
/**
* Finds the minimum value in an array, wraps
* {@link http://arrayfire.org/docs/group__reduce__func__min.htm}.
*
* @param a the input array
* @return the minimum value
* @throws Exception
* @see Array
*/
public static double minAll(Array a) throws Exception {
return Algorithm.minAll(a);
}
/**
* Finds the sum of an array across 1 dimension and stores the result in a 2nd array.
*
* @param res the array in which to store the result
* @param a the input array
* @param dim the dimension across which to find the sum
* @throws Exception
* @see Array
*/
public static void sum(Array res, Array a, int dim) throws Exception {
Algorithm.sum(res, a, dim);
}
/**
* Finds the maximum values of an array across 1 dimension and stores the result in a 2nd array.
*
* @param res the array in which to store the result.
* @param a the input array
* @param dim the dimenstion across which to find the maximum values
* @throws Exception
* @see Array
*/
public static void max(Array res, Array a, int dim) throws Exception {
Algorithm.max(res, a, dim);
}
/**
* Finds the minimum values in an array across 1 dimenstion and stores the result in a 2nd array.
*
* @param res the array in which to store the result
* @param a the input array
* @param dim the dimension across which to find the maximum values
* @throws Exception
* @see Array
*/
public static void min(Array res, Array a, int dim) throws Exception {
Algorithm.min(res, a, dim);
}
/**
* Finds the sum of values in an array across all dimenstion and stores the result in a 2nd array.
*
* @param res the array in which to store the result
* @param a the input array
* @throws Exception
* @see Array
*/
public static void sum(Array res, Array a) throws Exception {
Algorithm.sum(res, a);
}
/**
* Finds the max values in an array across all dimenstion and stores the result in a 2nd array.
*
* @param res the array in which to store the result
* @param a the input array
* @throws Exception
* @see Array
*/
public static void max(Array res, Array a) throws Exception {
Algorithm.max(res, a);
}
/**
* Finds the minimum values in an array across all dimenstion and stores the result in a 2nd
* array.
*
* @param res the array in which to store the result
* @param a the input array
* @throws Exception
* @see Array
*/
public static void min(Array res, Array a) throws Exception {
Algorithm.min(res, a, 0);
}
/**
* Finds the indices of all non-zero values in an input array, wraps
* {@link http://arrayfire.org/docs/group__scan__func__where.htm}
*
* @param in the input array
* @return an array containing the indices of all non-zero values in the input array
* @throws Exception
*/
public static Array where(final Array in) throws Exception {
return Algorithm.where(in);
}
/* ************* Arith ************* */
/**
* Performs element-wise addition between 2 arrays and stores the result in another array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__add.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void add(Array c, Array a, Array b) throws Exception {
Arith.add(c, a, b);
}
/**
* Subtracts 2 arrays, storing the result in another array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__sub.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void sub(Array c, Array a, Array b) throws Exception {
Arith.sub(c, a, b);
}
/**
* Performs element-wise multiplication between 2 arrays, wraps
* {@link http://arrayfire.org/docs/group__arith__func__mul.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void mul(Array c, Array a, Array b) throws Exception {
Arith.mul(c, a, b);
}
/**
* Divides one array by another array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__div.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void div(Array c, Array a, Array b) throws Exception {
Arith.div(c, a, b);
}
/**
* Checks if an array is less than or equal to another, wraps
* {@link http://arrayfire.org/docs/group__arith__func__le.htm}.
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void le(Array c, Array a, Array b) throws Exception {
Arith.le(c, a, b);
}
/**
* Checks if an array is less than another, wraps
* {@link http://arrayfire.org/docs/group__arith__func__lt.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void lt(Array c, Array a, Array b) throws Exception {
Arith.lt(c, a, b);
}
/**
* Checks if an array is greater than or equal to another, wraps
* {@link http://arrayfire.org/docs/group__arith__func__ge.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void ge(Array c, Array a, Array b) throws Exception {
Arith.ge(c, a, b);
}
/**
* Checks if an array is greater than another, wraps
* {@link http://arrayfire.org/docs/group__arith__func__gt.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void gt(Array c, Array a, Array b) throws Exception {
Arith.gt(c, a, b);
}
/**
* Checks if 2 input arrays are equal, wraps
* {@link http://arrayfire.org/docs/group__arith__func__eq.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void eq(Array c, Array a, Array b) throws Exception {
Arith.eq(c, a, b);
}
/**
* Checks if 2 input arrays are not equal, wraps
* {@link http://arrayfire.org/docs/group__arith__func__neq.htm}
*
* @param c the resulting array
* @param a the lhs array
* @param b the rhs array
* @throws Exception
*/
public static void neq(Array c, Array a, Array b) throws Exception {
Arith.neq(c, a, b);
}
// Unary operations
/**
* Finds the sin of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__sin.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void sin(Array res, Array a) throws Exception {
Arith.sin(res, a);
}
/**
* Finds the cosine of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__cos.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void cos(Array res, Array a) throws Exception {
Arith.cos(res, a);
}
/**
* Finds the tan of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__tan.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void tan(Array res, Array a) throws Exception {
Arith.tan(res, a);
}
/**
* Finds the asin of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__asin.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void asin(Array res, Array a) throws Exception {
Arith.asin(res, a);
}
/**
* Finds the acos of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__acos.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void acos(Array res, Array a) throws Exception {
Arith.acos(res, a);
}
/**
* Finds the atan of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__atan.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void atan(Array res, Array a) throws Exception {
Arith.atan(res, a);
}
/**
* Finds the sinh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__sinh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void sinh(Array res, Array a) throws Exception {
Arith.sinh(res, a);
}
/**
* Finds the cosh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__cosh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void cosh(Array res, Array a) throws Exception {
Arith.cosh(res, a);
}
/**
* Finds the tanh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__tanh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void tanh(Array res, Array a) throws Exception {
Arith.tanh(res, a);
}
/**
* Finds the asinh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__asinh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void asinh(Array res, Array a) throws Exception {
Arith.asinh(res, a);
}
/**
* Finds the acosh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__acosh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void acosh(Array res, Array a) throws Exception {
Arith.acosh(res, a);
}
/**
* Finds the atanh of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__atanh.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void atanh(Array res, Array a) throws Exception {
Arith.atanh(res, a);
}
/**
* Finds the exponential of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__exp.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void exp(Array res, Array a) throws Exception {
Arith.exp(res, a);
}
/**
* Finds the log of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__log.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void log(Array res, Array a) throws Exception {
Arith.log(res, a);
}
/**
* Finds the absolute value of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__abs.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void abs(Array res, Array a) throws Exception {
Arith.abs(res, a);
}
/**
* Finds the square root of the elements in an array, wraps
* {@link http://arrayfire.org/docs/group__arith__func__sqrt.htm}
*
* @param res the resulting array
* @param a the input array
* @throws Exception
*/
public static void sqrt(Array res, Array a) throws Exception {
Arith.sqrt(res, a);
}
// Scalar operations
/**
* Adds a broadcasted value to an array.
*
* @param c the resulting array
* @param a the input array
* @param b the value to broadcast
* @throws Exception
*/
public static void add(Array c, Array a, float b) throws Exception {
Arith.add(c, a, b);
}
/**
* Subtracts a broadcasted value from an array.
*
* @param c the resulting array
* @param a the input array
* @param b the value to broadcast
* @throws Exception
*/
public static void sub(Array c, Array a, float b) throws Exception {
Arith.sub(c, a, b);
}
/**
* Performs element-wise multiplication between an array and a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value to broadcast
* @throws Exception
*/
public static void mul(Array c, Array a, float b) throws Exception {
Arith.mul(c, a, b);
}
/**
* Divides an array by a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value to broadcast
* @throws Exception
*/
public static void div(Array c, Array a, float b) throws Exception {
Arith.div(c, a, b);
}
/**
* Finds if an array is less than or equal to a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void le(Array c, Array a, float b) throws Exception {
Arith.le(c, a, b);
}
/**
* Finds if an array is less a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void lt(Array c, Array a, float b) throws Exception {
Arith.lt(c, a, b);
}
/**
* Finds if an array is greater than or equal to a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void ge(Array c, Array a, float b) throws Exception {
Arith.ge(c, a, b);
}
/**
* Finds if an array is greater a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void gt(Array c, Array a, float b) throws Exception {
Arith.gt(c, a, b);
}
/**
* Finds if an array is equal to a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void eq(Array c, Array a, float b) throws Exception {
Arith.eq(c, a, b);
}
/**
* Finds if an array is not equal to a broadcasted value.
*
* @param c the resulting array
* @param a the input array
* @param b the value
* @throws Exception
*/
public static void neq(Array c, Array a, float b) throws Exception {
Arith.neq(c, a, b);
}
/**
* Raises an array to a power.
*
* @param c the resulting array
* @param a the input array
* @param b the power to raise the array to
* @throws Exception
*/
public static void pow(Array c, Array a, float b) throws Exception {
Arith.pow(c, a, b);
}
/**
* Adds an array to a broadcasted value.
*
* @param c the resulting array
* @param a the value to which the array is added
* @param b the input array
* @throws Exception
*/
public static void add(Array c, float a, Array b) throws Exception {
Arith.add(c, a, b);
}
/**
* Subtracts an array from a broadcasted value.
*
* @param c the resulting array
* @param a the value from which the array is subtracted
* @param b the input array
* @throws Exception
*/
public static void sub(Array c, float a, Array b) throws Exception {
Arith.sub(c, a, b);
}
/**
* Performs element-wise multiplication between a broadcasted value and an array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void mul(Array c, float a, Array b) throws Exception {
Arith.mul(c, a, b);
}
/**
* Divides an array of a broadcasted value by an another array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void div(Array c, float a, Array b) throws Exception {
Arith.div(c, a, b);
}
/**
* Finds if a value is less than or equal to the values in an array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void le(Array c, float a, Array b) throws Exception {
Arith.le(c, a, b);
}
/**
* Finds if a value is less than to the values in an array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void lt(Array c, float a, Array b) throws Exception {
Arith.lt(c, a, b);
}
/**
* Finds if a value is greater than or equal to the values in an array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void ge(Array c, float a, Array b) throws Exception {
Arith.ge(c, a, b);
}
/**
* Finds if a value is greater than the values in an array
*
* @param c the resulting array
* @param a the input value
* @param b the input array
* @throws Exception
*/
public static void gt(Array c, float a, Array b) throws Exception {
Arith.gt(c, a, b);
}
/* ************* Data ************* */
/**
* Gets a floating-point array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static float[] getFloatArray(Array A) throws Exception {
return Data.getFloatArray(A);
}
/**
* Gets a full precision floating-point array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static double[] getDoubleArray(Array A) throws Exception {
return Data.getDoubleArray(A);
}
/**
* Gets a FloatComplex array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static FloatComplex[] getFloatComplexArray(Array A) throws Exception {
return Data.getFloatComplexArray(A);
}
/**
* Gets a DoubleComplex array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static DoubleComplex[] getDoubleComplexArray(Array A) throws Exception {
return Data.getDoubleComplexArray(A);
}
/**
* Gets an int array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static int[] getIntArray(Array A) throws Exception {
return Data.getIntArray(A);
}
/**
* Gets a boolean array from the underlining Array data.
*
* @param A the input array
* @return a java array containng the input's data
* @throws Exception
*/
public static boolean[] getBooleanArray(Array A) throws Exception {
return Data.getBooleanArray(A);
}
// Binary operations
/**
* Create a random array sampled from uniform distribution, wraps
* {@link http://arrayfire.org/docs/group__random__func__randu.htm}
*
* @param res the resulting array to populate
* @param dims the array dimenstions
* @param type the type of the array
* @throws Exception
*/
public static void randu(Array res, int[] dims, Type type) throws Exception {
Data.randu(res, dims, type);
}
/**
* Create a random array sampled from normal distribution, wraps
* {@link http://arrayfire.org/docs/group__random__func__randn.htm}
*
* @param res the resulting array to populate
* @param dims the array dimenstions
* @param type the type of the array
* @throws Exception
*/
public static void randn(Array res, int[] dims, Type type) throws Exception {
Data.randn(res, dims, type);
}
/**
* Create an array using a scalar input value, wraps
* {@link http://arrayfire.org/docs/group__data__func__constant.htm}
*
* @param res the resulting array to populate
* @param val the scalar value used to populate the array
* @param dims the array dimenstions
* @param type the type of the array
* @throws Exception
*/
public static void constant(Array res, double val, int[] dims, Type type) throws Exception {
Data.constant(res, val, dims, type);
}
/**
* Create an identity array, wraps
* {@link http://arrayfire.org/docs/group__data__func__identity.htm}
*
* @param res the resulting array to populate
* @param dims the array dimenstions
* @param type the type of the array
* @throws Exception
*/
public static void identity(Array res, int[] dims, Type type) throws Exception {
Data.identity(res, dims, type);
}
/**
* Create a floating-point identity array, wraps
* {@link http://arrayfire.org/docs/group__data__func__identity.htm}
*
* @param res the resulting array to populate
* @param dims the array dimenstions
* @throws Exception
*/
public static void identity(Array res, int[] dims) throws Exception {
Data.identity(res, dims);
}
/**
* Creates an array with [0, n] values along the seqDim which is tiled across other dimensions.
* {@link http://arrayfire.org/docs/group__data__func__range.htm}
*
* @param dims the array dimensions
* @param seqDim the dimension along which [0, dim[seq_dim] - 1] is generated
* @param type the type of the array
* @return the created array
*/
public static Array range(int[] dims, int seqDim, Type type) {
return Data.range(dims, seqDim, type);
}
/**
* Creates an array with [0, n] floating-point values along the seqDim which is tiled across other
* dimensions. {@link http://arrayfire.org/docs/group__data__func__range.htm}
*
* @param dims the array dimensions
* @param seqDim the dimension along which [0, dim[seq_dim] - 1] is generated
* @return the created array
*/
public static Array range(int[] dims, int seqDim) {
return Data.range(dims, seqDim, Type.Float);
}
/**
* Creates an array with [0, n] floating-point values along the seqDim which is tiled across other
* dimensions. {@link http://arrayfire.org/docs/group__data__func__range.htm}
*
* @param dims the array dimensions
* @param seqDim the dimension along which [0, dim[seq_dim] - 1] is generated
* @return the created array
*/
public static Array range(int[] dims) {
return Data.range(dims, -1, Type.Float);
}
/**
* Creates an array with [0, n] floating-point values along the seqDim which is tiled across other
* dimensions. {@link http://arrayfire.org/docs/group__data__func__range.htm}
*
* @param dim the size of the first dimension
* @param seqDim the dimension along which [0, dim[seq_dim] - 1] is generated
* @return the created array
*/
public static Array range(int dim) {
return Data.range(new int[] {dim}, -1, Type.Float);
}
/* ************* Image ************* */
/**
* Perform erosion (a morphological operation) on an image,
* {@link http://arrayfire.org/docs/group__image__func__erode.htm}
*
* @param res the eroded image
* @param a the input image
* @param b the neighborhood window
* @throws Exception
*/
public static void erode(Array res, Array a, Array b) throws Exception {
Image.erode(res, a, b);
}
/**
* Perform dilation (a morphological operation) on an image,
* {@link http://arrayfire.org/docs/group__image__func__dilate.htm}
*
* @param res the dilated image
* @param a the input image
* @param b the neighborhood window
* @throws Exception
*/
public static void dilate(Array res, Array a, Array b) throws Exception {
Image.dilate(res, a, b);
}
/**
* Finds the median filter of an image, wraps
* {@link http://arrayfire.org/docs/group__image__func__medfilt.htm}
*
* @param res the processed image
* @param a the input image
* @param width the kernel width
* @param height the kernel height
* @throws Exception
*/
public static void medianfilter(Array res, Array a, int width, int height) throws Exception {
Image.medianfilter(res, a, width, height);
}
/**
* Applies a bilateral filter to an image, wraps
* {@link http://arrayfire.org/docs/group__image__func__bilateral.htm}
*
* @param res the processed image
* @param a the input image
* @param space the spacial variance parameter
* @param color the chromatic variance parameter
* @throws Exception
*/
public static void bilateral(Array res, Array a, float space, float color) throws Exception {
Image.bilateral(res, a, space, color);
}
/**
* Applies a meanshift filter to an image, wraps
* {@link http://arrayfire.org/docs/group__image__func__mean__shift.htm}
*
* @param res the processed image
* @param a the input image
* @param space the spacial variance parameter
* @param color the chromatic variance parameter
* @param interations the number of iterations
* @throws Exception
*/
public static void meanshift(Array res, Array a, float space, float color, int iterations)
throws Exception {
Image.meanshift(res, a, space, color, iterations);
}
/**
* Create a histogram of some give data, wraps
* {@link http://arrayfire.org/docs/group__image__func__histogram.htm}
*
* @param res the created array representing the histogram
* @param a the input data
* @param nbins the number of bins to populate
* @throws Exception
*/
public static void histogram(Array res, Array a, int nbins) throws Exception {
Image.histogram(res, a, nbins);
}
/**
* Create a histogram of some give data, wraps
* {@link http://arrayfire.org/docs/group__image__func__histogram.htm}
*
* @param res the created array representing the histogram
* @param a the input data
* @param nbins the number of bins to populate between min and max
* @param min the minimum bin value
* @param max the maximum bin value
* @throws Exception
*/
public static void histogram(Array res, Array a, int nbins, float min, float max)
throws Exception {
Image.histogram(res, a, nbins, min, max);
}
/**
* Rotate an input image, wraps
* {@link http://arrayfire.org/docs/group__transform__func__rotate.htm}
*
* @param res the rotated image
* @param a the input image
* @param theta the angle by which to rotate
* @param crop whether to crop against the original dimensions, otherwise scale according to
* theta
* @throws Exception
*/
public static void rotate(Array res, Array a, float theta, boolean crop) throws Exception {
Image.rotate(res, a, theta, crop);
}
/**
* Rotate an input image, wraps
* {@link http://arrayfire.org/docs/group__transform__func__rotate.htm}
*
* @param res the rotated image
* @param a the input image
* @param theta the angle by which to rotate