Skip to content

Commit da0f9d5

Browse files
committed
refactor: add requested changes
--- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 4f7cb74 commit da0f9d5

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

lib/node_modules/@stdlib/stats/base/nanvariancech/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,23 @@ The function has the following parameters:
119119
The `N` and stride parameters determine which elements in the stided array are accessed at runtime. For example, to compute the [variance][variance] of every other element in `x`,
120120

121121
```javascript
122-
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN ];
122+
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN, NaN ];
123123

124-
var v = nanvariancech( 4, 1, x, 2 );
124+
var v = nanvariancech( 5, 1, x, 2 );
125125
// returns 6.25
126126
```
127127

128128
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
129129

130-
<!-- eslint-disable stdlib/capitalized-comments -->
130+
<!-- eslint-disable stdlib/capitalized-comments, max-len -->
131131

132132
```javascript
133133
var Float64Array = require( '@stdlib/array/float64' );
134134

135-
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
135+
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
136136
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
137137

138-
var v = nanvariancech( 4, 1, x1, 2 );
138+
var v = nanvariancech( 5, 1, x1, 2 );
139139
// returns 6.25
140140
```
141141

@@ -175,7 +175,7 @@ var v = nanvariancech.ndarray( 5, 1, x, 2, 1 );
175175
- If `n - c` is less than or equal to `0` (where `c` corresponds to the provided degrees of freedom adjustment and `n` corresponds to the number of non-`NaN` indexed elements), both functions return `NaN`.
176176
- The underlying algorithm is a specialized case of Neely's two-pass algorithm. As the variance is invariant with respect to changes in the location parameter, the underlying algorithm uses the first non-`NaN` strided array element as a trial mean to shift subsequent data values and thus mitigate catastrophic cancellation. Accordingly, the algorithm's accuracy is best when data is **unordered** (i.e., the data is **not** sorted in either ascending or descending order such that the first value is an "extreme" value).
177177
- 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]).
178-
- Depending on the environment, the typed versions ([`dnanvariancech`][@stdlib/stats/base/dnanvariancech], [`snanvariancech`][@stdlib/stats/base/snanvariancech], etc.) are likely to be significantly more performant.
178+
- Depending on the environment, the typed versions ([`dnanvariancech`][@stdlib/stats/strided/dnanvariancech], [`snanvariancech`][@stdlib/stats/base/snanvariancech], etc.) are likely to be significantly more performant.
179179

180180
</section>
181181

@@ -234,7 +234,7 @@ console.log( v );
234234

235235
## See Also
236236

237-
- <span class="package-name">[`@stdlib/stats/base/dnanvariancech`][@stdlib/stats/base/dnanvariancech]</span><span class="delimiter">: </span><span class="description">calculate the variance of a double-precision floating-point strided array ignoring NaN values and using a one-pass trial mean algorithm.</span>
237+
- <span class="package-name">[`@stdlib/stats/strided/dnanvariancech`][@stdlib/stats/strided/dnanvariancech]</span><span class="delimiter">: </span><span class="description">calculate the variance of a double-precision floating-point strided array ignoring NaN values and using a one-pass trial mean algorithm.</span>
238238
- <span class="package-name">[`@stdlib/stats/base/nanstdevch`][@stdlib/stats/base/nanstdevch]</span><span class="delimiter">: </span><span class="description">calculate the standard deviation of a strided array ignoring NaN values and using a one-pass trial mean algorithm.</span>
239239
- <span class="package-name">[`@stdlib/stats/base/nanvariance`][@stdlib/stats/base/nanvariance]</span><span class="delimiter">: </span><span class="description">calculate the variance of a strided array ignoring NaN values.</span>
240240
- <span class="package-name">[`@stdlib/stats/base/snanvariancech`][@stdlib/stats/base/snanvariancech]</span><span class="delimiter">: </span><span class="description">calculate the variance of a single-precision floating-point strided array ignoring NaN values and using a one-pass trial mean algorithm.</span>
@@ -264,7 +264,7 @@ console.log( v );
264264

265265
<!-- <related-links> -->
266266

267-
[@stdlib/stats/base/dnanvariancech]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dnanvariancech
267+
[@stdlib/stats/strided/dnanvariancech]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/strided/dnanvariancech
268268

269269
[@stdlib/stats/base/nanstdevch]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/nanstdevch
270270

lib/node_modules/@stdlib/stats/base/nanvariancech/docs/repl.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Computes the variance of a strided array ignoring `NaN` values and using a
44
one-pass trial mean algorithm.
55

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

99
Indexing is relative to the first index. To introduce an offset, use a typed
@@ -50,14 +50,14 @@
5050
~4.3333
5151

5252
// Using `N` and `stride` parameters:
53-
> x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ];
54-
> {{alias}}( 3, 1, x, 2 )
53+
> x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ];
54+
> {{alias}}( 4, 1, x, 2 )
5555
~4.3333
5656

5757
// Using view offsets:
58-
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
58+
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
5959
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
60-
> {{alias}}( 3, 1, x1, 2 )
60+
> {{alias}}( 4, 1, x1, 2 )
6161
~4.3333
6262

6363

@@ -66,8 +66,8 @@
6666
one-pass trial mean algorithm and alternative indexing semantics.
6767

6868
While typed array views mandate a view offset based on the underlying
69-
buffer, the offset parameters support indexing semantics based on a
70-
starting indices.
69+
buffer, the offset parameter supports indexing semantics based on a
70+
starting index.
7171

7272
Parameters
7373
----------
@@ -109,8 +109,8 @@
109109
~4.3333
110110

111111
// Using offset parameter:
112-
> var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ];
113-
> {{alias}}.ndarray( 3, 1, x, 2, 1 )
112+
> var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ];
113+
> {{alias}}.ndarray( 4, 1, x, 2, 1 )
114114
~4.3333
115115

116116
See Also

lib/node_modules/@stdlib/stats/base/nanvariancech/test/test.nanvariancech.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
352352
NaN
353353
];
354354

355-
v = nanvariancech( 4, 1, x, 2 );
355+
v = nanvariancech( 5, 1, x, 2 );
356356

357357
t.strictEqual( v, 6.25, 'returns expected value' );
358358
t.end();
@@ -375,7 +375,7 @@ tape( 'the function supports a `stride` parameter (accessors)', function test( t
375375
NaN
376376
];
377377

378-
v = nanvariancech( 4, 1, toAccessorArray( x ), 2 );
378+
v = nanvariancech( 5, 1, toAccessorArray( x ), 2 );
379379

380380
t.strictEqual( v, 6.25, 'returns expected value' );
381381
t.end();
@@ -486,7 +486,7 @@ tape( 'the function supports view offsets', function test( t ) {
486486

487487
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
488488

489-
v = nanvariancech( 4, 1, x1, 2 );
489+
v = nanvariancech( 5, 1, x1, 2 );
490490
t.strictEqual( v, 6.25, 'returns expected value' );
491491

492492
t.end();

lib/node_modules/@stdlib/stats/base/nanvariancech/test/test.ndarray.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
351351
NaN
352352
];
353353

354-
v = nanvariancech( 4, 1, x, 2, 0 );
354+
v = nanvariancech( 5, 1, x, 2, 0 );
355355

356356
t.strictEqual( v, 6.25, 'returns expected value' );
357357
t.end();
@@ -375,7 +375,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
375375
2.0
376376
];
377377

378-
v = nanvariancech( 4, 1, x, -2, 8 );
378+
v = nanvariancech( 5, 1, x, -2, 8 );
379379
t.strictEqual( v, 6.25, 'returns expected value' );
380380

381381
x = [];
@@ -405,7 +405,7 @@ tape( 'the function supports a `stride` parameter (accessors)', function test( t
405405
NaN
406406
];
407407

408-
v = nanvariancech( 4, 1, toAccessorArray( x ), 2, 0 );
408+
v = nanvariancech( 5, 1, toAccessorArray( x ), 2, 0 );
409409

410410
t.strictEqual( v, 6.25, 'returns expected value' );
411411
t.end();
@@ -429,7 +429,7 @@ tape( 'the function supports a negative `stride` parameter (accessors)', functio
429429
2.0
430430
];
431431

432-
v = nanvariancech( 4, 1, toAccessorArray( x ), -2, 8 );
432+
v = nanvariancech( 5, 1, toAccessorArray( x ), -2, 8 );
433433
t.strictEqual( v, 6.25, 'returns expected value' );
434434

435435
x = [];
@@ -481,7 +481,7 @@ tape( 'the function supports an `offset` parameter', function test( t ) {
481481
NaN // 4
482482
];
483483

484-
v = nanvariancech( 4, 1, x, 2, 1 );
484+
v = nanvariancech( 5, 1, x, 2, 1 );
485485
t.strictEqual( v, 6.25, 'returns expected value' );
486486

487487
t.end();
@@ -504,7 +504,7 @@ tape( 'the function supports an `offset` parameter (accessors)', function test(
504504
NaN // 4
505505
];
506506

507-
v = nanvariancech( 4, 1, toAccessorArray( x ), 2, 1 );
507+
v = nanvariancech( 5, 1, toAccessorArray( x ), 2, 1 );
508508
t.strictEqual( v, 6.25, 'returns expected value' );
509509

510510
t.end();

0 commit comments

Comments
 (0)