@stdlib/stats-iter-cugmean 0.0.2 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +45 -4
- package/lib/main.js +9 -11
- package/package.json +2 -3
- package/CHANGELOG.md +0 -5
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2022 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
# itercugmean
|
|
22
22
|
|
|
23
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
|
|
23
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
24
24
|
|
|
25
25
|
> Create an [iterator][mdn-iterator-protocol] which iteratively computes a cumulative [geometric mean][geometric-mean].
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ The [geometric mean][geometric-mean] is defined as the nth root of a product of
|
|
|
31
31
|
<!-- <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."> -->
|
|
32
32
|
|
|
33
33
|
<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">
|
|
34
|
-
<img src="https://cdn.
|
|
34
|
+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@b38de7dff069561da1cb4710c85fc74433b7eaaa/lib/node_modules/@stdlib/stats/iter/cugmean/docs/img/equation_geometric_mean.svg" alt="Equation for the geometric mean.">
|
|
35
35
|
<br>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
@@ -149,6 +149,21 @@ while ( true ) {
|
|
|
149
149
|
|
|
150
150
|
<!-- /.references -->
|
|
151
151
|
|
|
152
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
153
|
+
|
|
154
|
+
<section class="related">
|
|
155
|
+
|
|
156
|
+
* * *
|
|
157
|
+
|
|
158
|
+
## See Also
|
|
159
|
+
|
|
160
|
+
- <span class="package-name">[`@stdlib/stats/iter/cuhmean`][@stdlib/stats/iter/cuhmean]</span><span class="delimiter">: </span><span class="description">create an iterator which iteratively computes a cumulative harmonic mean.</span>
|
|
161
|
+
- <span class="package-name">[`@stdlib/stats/iter/cumean`][@stdlib/stats/iter/cumean]</span><span class="delimiter">: </span><span class="description">create an iterator which iteratively computes a cumulative arithmetic mean.</span>
|
|
162
|
+
|
|
163
|
+
</section>
|
|
164
|
+
|
|
165
|
+
<!-- /.related -->
|
|
166
|
+
|
|
152
167
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
153
168
|
|
|
154
169
|
|
|
@@ -162,6 +177,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
|
|
|
162
177
|
|
|
163
178
|
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
164
179
|
|
|
180
|
+
#### Community
|
|
181
|
+
|
|
182
|
+
[![Chat][chat-image]][chat-url]
|
|
183
|
+
|
|
165
184
|
---
|
|
166
185
|
|
|
167
186
|
## License
|
|
@@ -171,7 +190,7 @@ See [LICENSE][stdlib-license].
|
|
|
171
190
|
|
|
172
191
|
## Copyright
|
|
173
192
|
|
|
174
|
-
Copyright © 2016-
|
|
193
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
175
194
|
|
|
176
195
|
</section>
|
|
177
196
|
|
|
@@ -190,9 +209,23 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
190
209
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-iter-cugmean/main.svg
|
|
191
210
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-iter-cugmean?branch=main
|
|
192
211
|
|
|
193
|
-
|
|
212
|
+
<!--
|
|
213
|
+
|
|
214
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/stats-iter-cugmean.svg
|
|
194
215
|
[dependencies-url]: https://david-dm.org/stdlib-js/stats-iter-cugmean/main
|
|
195
216
|
|
|
217
|
+
-->
|
|
218
|
+
|
|
219
|
+
[umd]: https://github.com/umdjs/umd
|
|
220
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
221
|
+
|
|
222
|
+
[deno-url]: https://github.com/stdlib-js/stats-iter-cugmean/tree/deno
|
|
223
|
+
[umd-url]: https://github.com/stdlib-js/stats-iter-cugmean/tree/umd
|
|
224
|
+
[esm-url]: https://github.com/stdlib-js/stats-iter-cugmean/tree/esm
|
|
225
|
+
|
|
226
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
227
|
+
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
228
|
+
|
|
196
229
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
197
230
|
|
|
198
231
|
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
@@ -203,6 +236,14 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
203
236
|
|
|
204
237
|
[mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
|
|
205
238
|
|
|
239
|
+
<!-- <related-links> -->
|
|
240
|
+
|
|
241
|
+
[@stdlib/stats/iter/cuhmean]: https://www.npmjs.com/package/@stdlib/stats-iter-cuhmean
|
|
242
|
+
|
|
243
|
+
[@stdlib/stats/iter/cumean]: https://www.npmjs.com/package/@stdlib/stats-iter-cumean
|
|
244
|
+
|
|
245
|
+
<!-- </related-links> -->
|
|
246
|
+
|
|
206
247
|
</section>
|
|
207
248
|
|
|
208
249
|
<!-- /.links -->
|
package/lib/main.js
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
24
24
|
var isIteratorLike = require( '@stdlib/assert-is-iterator-like' );
|
|
25
25
|
var isFunction = require( '@stdlib/assert-is-function' );
|
|
26
|
-
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
27
26
|
var iteratorSymbol = require( '@stdlib/symbol-iterator' );
|
|
28
27
|
var incrgmean = require( '@stdlib/stats-incr-gmean' );
|
|
29
28
|
|
|
@@ -84,27 +83,26 @@ function itercugmean( iterator ) {
|
|
|
84
83
|
* @returns {Object} iterator protocol-compliant object
|
|
85
84
|
*/
|
|
86
85
|
function next() {
|
|
87
|
-
var out;
|
|
88
86
|
var v;
|
|
89
87
|
if ( FLG ) {
|
|
90
88
|
return {
|
|
91
89
|
'done': true
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
|
-
out = {};
|
|
95
92
|
v = iterator.next();
|
|
96
|
-
if ( typeof v.value === 'number' ) {
|
|
97
|
-
out.value = acc( v.value );
|
|
98
|
-
} else if ( hasOwnProp( v, 'value' ) ) {
|
|
99
|
-
out.value = acc( NaN );
|
|
100
|
-
}
|
|
101
93
|
if ( v.done ) {
|
|
102
94
|
FLG = true;
|
|
103
|
-
|
|
95
|
+
return v;
|
|
96
|
+
}
|
|
97
|
+
if ( typeof v.value === 'number' ) {
|
|
98
|
+
v = acc( v.value );
|
|
104
99
|
} else {
|
|
105
|
-
|
|
100
|
+
v = acc( NaN );
|
|
106
101
|
}
|
|
107
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
'value': v,
|
|
104
|
+
'done': false
|
|
105
|
+
};
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-iter-cugmean",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Create an iterator which iteratively computes a cumulative geometric mean.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"examples": "make examples",
|
|
29
29
|
"benchmark": "make benchmark"
|
|
30
30
|
},
|
|
31
|
-
"homepage": "https://
|
|
31
|
+
"homepage": "https://stdlib.io",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
34
|
"url": "git://github.com/stdlib-js/stats-iter-cugmean.git"
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/assert-has-own-property": "^0.0.x",
|
|
41
40
|
"@stdlib/assert-is-function": "^0.0.x",
|
|
42
41
|
"@stdlib/assert-is-iterator-like": "^0.0.x",
|
|
43
42
|
"@stdlib/stats-incr-gmean": "^0.0.x",
|