You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ext/sorthp/README.md
+6-27Lines changed: 6 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,16 +35,12 @@ var sorthp = require( '@stdlib/blas/ext/sorthp' );
35
35
Sorts an input [ndarray][@stdlib/ndarray/ctor] along one or more [ndarray][@stdlib/ndarray/ctor] dimensions using heapsort.
36
36
37
37
```javascript
38
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
39
38
var array =require( '@stdlib/ndarray/array' );
40
39
41
40
var x =array( [ -1.0, 2.0, -3.0 ] );
42
41
43
42
var y =sorthp( x );
44
-
// returns <ndarray>
45
-
46
-
var arr =ndarray2array( y );
47
-
// returns [ -3.0, -1.0, 2.0 ]
43
+
// returns <ndarray>[ -3.0, -1.0, 2.0 ]
48
44
49
45
var bool = ( x === y );
50
46
// returns true
@@ -63,62 +59,45 @@ The function accepts the following options:
63
59
By default, the function sorts elements in increasing order. To sort in a different order, provide a `sortOrder` argument.
64
60
65
61
```javascript
66
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
67
62
var array =require( '@stdlib/ndarray/array' );
68
63
69
64
var x =array( [ -1.0, 2.0, -3.0 ] );
70
65
71
66
var y =sorthp( x, -1.0 );
72
-
// returns <ndarray>
73
-
74
-
var arr =ndarray2array( y );
75
-
// returns [ 2.0, -1.0, -3.0 ]
67
+
// returns <ndarray>[ 2.0, -1.0, -3.0 ]
76
68
```
77
69
78
70
In addition to numeric values, one can specify the sort order via one of the following string literals: `'ascending'`, `'asc'`, `'descending'`, or `'desc'`. The first two literals indicate to sort in ascending (i.e., increasing) order. The last two literals indicate to sort in descending (i.e., decreasing) order.
79
71
80
72
```javascript
81
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
82
73
var array =require( '@stdlib/ndarray/array' );
83
74
84
75
var x =array( [ -1.0, 2.0, -3.0 ] );
85
76
86
77
// Sort in ascending order:
87
78
var y =sorthp( x, 'asc' );
88
-
// returns <ndarray>
89
-
90
-
var arr =ndarray2array( y );
91
-
// returns [ -3.0, -1.0, 2.0 ]
79
+
// returns <ndarray>[ -3.0, -1.0, 2.0 ]
92
80
93
81
// Sort in descending order:
94
82
y =sorthp( x, 'descending' );
95
-
// returns <ndarray>
96
-
97
-
arr =ndarray2array( y );
98
-
// returns [ 2.0, -1.0, -3.0 ]
83
+
// returns <ndarray>[ 2.0, -1.0, -3.0 ]
99
84
```
100
85
101
86
By default, the function performs the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform the operation over specific dimensions, provide a `dims` option.
102
87
103
88
```javascript
104
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
0 commit comments