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: lib/node_modules/@stdlib/blas/ext/base/gsortsh/README.md
+17-34
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,9 @@ limitations under the License.
30
30
var gsortsh =require( '@stdlib/blas/ext/base/gsortsh' );
31
31
```
32
32
33
-
#### gsortsh( N, order, x, stride )
33
+
#### gsortsh( N, order, x, strideX )
34
34
35
-
Sorts a strided array `x`using Shellsort.
35
+
Sorts a strided array using Shellsort.
36
36
37
37
```javascript
38
38
var x = [ 1.0, -2.0, 3.0, -4.0 ];
@@ -46,41 +46,36 @@ The function has the following parameters:
46
46
-**N**: number of indexed elements.
47
47
-**order**: sort order. If `order < 0.0`, the input strided array is sorted in **decreasing** order. If `order > 0.0`, the input strided array is sorted in **increasing** order. If `order == 0.0`, the input strided array is left unchanged.
48
48
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
49
-
-**stride**: index increment.
49
+
-**strideX**: stride length.
50
50
51
-
The `N` and `stride` parameters determine which elements in `x`are accessed at runtime. For example, to sort every other element
51
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to sort every other element:
52
52
53
53
```javascript
54
-
var floor =require( '@stdlib/math/base/special/floor' );
55
-
56
54
var x = [ 1.0, -2.0, 3.0, -4.0 ];
57
-
varN=floor( x.length/2 );
58
55
59
-
gsortsh( N, -1.0, x, 2 );
56
+
gsortsh( 2, -1.0, x, 2 );
60
57
// x => [ 3.0, -2.0, 1.0, -4.0 ]
61
58
```
62
59
63
60
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
The function has the following additional parameters:
93
88
94
-
-**offset**: starting index.
89
+
-**offsetX**: starting index.
95
90
96
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of `x`
91
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements:
- If `N <= 0` or `order == 0.0`, both functions return `x` unchanged.
109
+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor])
114
110
- The algorithm distinguishes between `-0` and `+0`. When sorted in increasing order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is sorted after `+0`.
115
111
- The algorithm sorts `NaN` values to the end. When sorted in increasing order, `NaN` values are sorted last. When sorted in decreasing order, `NaN` values are sorted first.
116
112
- The algorithm has space complexity `O(1)` and worst case time complexity `O(N^(4/3))`.
0 commit comments