Skip to content

Commit 975ce52

Browse files
authored
refactor: apply suggestions from code review
Signed-off-by: Muhammad Haris <[email protected]>
1 parent b2c2989 commit 975ce52

File tree

9 files changed

+38
-42
lines changed

9 files changed

+38
-42
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ The function has the following parameters:
5454
- **N**: number of indexed elements.
5555
- **order**: sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
5656
- **x**: first input [`Float64Array`][@stdlib/array/float64].
57-
- **strideX**: `x` stride length.
57+
- **strideX**: stride length for `x`.
5858
- **y**: second input [`Float64Array`][@stdlib/array/float64].
59-
- **strideY**: `y` stride length.
59+
- **strideY**: stride length for `y`.
6060

61-
The `N` and stride parameters determine which elements in `x` and `y` are accessed at runtime. For example, to sort every other element:
61+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to sort every other element:
6262

6363
```javascript
6464
var Float64Array = require( '@stdlib/array/float64' );
@@ -123,8 +123,8 @@ console.log( y );
123123

124124
The function has the following additional parameters:
125125

126-
- **offsetX**: `x` starting index.
127-
- **offsetY**: `y` starting index.
126+
- **offsetX**: starting index for `x`.
127+
- **offsetY**: starting index for `y`.
128128

129129
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last three elements:
130130

@@ -224,20 +224,20 @@ Simultaneously sorts two double-precision floating-point strided arrays based on
224224
double x[] = { 1.0, -2.0, 3.0, -4.0 };
225225
double y[] = { 0.0, 1.0, 2.0, 3.0 };
226226

227-
stdlib_strided_dsort2hp( 4, 1, x, 1, y, 1 );
227+
stdlib_strided_dsort2hp( 4, 1.0, x, 1, y, 1 );
228228
```
229229
230230
The function accepts the following arguments:
231231
232232
- **N**: `[in] CBLAS_INT` number of indexed elements.
233-
- **order**: `[in] CBLAS_INT` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
233+
- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
234234
- **X**: `[inout] double*` input array.
235235
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
236236
- **Y**: `[inout] double*` input array.
237237
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
238238
239239
```c
240-
stdlib_strided_dsort2hp( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, double *Y, CBLAS_INT strideY );
240+
stdlib_strided_dsort2hp( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, double *Y, CBLAS_INT strideY );
241241
```
242242

243243
<!--lint disable maximum-heading-length-->
@@ -252,22 +252,22 @@ Simultaneously sorts two double-precision floating-point strided arrays based on
252252
double x[] = { 1.0, -2.0, 3.0, -4.0 };
253253
double y[] = { 0.0, 1.0, 2.0, 3.0 };
254254

255-
stdlib_strided_dsort2hp_ndarray( 4, 1, x, 1, 0, y, 1, 0 );
255+
stdlib_strided_dsort2hp_ndarray( 4, 1.0, x, 1, 0, y, 1, 0 );
256256
```
257257
258258
The function accepts the following arguments:
259259
260260
- **N**: `[in] CBLAS_INT` number of indexed elements.
261-
- **order**: `[in] CBLAS_INT` sort order.
262-
- **X**: `[inout] double*` input array. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
261+
- **order**: `[in] double` sort order.
262+
- **X**: `[inout] double*` input array.
263263
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
264264
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
265265
- **Y**: `[inout] double*` input array.
266266
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
267267
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
268268
269269
```c
270-
stdlib_strided_dsort2hp_ndarray( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX, double *Y, CBLAS_INT strideY, CBLAS_INT offsetY );
270+
stdlib_strided_dsort2hp_ndarray( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX, double *Y, CBLAS_INT strideY, CBLAS_INT offsetY );
271271
```
272272

273273
</section>

lib/node_modules/@stdlib/blas/ext/base/dsort2hp/benchmark/c/benchmark.unsorted_random.length.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static double benchmark1( int iterations, int len ) {
107107
}
108108
t = tic();
109109
for ( i = 0; i < iterations; i++ ) {
110-
stdlib_strided_dsort2hp( len, 1, x, 1, y, 1 );
110+
stdlib_strided_dsort2hp( len, 1.0, x, 1, y, 1 );
111111
if ( y[ 0 ] != y[ 0 ] ) {
112112
printf( "should not return NaN\n" );
113113
break;
@@ -140,7 +140,7 @@ static double benchmark2( int iterations, int len ) {
140140
}
141141
t = tic();
142142
for ( i = 0; i < iterations; i++ ) {
143-
stdlib_strided_dsort2hp_ndarray( len, 1, x, 1, 0, y, 1, 0 );
143+
stdlib_strided_dsort2hp_ndarray( len, 1.0, x, 1, 0, y, 1, 0 );
144144
if ( y[ 0 ] != y[ 0 ] ) {
145145
printf( "should not return NaN\n" );
146146
break;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Simultaneously sorts two double-precision floating-point strided arrays
44
based on the sort order of the first array using heapsort.
55

6-
The `N` and stride parameters determine which elements in `x` and `y` are
6+
The `N` and stride parameters determine which elements in the strided arrays
77
accessed at runtime.
88

99
Indexing is relative to the first index. To introduce an offset, use typed

lib/node_modules/@stdlib/blas/ext/base/dsort2hp/include/stdlib/blas/ext/base/dsort2hp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ extern "C" {
3131
/**
3232
* Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first array using heapsort.
3333
*/
34-
void API_SUFFIX(stdlib_strided_dsort2hp)( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, double *Y, CBLAS_INT strideY );
34+
void API_SUFFIX(stdlib_strided_dsort2hp)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY );
3535

3636
/**
3737
* Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first array using heapsort and alternative indexing semantics.
3838
*/
39-
void API_SUFFIX(stdlib_strided_dsort2hp_ndarray)( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX, double *Y, CBLAS_INT strideY, CBLAS_INT offsetY );
39+
void API_SUFFIX(stdlib_strided_dsort2hp_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
4040

4141
#ifdef __cplusplus
4242
}

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ var ndarray = require( './ndarray.js' );
4141
* @param {PositiveInteger} N - number of indexed elements
4242
* @param {number} order - sort order
4343
* @param {Float64Array} x - first input array
44-
* @param {integer} strideX - `x` stride length
44+
* @param {integer} strideX - stride length for `x`
4545
* @param {Float64Array} y - second input array
46-
* @param {integer} strideY - `y` stride length
46+
* @param {integer} strideY - stride length for `y`
4747
* @returns {Float64Array} `x`
4848
*
4949
* @example
@@ -61,12 +61,8 @@ var ndarray = require( './ndarray.js' );
6161
* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
6262
*/
6363
function dsort2hp( N, order, x, strideX, y, strideY ) {
64-
var offsetX;
65-
var offsetY;
6664

67-
offsetX = stride2offset( N, strideX );
68-
offsetY = stride2offset( N, strideY );
69-
return ndarray( N, order, x, strideX, offsetX, y, strideY, offsetY );
65+
return ndarray( N, order, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) );
7066
}
7167

7268

lib/node_modules/@stdlib/blas/ext/base/dsort2hp/lib/dsort2hp.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ var addon = require( './../src/addon.node' );
3131
* @param {PositiveInteger} N - number of indexed elements
3232
* @param {number} order - sort order
3333
* @param {Float64Array} x - first input array
34-
* @param {integer} strideX - `x` stride length
34+
* @param {integer} strideX - stride length for `x`
3535
* @param {Float64Array} y - second input array
36-
* @param {integer} strideY - `y` stride length
36+
* @param {integer} strideY - stride length for `y`
3737
* @returns {Float64Array} `x`
3838
*
3939
* @example

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ var floor = require( '@stdlib/math/base/special/floor' );
4242
* @param {PositiveInteger} N - number of indexed elements
4343
* @param {number} order - sort order
4444
* @param {Float64Array} x - first input array
45-
* @param {integer} strideX - `x` stride length
46-
* @param {NonNegativeInteger} offsetX - `x` starting index
45+
* @param {integer} strideX - stride length for `x`
46+
* @param {NonNegativeInteger} offsetX - starting index for `x`
4747
* @param {Float64Array} y - second input array
48-
* @param {integer} strideY - `y` stride length
49-
* @param {NonNegativeInteger} offsetY - `y` starting index
48+
* @param {integer} strideY - stride length for `y`
49+
* @param {NonNegativeInteger} offsetY - starting index for `y`
5050
* @returns {Float64Array} `x`
5151
*
5252
* @example

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ var addon = require( './../src/addon.node' );
3131
* @param {PositiveInteger} N - number of indexed elements
3232
* @param {number} order - sort order
3333
* @param {Float64Array} x - first input array
34-
* @param {integer} strideX - `x` stride length
35-
* @param {NonNegativeInteger} offsetX - `x` starting index
34+
* @param {integer} strideX - stride length for `x`
35+
* @param {NonNegativeInteger} offsetX - starting index for `x`
3636
* @param {Float64Array} y - second input array
37-
* @param {integer} strideY - `y` stride length
38-
* @param {NonNegativeInteger} offsetY - `y` starting index
37+
* @param {integer} strideY - stride length for `y`
38+
* @param {NonNegativeInteger} offsetY - starting index for `y`
3939
* @returns {Float64Array} `x`
4040
*
4141
* @example

lib/node_modules/@stdlib/blas/ext/base/dsort2hp/src/main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
* @param N number of indexed elements
4040
* @param order sort order
4141
* @param X first input array
42-
* @param strideX `X` stride length
42+
* @param strideX stride length for `X`
4343
* @param Y second input array
44-
* @param strideY `Y` stride length
44+
* @param strideY stride length for `Y`
4545
*/
46-
void API_SUFFIX(stdlib_strided_dsort2hp)( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, double *Y, CBLAS_INT strideY ) {
46+
void API_SUFFIX(stdlib_strided_dsort2hp)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ) {
4747
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
4848
CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY );
4949
API_SUFFIX(stdlib_strided_dsort2hp_ndarray)( N, order, X, strideX, ox, Y, strideY, oy );
@@ -64,13 +64,13 @@ void API_SUFFIX(stdlib_strided_dsort2hp)( const CBLAS_INT N, const CBLAS_INT ord
6464
* @param N number of indexed elements
6565
* @param order sort order
6666
* @param X first input array
67-
* @param strideX `X` stride length
68-
* @param offsetX `X` starting index
67+
* @param strideX stride length for `X`
68+
* @param offsetX starting index for `X`
6969
* @param Y second input array
70-
* @param strideY `Y` stride length
71-
* @param offsetY `Y` starting index
70+
* @param strideY stride length for `Y`
71+
* @param offsetY starting index for `Y`
7272
*/
73-
void API_SUFFIX(stdlib_strided_dsort2hp_ndarray)( const CBLAS_INT N, const CBLAS_INT order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX, double *Y, CBLAS_INT strideY, CBLAS_INT offsetY ) {
73+
void API_SUFFIX(stdlib_strided_dsort2hp_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
7474
CBLAS_INT parent;
7575
CBLAS_INT child;
7676
CBLAS_INT ix;

0 commit comments

Comments
 (0)