Mojo-Numerics-and-Algorithms-group / NuMojo

NuMojo is a library for numerical computing in Mojo 🔥 similar to numpy in Python.
Apache License 2.0
86 stars 15 forks source link

[lib] Implement the `argsort` functionality #57

Closed forFudan closed 2 months ago

forFudan commented 2 months ago

Implement the argsort function. Add a test file.

Test results:

[       0.085032448717433665    0.89161127730485756     0.18968977189964392     0.39800838814628897     0.74351245153226475     0.56038992815200594     ]
Shape: [6]  DType: float64

[       0       2       3       5       4       1       ]
Shape: [6]  DType: index

0.000174 s
==============================

[       11198796        2124991490      170454577       ...     1417941715      43647677        -248010538      ]
Shape: [12]  DType: int32

[       7       11      4       ...     5       9       1       ]
Shape: [12]  DType: index

7.8999999999999996e-05 s
==============================

[       0.54427280173529258     0.093629911904999585    0.43225952539313756     ...     0.34496925357704927     0.47419842610100349     0.15551212399418565]
Shape: [1000]  DType: float64

[       122     968     613     ...     831     565     651     ]
Shape: [1000]  DType: index

0.00018799999999999999 s
==============================