Skip to content

Commit cf73747

Browse files
committed
refactor: update to follow current project conventions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 41cf529 commit cf73747

File tree

6 files changed

+57
-200
lines changed

6 files changed

+57
-200
lines changed

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

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var gsort2hp = require( '@stdlib/blas/ext/base/gsort2hp' );
3232

3333
#### gsort2hp( N, order, x, strideX, y, strideY )
3434

35-
Simultaneously sorts two strided arrays based on the sort order of the first array `x` using heapsort.
35+
Simultaneously sorts two strided arrays based on the sort order of the first array using heapsort.
3636

3737
```javascript
3838
var x = [ 1.0, -2.0, 3.0, -4.0 ];
@@ -52,20 +52,17 @@ The function has the following parameters:
5252
- **N**: number of indexed elements.
5353
- **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.
5454
- **x**: first input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
55-
- **strideX**: `x` index increment.
55+
- **strideX**: stride length for `x`.
5656
- **y**: second input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
57-
- **strideY**: `y` index increment.
57+
- **strideY**: stride length for `y`.
5858

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

6161
```javascript
62-
var floor = require( '@stdlib/math/base/special/floor' );
63-
6462
var x = [ 1.0, -2.0, 3.0, -4.0 ];
6563
var y = [ 0.0, 1.0, 2.0, 3.0 ];
66-
var N = floor( x.length / 2 );
6764

68-
gsort2hp( N, -1.0, x, 2, y, 2 );
65+
gsort2hp( 2, -1.0, x, 2, y, 2 );
6966

7067
console.log( x );
7168
// => [ 3.0, -2.0, 1.0, -4.0 ]
@@ -78,7 +75,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [
7875

7976
```javascript
8077
var Float64Array = require( '@stdlib/array/float64' );
81-
var floor = require( '@stdlib/math/base/special/floor' );
8278

8379
// Initial arrays...
8480
var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
@@ -87,10 +83,9 @@ var y0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
8783
// Create offset views...
8884
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
8985
var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
90-
var N = floor( x0.length/2 );
9186

9287
// Sort every other element...
93-
gsort2hp( N, -1.0, x1, 2, y1, 2 );
88+
gsort2hp( 2, -1.0, x1, 2, y1, 2 );
9489

9590
console.log( x0 );
9691
// => <Float64Array>[ 1.0, 4.0, 3.0, 2.0 ]
@@ -101,7 +96,7 @@ console.log( y0 );
10196

10297
#### gsort2hp.ndarray( N, order, x, strideX, offsetX, y, strideY, offsetY )
10398

104-
Simultaneously sorts two strided arrays based on the sort order of the first array `x` using heapsort and alternative indexing semantics.
99+
Simultaneously sorts two strided arrays based on the sort order of the first array using heapsort and alternative indexing semantics.
105100

106101
```javascript
107102
var x = [ 1.0, -2.0, 3.0, -4.0 ];
@@ -118,10 +113,10 @@ console.log( y );
118113

119114
The function has the following additional parameters:
120115

121-
- **offsetX**: `x` starting index.
122-
- **offsetY**: `y` starting index.
116+
- **offsetX**: starting index for `x`.
117+
- **offsetY**: starting index for `y`.
123118

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 of `x`
119+
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:
125120

126121
```javascript
127122
var x = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ];
@@ -164,30 +159,15 @@ console.log( y );
164159
<!-- eslint no-undef: "error" -->
165160

166161
```javascript
167-
var round = require( '@stdlib/math/base/special/round' );
168-
var randu = require( '@stdlib/random/base/randu' );
169-
var Float64Array = require( '@stdlib/array/float64' );
162+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
170163
var gsort2hp = require( '@stdlib/blas/ext/base/gsort2hp' );
171164

172-
var rand;
173-
var sign;
174-
var x;
175-
var y;
176-
var i;
177-
178-
x = new Float64Array( 10 );
179-
y = new Float64Array( 10 ); // index array
180-
for ( i = 0; i < x.length; i++ ) {
181-
rand = round( randu()*100.0 );
182-
sign = randu();
183-
if ( sign < 0.5 ) {
184-
sign = -1.0;
185-
} else {
186-
sign = 1.0;
187-
}
188-
x[ i ] = sign * rand;
189-
y[ i ] = i;
190-
}
165+
var x = discreteUniform( 10, -100, 100, {
166+
'dtype': 'float64'
167+
});
168+
var y = discreteUniform( 10, -100, 100, {
169+
'dtype': 'float64'
170+
});
191171
console.log( x );
192172
console.log( y );
193173

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Simultaneously sorts two strided arrays based on the sort order of the first
44
array using heapsort.
55

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

99
Indexing is relative to the first index. To introduce an offset, use typed
1010
array views.
@@ -41,13 +41,13 @@
4141
First input array.
4242

4343
strideX: integer
44-
Index increment for `x`.
44+
Stride length for `x`.
4545

4646
y: Array<number>|TypedArray
4747
Second input array.
4848

4949
strideY: integer
50-
Index increment for `y`.
50+
Stride length for `y`.
5151

5252
Returns
5353
-------
@@ -64,11 +64,10 @@
6464
> y
6565
[ 3.0, 1.0, 0.0, 2.0 ]
6666

67-
// Using `N` and `stride` parameters:
67+
// Using `N` and stride parameters:
6868
> x = [ 1.0, -2.0, 3.0, -4.0 ];
6969
> y = [ 0.0, 1.0, 2.0, 3.0 ];
70-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
71-
> {{alias}}( N, -1, x, 2, y, 2 )
70+
> {{alias}}( 2, -1, x, 2, y, 2 )
7271
[ 3.0, -2.0, 1.0, -4.0 ]
7372
> y
7473
[ 2.0, 1.0, 0.0, 3.0 ]
@@ -78,21 +77,21 @@
7877
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
7978
> var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
8079
> var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 );
81-
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
82-
> {{alias}}( N, 1, x1, 2, y1, 2 )
80+
> {{alias}}( 2, 1, x1, 2, y1, 2 )
8381
<Float64Array>[ -4.0, 3.0, -2.0 ]
8482
> x0
8583
<Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
8684
> y0
8785
<Float64Array>[ 0.0, 3.0, 2.0, 1.0 ]
8886

87+
8988
{{alias}}.ndarray( N, order, x, strideX, offsetX, y, strideY, offsetY )
9089
Simultaneously sorts two strided arrays based on the sort order of the first
9190
array using heapsort and alternative indexing semantics.
9291

9392
While typed array views mandate a view offset based on the underlying
94-
buffer, the `offset` parameter supports indexing semantics based on a
95-
starting index.
93+
buffer, the offset parameters support indexing semantics based on starting
94+
indices.
9695

9796
Parameters
9897
----------
@@ -107,7 +106,7 @@
107106
First input array.
108107

109108
strideX: integer
110-
Index increment for `x`.
109+
Stride length for `x`.
111110

112111
offsetX: integer
113112
Starting index of `x`.
@@ -116,7 +115,7 @@
116115
Second input array.
117116

118117
strideY: integer
119-
Index increment for `y`.
118+
Stride length for `y`.
120119

121120
offsetY: integer
122121
Starting index of `y`.
@@ -139,8 +138,7 @@
139138
// Using an index offset:
140139
> x = [ 1.0, -2.0, 3.0, -4.0 ];
141140
> y = [ 0.0, 1.0, 2.0, 3.0 ];
142-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
143-
> {{alias}}.ndarray( N, 1, x, 2, 1, y, 2, 1 )
141+
> {{alias}}.ndarray( 2, 1, x, 2, 1, y, 2, 1 )
144142
[ 1.0, -4.0, 3.0, -2.0 ]
145143
> y
146144
[ 0.0, 3.0, 2.0, 1.0 ]

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ interface Routine {
3232
* @param N - number of indexed elements
3333
* @param order - sort order
3434
* @param x - first input array
35-
* @param strideX - `x` stride length
35+
* @param strideX - stride length for `x`
3636
* @param y - second input array
37-
* @param strideY - `y` stride length
37+
* @param strideY - stride length for `x`
3838
* @returns `x`
3939
*
4040
* @example
@@ -57,11 +57,11 @@ interface Routine {
5757
* @param N - number of indexed elements
5858
* @param order - sort order
5959
* @param x - first input array
60-
* @param strideX - `x` stride length
61-
* @param offsetX - `x` starting index
60+
* @param strideX - stride length for `x`
61+
* @param offsetX - starting index for `x`
6262
* @param y - second input array
63-
* @param strideY - `y` stride length
64-
* @param offsetY - `y` starting index
63+
* @param strideY - stride length for `x`
64+
* @param offsetY - starting index for `y`
6565
* @returns `x`
6666
*
6767
* @example
@@ -85,9 +85,9 @@ interface Routine {
8585
* @param N - number of indexed elements
8686
* @param order - sort order
8787
* @param x - first input array
88-
* @param strideX - `x` stride length
88+
* @param strideX - stride length for `x`
8989
* @param y - second input array
90-
* @param strideY - `y` stride length
90+
* @param strideY - stride length for `x`
9191
* @returns `x`
9292
*
9393
* @example

lib/node_modules/@stdlib/blas/ext/base/gsort2hp/examples/index.js

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,15 @@
1818

1919
'use strict';
2020

21-
var round = require( '@stdlib/math/base/special/round' );
22-
var randu = require( '@stdlib/random/base/randu' );
23-
var Float64Array = require( '@stdlib/array/float64' );
24-
var gsort2hp = require( './../lib' );
21+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var gsort2hp = require( '@stdlib/blas/ext/base/gsort2hp' );
2523

26-
var rand;
27-
var sign;
28-
var x;
29-
var y;
30-
var i;
31-
32-
x = new Float64Array( 10 );
33-
y = new Float64Array( 10 ); // index array
34-
for ( i = 0; i < x.length; i++ ) {
35-
if ( randu() < 0.2 ) {
36-
x[ i ] = NaN;
37-
} else {
38-
rand = round( randu()*100.0 );
39-
sign = randu();
40-
if ( sign < 0.5 ) {
41-
sign = -1.0;
42-
} else {
43-
sign = 1.0;
44-
}
45-
x[ i ] = sign * rand;
46-
}
47-
y[ i ] = i;
48-
}
24+
var x = discreteUniform( 10, -100, 100, {
25+
'dtype': 'float64'
26+
});
27+
var y = discreteUniform( 10, -100, 100, {
28+
'dtype': 'float64'
29+
});
4930
console.log( x );
5031
console.log( y );
5132

0 commit comments

Comments
 (0)