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: CHANGELOG.md
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,50 @@
2
2
3
3
> Package changelog.
4
4
5
+
<section class="release" id="unreleased">
6
+
7
+
## Unreleased (2025-02-08)
8
+
9
+
<section class="features">
10
+
11
+
### Features
12
+
13
+
- [`112b7ef`](https://github.com/stdlib-js/stdlib/commit/112b7ef36a44bc8b27ad757cc3099d2595aa8aaa) - add accessor arrays support and refactor `blas/ext/base/gsorthp` [(#5117)](https://github.com/stdlib-js/stdlib/pull/5117)
14
+
15
+
</section>
16
+
17
+
<!-- /.features -->
18
+
19
+
<section class="commits">
20
+
21
+
### Commits
22
+
23
+
<details>
24
+
25
+
- [`112b7ef`](https://github.com/stdlib-js/stdlib/commit/112b7ef36a44bc8b27ad757cc3099d2595aa8aaa) - **feat:** add accessor arrays support and refactor `blas/ext/base/gsorthp` [(#5117)](https://github.com/stdlib-js/stdlib/pull/5117) _(by Muhammad Haris)_
26
+
27
+
</details>
28
+
29
+
</section>
30
+
31
+
<!-- /.commits -->
32
+
33
+
<section class="contributors">
34
+
35
+
### Contributors
36
+
37
+
A total of 1 person contributed to this release. Thank you to this contributor:
Copy file name to clipboardExpand all lines: README.md
+18-35Lines changed: 18 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -63,9 +63,9 @@ To view installation and usage instructions specific to each branch build, be su
63
63
var gsorthp = require( '@stdlib/blas-ext-base-gsorthp' );
64
64
```
65
65
66
-
#### gsorthp( N, order, x, stride )
66
+
#### gsorthp( N, order, x, strideX )
67
67
68
-
Sorts a strided array `x` using heapsort.
68
+
Sorts a strided array using heapsort.
69
69
70
70
```javascript
71
71
var x = [ 1.0, -2.0, 3.0, -4.0 ];
@@ -79,41 +79,36 @@ The function has the following parameters:
79
79
- **N**: number of indexed elements.
80
80
- **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.
81
81
- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
82
-
- **stride**: index increment.
82
+
- **strideX**: stride length.
83
83
84
-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to sort every other element
84
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to sort every other element:
85
85
86
86
```javascript
87
-
var floor = require( '@stdlib/math-base-special-floor' );
88
-
89
87
var x = [ 1.0, -2.0, 3.0, -4.0 ];
90
-
var N = floor( x.length / 2 );
91
88
92
-
gsorthp( N, -1.0, x, 2 );
89
+
gsorthp( 2, -1.0, x, 2 );
93
90
// x => [ 3.0, -2.0, 1.0, -4.0 ]
94
91
```
95
92
96
93
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
97
94
98
95
```javascript
99
96
var Float64Array = require( '@stdlib/array-float64' );
100
-
var floor = require( '@stdlib/math-base-special-floor' );
101
97
102
98
// Initial array...
103
99
var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
104
100
105
101
// Create an offset view...
106
102
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
107
-
var N = floor( x0.length/2 );
108
103
109
104
// Sort every other element...
110
-
gsorthp( N, -1.0, x1, 2 );
105
+
gsorthp( 2, -1.0, x1, 2 );
111
106
// x0 => <Float64Array>[ 1.0, 4.0, 3.0, 2.0 ]
112
107
```
113
108
114
-
#### gsorthp.ndarray( N, order, x, stride, offset )
109
+
#### gsorthp.ndarray( N, order, x, strideX, offsetX )
115
110
116
-
Sorts a strided array `x` using heapsort and alternative indexing semantics.
111
+
Sorts a strided array using heapsort and alternative indexing semantics.
The function has the following additional parameters:
126
121
127
-
- **offset**: starting index.
122
+
- **offsetX**: starting index.
128
123
129
-
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`
124
+
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.
142
+
- 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])
147
143
- 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`.
148
144
- 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.
149
145
- The algorithm has space complexity `O(1)` and time complexity `O(N log2 N)`.
0 commit comments