Skip to content

Commit c140521

Browse files
committed
fix: address review feedback for dsort2hp ndarray wrapper
1 parent f1e7758 commit c140521

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

lib/node_modules/@stdlib/blas/ext/base/ndarray/dsort2hp/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ var order = scalar2ndarray( 1.0, {
5959
var out = dsort2hp( [ x, y, order ] );
6060
// returns <ndarray>
6161

62+
var bool = ( out === x );
63+
// returns true
64+
6265
var arrX = ndarray2array( out );
6366
// returns [ -4.0, -2.0, 1.0, 3.0 ]
6467

@@ -80,7 +83,8 @@ The function has the following parameters:
8083

8184
- Both input ndarrays are sorted **in-place** (i.e., the input ndarrays are **mutated**).
8285
- Both ndarrays must have the same length.
83-
- When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged.
86+
- If the input ndarrays have zero elements or the sort order is equal to zero, the function leaves both input ndarrays unchanged.
87+
- When the sort order is less than zero, the first input ndarray is sorted in **decreasing** order. When the sort order is greater than zero, the first input ndarray is sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. The second input ndarray is reordered based on the sort order of the first input ndarray.
8488
- 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`.
8589
- 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.
8690
- The algorithm has space complexity `O(1)` and time complexity `O(N log2 N)`.

lib/node_modules/@stdlib/blas/ext/base/ndarray/dsort2hp/benchmark/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/array/uniform' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
26+
var format = require( '@stdlib/string/format' );
2627
var ndarray = require( '@stdlib/ndarray/base/ctor' );
2728
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
2829
var pkg = require( './../package.json' ).name;
@@ -103,7 +104,7 @@ function main() {
103104
for ( i = min; i <= max; i++ ) {
104105
len = pow( 10, i );
105106
f = createBenchmark( len );
106-
bench( pkg+':len='+len, f );
107+
bench( format( '%s::len=%d', pkg, len ), f );
107108
}
108109
}
109110

lib/node_modules/@stdlib/blas/ext/base/ndarray/dsort2hp/docs/repl.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@
33
Simultaneously sorts two one-dimensional double-precision floating-point
44
ndarrays based on the sort order of the first array using heapsort.
55

6-
When the sort order is less than zero, the input ndarrays are sorted in
7-
decreasing order. When the sort order is greater than zero, the input
8-
ndarrays are sorted in increasing order. When the sort order is equal to
6+
When the sort order is less than zero, the first input ndarray is sorted in
7+
decreasing order. When the sort order is greater than zero, the first input
8+
ndarray is sorted in increasing order. When the sort order is equal to
99
zero, the input ndarrays are left unchanged.
1010

11+
If the input ndarrays have zero elements or the sort order is equal to
12+
zero, the function leaves both input ndarrays unchanged.
13+
14+
The algorithm distinguishes between `-0` and `+0`. When sorted in increasing
15+
order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is
16+
sorted after `+0`.
17+
18+
The algorithm sorts `NaN` values to the end. When sorted in increasing
19+
order, `NaN` values are sorted last. When sorted in decreasing order, `NaN`
20+
values are sorted first.
21+
22+
The algorithm has space complexity O(1) and time complexity O(N log2 N).
23+
24+
The algorithm is *unstable*, meaning that the algorithm may change the order
25+
of ndarray elements which are equal or equivalent (e.g., `NaN` values).
26+
1127
Both input ndarrays are sorted *in-place* (i.e., the input ndarrays are
1228
*mutated*).
1329

lib/node_modules/@stdlib/blas/ext/base/ndarray/dsort2hp/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { typedndarray, float64ndarray } from '@stdlib/types/ndarray';
2727
*
2828
* ## Notes
2929
*
30-
* - When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged.
30+
* - When the sort order is less than zero, the first input ndarray is sorted in **decreasing** order. When the sort order is greater than zero, the first input ndarray is sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. The second input ndarray is reordered based on the sort order of the first input ndarray.
3131
*
3232
* @param arrays - array-like object containing two one-dimensional input ndarrays and a zero-dimensional ndarray specifying the sort order
3333
* @returns first input ndarray

lib/node_modules/@stdlib/blas/ext/base/ndarray/dsort2hp/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ var strided = require( '@stdlib/blas/ext/base/dsort2hp' ).ndarray;
3535
*
3636
* ## Notes
3737
*
38-
* - When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged.
38+
* - When the sort order is less than zero, the first input ndarray is sorted in **decreasing** order. When the sort order is greater than zero, the first input ndarray is sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. The second input ndarray is reordered based on the sort order of the first input ndarray.
3939
*
4040
* @param {ArrayLikeObject<Object>} arrays - array-like object containing two one-dimensional input ndarrays and a zero-dimensional ndarray specifying the sort order
41-
* @returns {ndarray} first input ndarray
41+
* @returns {Object} first input ndarray
4242
*
4343
* @example
4444
* var Float64Array = require( '@stdlib/array/float64' );

0 commit comments

Comments
 (0)