Skip to content

Commit fda4427

Browse files
committed
Fixing bug in sort_by_key parameters
1 parent 9162487 commit fda4427

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arrayfire/algorithm.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,35 +473,35 @@ def sort_index(a, dim=0, is_ascending=True):
473473
c_uint_t(dim), c_bool_t(is_ascending)))
474474
return out,idx
475475

476-
def sort_by_key(iv, ik, dim=0, is_ascending=True):
476+
def sort_by_key(ik, iv, dim=0, is_ascending=True):
477477
"""
478478
Sort an array based on specified keys
479479
480480
Parameters
481481
----------
482-
iv : af.Array
483-
An Array containing the values
484482
ik : af.Array
485483
An Array containing the keys
484+
iv : af.Array
485+
An Array containing the values
486486
dim: optional: int. default: 0
487487
Dimension along which sort is to be performed.
488488
is_ascending: optional: bool. default: True
489489
Specifies the direction of the sort
490490
491491
Returns
492492
-------
493-
(ov, ok): tuple of af.Array
494-
`ov` contains the values from `iv` after sorting them based on `ik`
493+
(ok, ov): tuple of af.Array
495494
`ok` contains the values from `ik` in sorted order
495+
`ov` contains the values from `iv` after sorting them based on `ik`
496496
497497
Note
498498
-------
499499
Currently `dim` is only supported for 0.
500500
"""
501501
ov = Array()
502502
ok = Array()
503-
safe_call(backend.get().af_sort_by_key(c_pointer(ov.arr), c_pointer(ok.arr),
504-
iv.arr, ik.arr, c_uint_t(dim), c_bool_t(is_ascending)))
503+
safe_call(backend.get().af_sort_by_key(c_pointer(ok.arr), c_pointer(ov.arr),
504+
ik.arr, iv.arr, c_uint_t(dim), c_bool_t(is_ascending)))
505505
return ov,ok
506506

507507
def set_unique(a, is_sorted=False):

0 commit comments

Comments
 (0)