This file is indexed.

/usr/include/af/algorithm.h is in libarrayfire-dev 3.3.2+dfsg1-4ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
/*******************************************************
 * Copyright (c) 2014, ArrayFire
 * All rights reserved.
 *
 * This file is distributed under 3-clause BSD license.
 * The complete license agreement can be obtained at:
 * http://arrayfire.com/licenses/BSD-3-Clause
 ********************************************************/

#pragma once
#include <af/defines.h>

#ifdef __cplusplus
namespace af
{
    class array;

    /**
       C++ Interface for sum of elements in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \return    result of sum all values along dimension \p dim

       \ingroup reduce_func_sum

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
    */
    AFAPI array sum(const array &in, const int dim = -1);

#if AF_API_VERSION >= 31
    /**
       C++ Interface for sum of elements in an array while replacing nan values

       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \param[in] nanval Replace nans with the value passed to this function
       \return    result of sum all values along dimension \p dim

       \ingroup reduce_func_sum

    */
    AFAPI array sum(const array &in, const int dim, const double nanval);
#endif

    /**
       C++ Interface for product of elements in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the multiply operation occurs
       \return    result of product all values along dimension \p dim

       \ingroup reduce_func_product

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
    */
    AFAPI array product(const array &in, const int dim = -1);

#if AF_API_VERSION >= 31
    /**
       C++ Interface for product of elements in an array while replacing nan values

       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \param[in] nanval Replace nans with the value passed to this function
       \return    result of product all values along dimension \p dim

       \ingroup reduce_func_product

    */
    AFAPI array product(const array &in, const int dim, const double nanval);
#endif

    /**
       C++ Interface for minimum values in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the minimum value needs to be extracted
       \return    result of minimum all values along dimension \p dim

       \ingroup reduce_func_min

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
       \note NaN values are ignored
    */
    AFAPI array min(const array &in, const int dim = -1);

    /**
       C++ Interface for maximum values in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the maximum value needs to be extracted
       \return    result of maximum all values along dimension \p dim

       \ingroup reduce_func_max

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
       \note NaN values are ignored
    */
    AFAPI array max(const array &in, const int dim = -1);

    /**
       C++ Interface for checking all true values in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the values are checked to be all true
       \return    result of checking if values along dimension \p dim are all true

       \ingroup reduce_func_all_true

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
       \note NaN values are ignored
    */
    AFAPI array allTrue(const array &in, const int dim = -1);

    /**
       C++ Interface for checking any true values in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the values are checked to be any true
       \return    result of checking if values along dimension \p dim are any true

       \ingroup reduce_func_any_true

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
       \note NaN values are ignored
    */
    AFAPI array anyTrue(const array &in, const int dim = -1);

    /**
       C++ Interface for counting non-zero values in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which the the number of non-zero values are counted
       \return    the number of non-zero values along dimension \p dim

       \ingroup reduce_func_count

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
       \note NaN values are treated as non zero.
    */
    AFAPI array count(const array &in, const int dim = -1);

    /**
       C++ Interface for sum of all elements in an array

       \param[in] in is the input array
       \return    the sum of all values of \p in

       \ingroup reduce_func_sum
    */
    template<typename T> T sum(const array &in);

#if AF_API_VERSION >= 31
    /**
       C++ Interface for sum of all elements in an array while replacing nan values

       \param[in] in is the input array
       \param[in] nanval  Replace nans with the value passed to this function
       \return    the sum of all values of \p in

       \ingroup reduce_func_sum
    */
    template<typename T> T sum(const array &in, double nanval);
#endif

    /**
       C++ Interface for product of all elements in an array

       \param[in] in is the input array
       \return    the product of all values of \p in

       \ingroup reduce_func_product
    */
    template<typename T> T product(const array &in);

#if AF_API_VERSION >= 31
    /**
       C++ Interface for product of all elements in an array while replacing nan values

       \param[in] in is the input array
       \param[in] nanval  Replace nans with the value passed to this function
       \return    the product of all values of \p in

       \ingroup reduce_func_product
    */
    template<typename T> T product(const array &in, double nanval);
#endif

    /**
       C++ Interface for getting minimum value of an array

       \param[in] in is the input array
       \return    the minimum of all values of \p in

       \ingroup reduce_func_min

       \note NaN values are ignored
    */
    template<typename T> T min(const array &in);

    /**
       C++ Interface for getting maximum value of an array

       \param[in] in is the input array
       \return    the maximum of all values of \p in

       \ingroup reduce_func_max

       \note NaN values are ignored
    */
    template<typename T> T max(const array &in);

    /**
       C++ Interface for checking if all values in an array are true

       \param[in] in is the input array
       \return    true if all values of \p in are true, false otherwise

       \ingroup reduce_func_all_true

       \note NaN values are ignored
    */
    template<typename T> T allTrue(const array &in);

    /**
       C++ Interface for checking if any values in an array are true

       \param[in] in is the input array
       \return    true if any values of \p in are true, false otherwise

       \ingroup reduce_func_any_true

       \note NaN values are ignored
    */
    template<typename T> T anyTrue(const array &in);

    /**
       C++ Interface for counting total number of non-zero values in an array

       \param[in] in is the input array
       \return    the number of non-zero values in \p in

       \ingroup reduce_func_count

       \note NaN values are treated as non zero
    */
    template<typename T> T count(const array &in);

    /**
       C++ Interface for getting minimum values and their locations in an array

       \param[out] val will contain the minimum values along dimension \p dim
       \param[out] idx will contain the locations of minimum all values along dimension \p dim
       \param[in]  in is the input array
       \param[in]  dim The dimension along which the minimum value needs to be extracted

       \ingroup reduce_func_min

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.

       \note NaN values are ignored
    */
    AFAPI void min(array &val, array &idx, const array &in, const int dim = -1);

    /**
       C++ Interface for getting maximum values and their locations in an array

       \param[out] val will contain the maximum values along dimension \p dim
       \param[out] idx will contain the locations of maximum all values along dimension \p dim
       \param[in]  in is the input array
       \param[in]  dim The dimension along which the maximum value needs to be extracted

       \ingroup reduce_func_max

       \note \p dim is -1 by default. -1 denotes the first non-singleton dimension.

       \note NaN values are ignored
    */
    AFAPI void max(array &val, array &idx, const array &in, const int dim = -1);

    /**
       C++ Interface for getting minimum value and its location from the entire array

       \param[out] val will contain the minimum values in the input
       \param[out] idx will contain the locations of minimum all values in the input
       \param[in]  in is the input array

       \ingroup reduce_func_min

       \note NaN values are ignored
    */
    template<typename T> void min(T *val, unsigned *idx, const array &in);

    /**
       C++ Interface for getting maximum value and its location from the entire array

       \param[out] val contains the maximum values in the input
       \param[out] idx contains the locations of maximum all values in the input
       \param[in]  in is the input array

       \ingroup reduce_func_max

       \note NaN values are ignored
    */
    template<typename T> void max(T *val, unsigned *idx, const array &in);

    /**
       C++ Interface exclusive sum (cumulative sum) of an array

       \param[in] in is the input array
       \param[in] dim The dimension along which exclusive sum is performed
       \return the output containing exclusive sums of the input

       \ingroup scan_func_accum
    */
    AFAPI array accum(const array &in, const int dim = 0);

    /**
       C++ Interface for finding the locations of non-zero values in an array

       \param[in] in is the input array.
       \return linear indices where \p in is non-zero

       \ingroup scan_func_where
    */
    AFAPI array where(const array &in);

    /**
       C++ Interface for calculating first order differences in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \return array of first order numerical difference

       \ingroup calc_func_diff1
    */
    AFAPI array diff1(const array &in, const int dim = 0);

    /**
       C++ Interface for calculating second order differences in an array

       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \return array of second order numerical difference

       \ingroup calc_func_diff2
    */
    AFAPI array diff2(const array &in, const int dim = 0);

    /**
       C++ Interface for sorting an array

       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order
       \return the sorted output

       \ingroup sort_func_sort
    */
    AFAPI array sort(const array &in, const unsigned dim = 0, const bool isAscending = true);

    /**
       C++ Interface for sorting an array and getting original indices

       \param[out] out will contain the sorted output
       \param[out] indices will contain the indices in the original input
       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order

       \ingroup sort_func_sort_index
    */
    AFAPI void  sort(array &out, array &indices, const array &in, const unsigned dim = 0,
                     const bool isAscending = true);
    /**
       C++ Interface for sorting an array based on keys

       \param[out] out_keys will contain the keys based on sorted values
       \param[out] out_values will contain the sorted values
       \param[in] keys is the input array
       \param[in] values The dimension along which numerical difference is performed
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order

       \ingroup sort_func_sort_keys
    */
    AFAPI void  sort(array &out_keys, array &out_values, const array &keys, const array &values,
                     const unsigned dim = 0, const bool isAscending = true);

    /**
       C++ Interface for getting unique values

       \param[in] in is the input array
       \param[in] is_sorted if true, skips the sorting steps internally
       \return the unique values from \p in

       \ingroup set_func_unique
    */
    AFAPI array setUnique(const array &in, const bool is_sorted=false);

    /**
       C++ Interface for performing union of two arrays

       \param[in] first is the first array
       \param[in] second is the second array
       \param[in] is_unique if true, skips calling unique internally
       \return the union of \p first and \p second

       \ingroup set_func_union
    */
    AFAPI array setUnion(const array &first, const array &second, const bool is_unique=false);

    /**
       C++ Interface for performing intersect of two arrays

       \param[in] first is the first array
       \param[in] second is the second array
       \param[in] is_unique if true, skips calling unique internally
       \return the intersection of \p first and \p second

       \ingroup set_func_intersect
    */
    AFAPI array setIntersect(const array &first, const array &second, const bool is_unique=false);
}
#endif

#ifdef __cplusplus
extern "C" {
#endif

    /**
       C Interface for sum of elements in an array

       \param[out] out will contain the sum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_sum
    */
    AFAPI af_err af_sum(af_array *out, const af_array in, const int dim);

#if AF_API_VERSION >= 31
    /**
       C Interface for sum of elements in an array while replacing nans

       \param[out] out will contain the sum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \param[in] nanval Replace nans with the value passed to this function
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_sum
    */
    AFAPI af_err af_sum_nan(af_array *out, const af_array in, const int dim, const double nanval);
#endif

    /**
       C Interface for product of elements in an array

       \param[out] out will contain the product of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the multiply operation occurs
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_product
    */
    AFAPI af_err af_product(af_array *out, const af_array in, const int dim);

#if AF_API_VERSION >= 31
    /**
       C Interface for product of elements in an array while replacing nans

       \param[out] out will contain the product of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the add operation occurs
       \param[in] nanval Replace nans with the value passed to this function
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_product
    */
    AFAPI af_err af_product_nan(af_array *out, const af_array in, const int dim, const double nanval);
#endif

    /**
       C Interface for minimum values in an array

       \param[out] out will contain the minimum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the minimum value is extracted
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_min
    */
    AFAPI af_err af_min(af_array *out, const af_array in, const int dim);

    /**
       C Interface for maximum values in an array

       \param[out] out will contain the maximum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the maximum value is extracted
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_max
    */
    AFAPI af_err af_max(af_array *out, const af_array in, const int dim);

    /**
       C Interface for checking all true values in an array

       \param[out] out will contain the result of "and" operation all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the "and" operation occurs
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_all_true
    */
    AFAPI af_err af_all_true(af_array *out, const af_array in, const int dim);

    /**
       C Interface for checking any true values in an array

       \param[out] out will contain the result of "or" operation all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the "or" operation occurs
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_any_true
    */
    AFAPI af_err af_any_true(af_array *out, const af_array in, const int dim);

    /**
       C Interface for counting non-zero values in an array

       \param[out] out will contain the number of non-zero values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the non-zero values are counted
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_count
    */
    AFAPI af_err af_count(af_array *out, const af_array in, const int dim);

    /**
       C Interface for sum of all elements in an array

       \param[out] real will contain the real part of adding all elements in input \p in
       \param[out] imag will contain the imaginary part of adding all elements in input \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real

       \ingroup reduce_func_sum
    */
    AFAPI af_err af_sum_all(double *real, double *imag, const af_array in);

#if AF_API_VERSION >= 31
    /**
       C Interface for sum of all elements in an array while replacing nans

       \param[out] real will contain the real part of adding all elements in input \p in
       \param[out] imag will contain the imaginary part of adding all elements in input \p in
       \param[in] in is the input array
       \param[in] nanval is the value which replaces nan
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real

       \ingroup reduce_func_sum
    */
    AFAPI af_err af_sum_nan_all(double *real, double *imag, const af_array in, const double nanval);
#endif

    /**
       C Interface for product of all elements in an array

       \param[out] real will contain the real part of multiplying all elements in input \p in
       \param[out] imag will contain the imaginary part of multiplying all elements in input \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real

       \ingroup reduce_func_product
    */
    AFAPI af_err af_product_all(double *real, double *imag, const af_array in);

#if AF_API_VERSION >= 31
    /**
       C Interface for product of all elements in an array while replacing nans

       \param[out] real will contain the real part of adding all elements in input \p in
       \param[out] imag will contain the imaginary part of adding all elements in input \p in
       \param[in] in is the input array
       \param[in] nanval is the value which replaces nan
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real

       \ingroup reduce_func_product
    */
    AFAPI af_err af_product_nan_all(double *real, double *imag, const af_array in, const double nanval);
#endif

    /**
       C Interface for getting minimum value of an array

       \param[out] real will contain the real part of minimum value of all elements in input \p in
       \param[out] imag will contain the imaginary part of minimum value of all elements in input \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real.

       \ingroup reduce_func_min
    */
    AFAPI af_err af_min_all(double *real, double *imag, const af_array in);

    /**
       C Interface for getting maximum value of an array

       \param[out] real will contain the real part of maximum value of all elements in input \p in
       \param[out] imag will contain the imaginary part of maximum value of all elements in input \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real.

       \ingroup reduce_func_max
    */
    AFAPI af_err af_max_all(double *real, double *imag, const af_array in);

    /**
       C Interface for checking if all values in an array are true

       \param[out] real is 1 if all values of input \p in are true, 0 otherwise.
       \param[out] imag is always set to 0.
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0.

       \ingroup reduce_func_all_true
    */
    AFAPI af_err af_all_true_all(double *real, double *imag, const af_array in);

    /**
       C Interface for checking if any values in an array are true

       \param[out] real is 1 if any value of input \p in is true, 0 otherwise.
       \param[out] imag is always set to 0.
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0.

       \ingroup reduce_func_any_true
    */
    AFAPI af_err af_any_true_all(double *real, double *imag, const af_array in);

    /**
       C Interface for counting total number of non-zero values in an array

       \param[out] real will contain the number of non-zero values in \p in.
       \param[out] imag is always set to 0.
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0.

       \ingroup reduce_func_count
    */
    AFAPI af_err af_count_all(double *real, double *imag, const af_array in);

    /**
       C Interface for getting minimum values and their locations in an array

       \param[out] out will contain the minimum of all values in \p in along \p dim
       \param[out] idx will contain the location of minimum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the minimum value is extracted
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_min
    */
    AFAPI af_err af_imin(af_array *out, af_array *idx, const af_array in, const int dim);

    /**
       C Interface for getting maximum values and their locations in an array

       \param[out] out will contain the maximum of all values in \p in along \p dim
       \param[out] idx will contain the location of maximum of all values in \p in along \p dim
       \param[in] in is the input array
       \param[in] dim The dimension along which the maximum value is extracted
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup reduce_func_max
    */
    AFAPI af_err af_imax(af_array *out, af_array *idx, const af_array in, const int dim);

    /**
       C Interface for getting minimum value and its location from the entire array

       \param[out] real will contain the real part of minimum value of all elements in input \p in
       \param[out] imag will contain the imaginary part of minimum value of all elements in input \p in
       \param[out] idx will contain the location of minimum of all values in \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real.

       \ingroup reduce_func_min
    */
    AFAPI af_err af_imin_all(double *real, double *imag, unsigned *idx, const af_array in);

    /**
       C Interface for getting maximum value and it's location from the entire array

       \param[out] real will contain the real part of maximum value of all elements in input \p in
       \param[out] imag will contain the imaginary part of maximum value of all elements in input \p in
       \param[out] idx will contain the location of maximum of all values in \p in
       \param[in] in is the input array
       \return \ref AF_SUCCESS if the execution completes properly

       \note \p imag is always set to 0 when \p in is real.

       \ingroup reduce_func_max
    */
    AFAPI af_err af_imax_all(double *real, double *imag, unsigned *idx, const af_array in);

    /**
       C Interface exclusive sum (cumulative sum) of an array

       \param[out] out will contain exclusive sums of the input
       \param[in] in is the input array
       \param[in] dim The dimension along which exclusive sum is performed
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup scan_func_accum
    */
    AFAPI af_err af_accum(af_array *out, const af_array in, const int dim);

    /**
       C Interface for finding the locations of non-zero values in an array

       \param[out] idx will contain indices where \p in is non-zero
       \param[in] in is the input array.
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup scan_func_where
    */
    AFAPI af_err af_where(af_array *idx, const af_array in);

    /**
       C Interface for calculating first order differences in an array

       \param[out] out will contain the first order numerical differences of \p in
       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup calc_func_diff1
    */
    AFAPI af_err af_diff1(af_array *out, const af_array in, const int dim);

    /**
       C Interface for calculating second order differences in an array

       \param[out] out will contain the second order numerical differences of \p in
       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup calc_func_diff2
    */
    AFAPI af_err af_diff2(af_array *out, const af_array in, const int dim);

    /**
       C Interface for sorting an array

       \param[out] out will contain the sorted output
       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup sort_func_sort
    */
    AFAPI af_err af_sort(af_array *out, const af_array in, const unsigned dim, const bool isAscending);

    /**
       C Interface for sorting an array and getting original indices

       \param[out] out will contain the sorted output
       \param[out] indices will contain the indices in the original input
       \param[in] in is the input array
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup sort_func_sort_index
    */
    AFAPI af_err af_sort_index(af_array *out, af_array *indices, const af_array in,
                               const unsigned dim, const bool isAscending);
    /**
       C Interface for sorting an array based on keys

       \param[out] out_keys will contain the keys based on sorted values
       \param[out] out_values will contain the sorted values
       \param[in] keys is the input array
       \param[in] values The dimension along which numerical difference is performed
       \param[in] dim The dimension along which numerical difference is performed
       \param[in] isAscending specifies the sorting order
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup sort_func_sort_keys
    */
    AFAPI af_err af_sort_by_key(af_array *out_keys, af_array *out_values,
                                const af_array keys, const af_array values,
                                const unsigned dim, const bool isAscending);

    /**
       C Interface for getting unique values

       \param[out] out will contain the unique values from \p in
       \param[in] in is the input array
       \param[in] is_sorted if true, skips the sorting steps internally
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup set_func_unique
    */
    AFAPI af_err af_set_unique(af_array *out, const af_array in, const bool is_sorted);

    /**
       C Interface for performing union of two arrays

       \param[out] out will contain the union of \p first and \p second
       \param[in] first is the first array
       \param[in] second is the second array
       \param[in] is_unique if true, skips calling unique internally
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup set_func_union
    */
    AFAPI af_err af_set_union(af_array *out, const af_array first, const af_array second, const bool is_unique);

    /**
       C Interface for performing intersect of two arrays

       \param[out] out will contain the intersection of \p first and \p second
       \param[in] first is the first array
       \param[in] second is the second array
       \param[in] is_unique if true, skips calling unique internally
       \return \ref AF_SUCCESS if the execution completes properly

       \ingroup set_func_intersect
    */
    AFAPI af_err af_set_intersect(af_array *out, const af_array first, const af_array second, const bool is_unique);

#ifdef __cplusplus
}
#endif