Skip to content

Commit 7b7d44c

Browse files
committed
chore: minor clean-up
--- 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: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 2895b9c commit 7b7d44c

File tree

7 files changed

+25
-49
lines changed

7 files changed

+25
-49
lines changed

lib/node_modules/@stdlib/stats/incr/nangmean/README.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,12 @@ limitations under the License.
2626

2727
The [geometric mean][geometric-mean] is defined as the nth root of a product of _n_ numbers.
2828

29-
<!-- <equation class="equation" label="eq:geometric_mean" align="center" raw="\biggl( \prod_{i=0}^{n-1} \biggr)^{\frac{1}{n}} = \sqrt[n]{x_0 x_1 \cdots x_{n-1}}" alt="Equation for the geometric mean."> -->
29+
<!-- <equation class="equation" label="eq:geometric_mean" align="center" raw="\biggl( \prod_{i=0}^{n-1} x_i \biggr)^{\frac{1}{n}} = \sqrt[n]{x_0 x_1 \cdots x_{n-1}}" alt="Equation for the geometric mean."> -->
3030

3131
```math
32-
\biggl( \prod_{i=0}^{n-1} \biggr)^{\frac{1}{n}} = \sqrt[n]{x_0 x_1 \cdots x_{n-1}}
32+
\biggl( \prod_{i=0}^{n-1} x_i \biggr)^{\frac{1}{n}} = \sqrt[n]{x_0 x_1 \cdots x_{n-1}}
3333
```
3434

35-
<!-- <div class="equation" align="center" data-raw-text="\biggl( \prod_{i=0}^{n-1} \biggr)^{\frac{1}{n}} = \sqrt[n]{x_0 x_1 \cdots x_{n-1}}" data-equation="eq:geometric_mean">
36-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@cb802bd5cb07ef925c8a3ce9c34db0fb68040d12/lib/node_modules/@stdlib/stats/incr/gmean/docs/img/equation_geometric_mean.svg" alt="Equation for the geometric mean.">
37-
<br>
38-
</div> -->
3935

4036
<!-- </equation> -->
4137

@@ -103,7 +99,8 @@ prod = accumulator();
10399
<!-- eslint no-undef: "error" -->
104100

105101
```javascript
106-
var randu = require( '@stdlib/random/base/randu' );
102+
var bernoulli = require( '@stdlib/random/base/bernoulli' );
103+
var uniform = require( '@stdlib/random/base/uniform' );
107104
var incrnangmean = require( '@stdlib/stats/incr/nangmean' );
108105

109106
var accumulator;
@@ -115,10 +112,10 @@ accumulator = incrnangmean();
115112

116113
// For each simulated value, update the geometric mean...
117114
for ( i = 0; i < 100; i++ ) {
118-
if ( randu() < 0.2 ) {
115+
if ( bernoulli( 0.2 ) ) {
119116
v = NaN;
120117
} else {
121-
v = ( randu()*100.0 );
118+
v = uniform( 0.0, 100.0 );
122119
}
123120
accumulator( v );
124121
}
@@ -133,15 +130,6 @@ console.log( accumulator() );
133130

134131
<section class="related">
135132

136-
* * *
137-
138-
## See Also
139-
140-
- <span class="package-name">[`@stdlib/stats/incr/hmean`][@stdlib/stats/incr/hmean]</span><span class="delimiter">: </span><span class="description">compute a harmonic mean incrementally.</span>
141-
- <span class="package-name">[`@stdlib/stats/incr/mean`][@stdlib/stats/incr/mean]</span><span class="delimiter">: </span><span class="description">compute an arithmetic mean incrementally.</span>
142-
- <span class="package-name">[`@stdlib/stats/incr/mgmean`][@stdlib/stats/incr/mgmean]</span><span class="delimiter">: </span><span class="description">compute a moving geometric mean incrementally.</span>
143-
- <span class="package-name">[`@stdlib/stats/incr/summary`][@stdlib/stats/incr/summary]</span><span class="delimiter">: </span><span class="description">compute a statistical summary incrementally.</span>
144-
145133
</section>
146134

147135
<!-- /.related -->
@@ -154,14 +142,6 @@ console.log( accumulator() );
154142

155143
<!-- <related-links> -->
156144

157-
[@stdlib/stats/incr/hmean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/hmean
158-
159-
[@stdlib/stats/incr/mean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mean
160-
161-
[@stdlib/stats/incr/mgmean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mgmean
162-
163-
[@stdlib/stats/incr/summary]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/summary
164-
165145
<!-- </related-links> -->
166146

167147
</section>

lib/node_modules/@stdlib/stats/incr/nangmean/docs/types/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
/**
2424
* If provided a value, returns an updated geometric mean; otherwise, returns the current geometric mean.
2525
*
26-
*
2726
* @param x - value
2827
* @returns geometric mean
2928
*/

lib/node_modules/@stdlib/stats/incr/nangmean/examples/index.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,21 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var bernoulli = require( '@stdlib/random/base/bernoulli' );
22+
var uniform = require( '@stdlib/random/base/uniform' );
2223
var incrnangmean = require( './../lib' );
2324

24-
var accumulator;
25-
var prod;
26-
var v;
27-
var i;
28-
2925
// Initialize an accumulator:
30-
accumulator = incrnangmean();
26+
var accumulator = incrnangmean();
3127

3228
// For each simulated value, update the geometric mean...
33-
console.log( '\nValue\tGeometric Mean\n' );
29+
console.log( '\nValue\tGeometric mean\n' );
30+
var prod;
31+
var v;
32+
var i;
3433
for ( i = 0; i < 100; i++ ) {
35-
if ( randu() < 0.2 ) {
36-
v = NaN;
37-
} else {
38-
v = ( randu()*100.0 );
39-
}
34+
v = ( bernoulli( 0.2 ) ) ? NaN : uniform( 0.0, 100.0 );
4035
prod = accumulator( v );
41-
console.log( '%d\t%d', ( v === null) ? NaN : v.toFixed( 4 ), ( prod === null) ? NaN : prod.toFixed( 4 ) );
36+
console.log( '%s\t%s', ( v === v ) ? v.toFixed( 4 ) : 'NaN', ( prod === null ) ? 'null' : prod.toFixed( 4 ) );
4237
}
4338
console.log( '\nFinal geometric mean: %d\n', accumulator() );

lib/node_modules/@stdlib/stats/incr/nangmean/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @module @stdlib/stats/incr/nangmean
2525
*
2626
* @example
27-
* var incrgmean = require( '@stdlib/stats/incr/nangmean' );
27+
* var incrnangmean = require( '@stdlib/stats/incr/nangmean' );
2828
*
2929
* var accumulator = incrnangmean();
3030
*

lib/node_modules/@stdlib/stats/incr/nangmean/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function incrnangmean() {
6464
if ( arguments.length === 0 || isnan( x ) ) {
6565
return gmean();
6666
}
67-
return gmean(x);
67+
return gmean( x );
6868
}
6969
}
7070

lib/node_modules/@stdlib/stats/incr/nangmean/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"types": "./docs/types",
2525
"scripts": {},
26-
"homepage": "https://github.com/stdlib-js/stdlib.git",
26+
"homepage": "https://github.com/stdlib-js/stdlib",
2727
"repository": {
2828
"type": "git",
2929
"url": "git://github.com/stdlib-js/stdlib.git"
@@ -63,6 +63,8 @@
6363
"product",
6464
"prod",
6565
"incremental",
66-
"accumulator"
66+
"accumulator",
67+
"nan",
68+
"ignore"
6769
]
6870
}

lib/node_modules/@stdlib/stats/incr/nangmean/test/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
var tape = require( 'tape' );
2424
var ln = require( '@stdlib/math/base/special/ln' );
2525
var exp = require( '@stdlib/math/base/special/exp' );
26-
var isnan = require( '@stdlib/assert/is-nan' );
26+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var abs = require( '@stdlib/math/base/special/abs' );
2929
var EPSILON = require( '@stdlib/constants/float64/eps' );
3030
var PINF = require( '@stdlib/constants/float64/pinf' );
31-
var incrnangmean = require( '@stdlib/stats/incr/nangmean/lib' );
31+
var incrnangmean = require( './../lib' );
3232

3333

3434
// TESTS //
@@ -69,7 +69,7 @@ tape( 'the accumulator function incrementally computes a geometric mean', functi
6969
if ( !isnan( d ) ) {
7070
prod *= d;
7171
expected = pow( prod, 1.0/(j+1) );
72-
j+=1;
72+
j += 1;
7373
}
7474
actual = acc( d );
7575
if ( actual === expected ) {
@@ -136,7 +136,7 @@ tape( 'if provided a `NaN`, the accumulator function ignores it', function test(
136136
t.strictEqual( acc(), 5.0, 'returns expected value' );
137137

138138
acc( NaN );
139-
t.strictEqual( isnan( acc() ), false, 'does not returns NaN' );
139+
t.strictEqual( isnan( acc() ), false, 'does not return NaN' );
140140

141141
acc( 3.14 );
142142
t.strictEqual( acc(), exp( ( ln( 5.0 ) + ln( 3.14 ) ) / 2 ), 'correctly updates after NaN');

0 commit comments

Comments
 (0)