@@ -299,6 +299,63 @@ def accum(a, dim=0):
299
299
"""
300
300
return _parallel_dim (a , dim , backend .get ().af_accum )
301
301
302
+ def scan (a , dim = 0 , op = BINARYOP .BINARY_ADD , inclusive_scan = True ):
303
+ """
304
+ Generalized scan of an array.
305
+
306
+ Parameters
307
+ ----------
308
+ a : af.Array
309
+ Multi dimensional arrayfire array.
310
+
311
+ dim : optional: int. default: 0
312
+ Dimension along which the scan is performed.
313
+
314
+ op : optional: af.BINARYOP. default: af.BINARYOP.BINARY_ADD.
315
+ - Interpolation method used for resizing.
316
+
317
+ inclusive_scan: optional: bool. default: True
318
+ Specifies if the scan is inclusive
319
+
320
+ Returns
321
+ ---------
322
+ out : af.Array
323
+ - will contain scan of input.
324
+ """
325
+ out = Array ()
326
+ safe_call (backend .get ().af_scan (ct .pointer (out .arr ), a .arr , dim , op , inclusive_scan ))
327
+ return out
328
+
329
+ def scanByKey (key , a , dim = 0 , op = BINARYOP .BINARY_ADD , inclusive_scan = True ):
330
+ """
331
+ Generalized scan by key of an array.
332
+
333
+ Parameters
334
+ ----------
335
+ key : af.Array
336
+ key array.
337
+
338
+ a : af.Array
339
+ Multi dimensional arrayfire array.
340
+
341
+ dim : optional: int. default: 0
342
+ Dimension along which the scan is performed.
343
+
344
+ op : optional: af.BINARYOP. default: af.BINARYOP.BINARY_ADD.
345
+ - Interpolation method used for resizing.
346
+
347
+ inclusive_scan: optional: bool. default: True
348
+ Specifies if the scan is inclusive
349
+
350
+ Returns
351
+ ---------
352
+ out : af.Array
353
+ - will contain scan of input.
354
+ """
355
+ out = Array ()
356
+ safe_call (backend .get ().af_scan (ct .pointer (out .arr ), key .arr , a .arr , dim , op , inclusive_scan ))
357
+ return out
358
+
302
359
def where (a ):
303
360
"""
304
361
Find the indices of non zero elements
0 commit comments