@stdlib/simulate-iter-awln 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 +46 -5
- package/lib/main.js +9 -10
- package/package.json +2 -2
- 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
|
# iterawln
|
|
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 introduces additive white Laplacian noise (AWLN).
|
|
26
26
|
|
|
@@ -212,6 +212,21 @@ while ( true ) {
|
|
|
212
212
|
|
|
213
213
|
<!-- /.references -->
|
|
214
214
|
|
|
215
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
216
|
+
|
|
217
|
+
<section class="related">
|
|
218
|
+
|
|
219
|
+
* * *
|
|
220
|
+
|
|
221
|
+
## See Also
|
|
222
|
+
|
|
223
|
+
- <span class="package-name">[`@stdlib/simulate/iter/awgn`][@stdlib/simulate/iter/awgn]</span><span class="delimiter">: </span><span class="description">create an iterator which introduces additive white Gaussian noise.</span>
|
|
224
|
+
- <span class="package-name">[`@stdlib/simulate/iter/awun`][@stdlib/simulate/iter/awun]</span><span class="delimiter">: </span><span class="description">create an iterator which introduces additive white uniform noise.</span>
|
|
225
|
+
|
|
226
|
+
</section>
|
|
227
|
+
|
|
228
|
+
<!-- /.related -->
|
|
229
|
+
|
|
215
230
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
216
231
|
|
|
217
232
|
|
|
@@ -225,6 +240,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
|
|
|
225
240
|
|
|
226
241
|
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].
|
|
227
242
|
|
|
243
|
+
#### Community
|
|
244
|
+
|
|
245
|
+
[![Chat][chat-image]][chat-url]
|
|
246
|
+
|
|
228
247
|
---
|
|
229
248
|
|
|
230
249
|
## License
|
|
@@ -234,7 +253,7 @@ See [LICENSE][stdlib-license].
|
|
|
234
253
|
|
|
235
254
|
## Copyright
|
|
236
255
|
|
|
237
|
-
Copyright © 2016-
|
|
256
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
238
257
|
|
|
239
258
|
</section>
|
|
240
259
|
|
|
@@ -253,9 +272,23 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
253
272
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/simulate-iter-awln/main.svg
|
|
254
273
|
[coverage-url]: https://codecov.io/github/stdlib-js/simulate-iter-awln?branch=main
|
|
255
274
|
|
|
256
|
-
|
|
275
|
+
<!--
|
|
276
|
+
|
|
277
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/simulate-iter-awln.svg
|
|
257
278
|
[dependencies-url]: https://david-dm.org/stdlib-js/simulate-iter-awln/main
|
|
258
279
|
|
|
280
|
+
-->
|
|
281
|
+
|
|
282
|
+
[umd]: https://github.com/umdjs/umd
|
|
283
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
284
|
+
|
|
285
|
+
[deno-url]: https://github.com/stdlib-js/simulate-iter-awln/tree/deno
|
|
286
|
+
[umd-url]: https://github.com/stdlib-js/simulate-iter-awln/tree/umd
|
|
287
|
+
[esm-url]: https://github.com/stdlib-js/simulate-iter-awln/tree/esm
|
|
288
|
+
|
|
289
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
290
|
+
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
291
|
+
|
|
259
292
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
260
293
|
|
|
261
294
|
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
@@ -264,9 +297,17 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
264
297
|
|
|
265
298
|
[mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
|
|
266
299
|
|
|
267
|
-
[@stdlib/array/uint32]: https://
|
|
300
|
+
[@stdlib/array/uint32]: https://www.npmjs.com/package/@stdlib/array-uint32
|
|
301
|
+
|
|
302
|
+
[@stdlib/random/base/mt19937]: https://www.npmjs.com/package/@stdlib/random-base-mt19937
|
|
303
|
+
|
|
304
|
+
<!-- <related-links> -->
|
|
305
|
+
|
|
306
|
+
[@stdlib/simulate/iter/awgn]: https://www.npmjs.com/package/@stdlib/simulate-iter-awgn
|
|
307
|
+
|
|
308
|
+
[@stdlib/simulate/iter/awun]: https://www.npmjs.com/package/@stdlib/simulate-iter-awun
|
|
268
309
|
|
|
269
|
-
|
|
310
|
+
<!-- </related-links> -->
|
|
270
311
|
|
|
271
312
|
</section>
|
|
272
313
|
|
package/lib/main.js
CHANGED
|
@@ -240,27 +240,26 @@ function iterawln( iterator, sigma, options ) {
|
|
|
240
240
|
* @returns {Object} iterator protocol-compliant object
|
|
241
241
|
*/
|
|
242
242
|
function next() {
|
|
243
|
-
var out;
|
|
244
243
|
var v;
|
|
245
244
|
if ( FLG ) {
|
|
246
245
|
return {
|
|
247
246
|
'done': true
|
|
248
247
|
};
|
|
249
248
|
}
|
|
250
|
-
out = {};
|
|
251
249
|
v = iterator.next();
|
|
252
|
-
if ( typeof v.value === 'number' ) {
|
|
253
|
-
out.value = v.value + rlaplace();
|
|
254
|
-
} else if ( hasOwnProp( v, 'value' ) ) {
|
|
255
|
-
out.value = NaN;
|
|
256
|
-
}
|
|
257
250
|
if ( v.done ) {
|
|
258
251
|
FLG = true;
|
|
259
|
-
|
|
252
|
+
return v;
|
|
253
|
+
}
|
|
254
|
+
if ( typeof v.value === 'number' ) {
|
|
255
|
+
v = v.value + rlaplace();
|
|
260
256
|
} else {
|
|
261
|
-
|
|
257
|
+
v = NaN;
|
|
262
258
|
}
|
|
263
|
-
return
|
|
259
|
+
return {
|
|
260
|
+
'value': v,
|
|
261
|
+
'done': false
|
|
262
|
+
};
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/simulate-iter-awln",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Create an iterator which introduces additive white Laplacian noise.",
|
|
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/simulate-iter-awln.git"
|