We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eeaa4f1 commit 32a6b2fCopy full SHA for 32a6b2f
src/pint_array/__init__.py
@@ -556,6 +556,22 @@ def matrix_transpose(x):
556
557
mod.matrix_transpose = matrix_transpose
558
559
+ ## Sorting Functions ##
560
+ def get_sort_fun(func_str):
561
+ def sort_fun(x, /, **kwargs):
562
+ x = asarray(x)
563
+ magnitude = xp.asarray(x.magnitude, copy=True)
564
+ xp_func = getattr(xp, func_str)
565
+ magnitude = xp_func(magnitude, **kwargs)
566
+ units = x.units if func_str == "sort" else None
567
+ return ArrayUnitQuantity(magnitude, units)
568
+
569
+ return sort_fun
570
571
+ sort_names = ["sort", "argsort"]
572
+ for name in sort_names:
573
+ setattr(mod, name, get_sort_fun(name))
574
575
## Set Functions ##
576
def get_set_fun(func_str):
577
def set_fun(x, /):
0 commit comments