@ohos-ports/stdlib-simulate 0.4.1-beta.0
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/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +188 -0
- package/SECURITY.md +5 -0
- package/docs/types/index.d.ts +43 -0
- package/iter/README.md +142 -0
- package/iter/awgn/README.md +240 -0
- package/iter/awgn/docs/repl.txt +85 -0
- package/iter/awgn/docs/types/index.d.ts +155 -0
- package/iter/awgn/docs/types/test.ts +150 -0
- package/iter/awgn/lib/defaults.js +38 -0
- package/iter/awgn/lib/index.js +55 -0
- package/iter/awgn/lib/main.js +278 -0
- package/iter/awgn/package.json +68 -0
- package/iter/awln/README.md +238 -0
- package/iter/awln/docs/repl.txt +85 -0
- package/iter/awln/docs/types/index.d.ts +155 -0
- package/iter/awln/docs/types/test.ts +150 -0
- package/iter/awln/lib/defaults.js +38 -0
- package/iter/awln/lib/index.js +55 -0
- package/iter/awln/lib/main.js +299 -0
- package/iter/awln/package.json +72 -0
- package/iter/awun/README.md +238 -0
- package/iter/awun/docs/repl.txt +85 -0
- package/iter/awun/docs/types/index.d.ts +155 -0
- package/iter/awun/docs/types/test.ts +150 -0
- package/iter/awun/lib/defaults.js +38 -0
- package/iter/awun/lib/index.js +55 -0
- package/iter/awun/lib/main.js +305 -0
- package/iter/awun/package.json +68 -0
- package/iter/bartlett-hann-pulse/README.md +331 -0
- package/iter/bartlett-hann-pulse/docs/img/equation_bartlett_hann_pulse_waveform.svg +191 -0
- package/iter/bartlett-hann-pulse/docs/repl.txt +54 -0
- package/iter/bartlett-hann-pulse/docs/types/index.d.ts +105 -0
- package/iter/bartlett-hann-pulse/docs/types/test.ts +89 -0
- package/iter/bartlett-hann-pulse/lib/index.js +54 -0
- package/iter/bartlett-hann-pulse/lib/main.js +192 -0
- package/iter/bartlett-hann-pulse/lib/validate.js +97 -0
- package/iter/bartlett-hann-pulse/package.json +76 -0
- package/iter/bartlett-pulse/README.md +328 -0
- package/iter/bartlett-pulse/docs/img/equation_bartlett_pulse_waveform.svg +128 -0
- package/iter/bartlett-pulse/docs/repl.txt +54 -0
- package/iter/bartlett-pulse/docs/types/index.d.ts +105 -0
- package/iter/bartlett-pulse/docs/types/test.ts +89 -0
- package/iter/bartlett-pulse/lib/index.js +54 -0
- package/iter/bartlett-pulse/lib/main.js +169 -0
- package/iter/bartlett-pulse/lib/validate.js +97 -0
- package/iter/bartlett-pulse/package.json +72 -0
- package/iter/cosine-wave/README.md +292 -0
- package/iter/cosine-wave/docs/img/equation_cosine_waveform.svg +55 -0
- package/iter/cosine-wave/docs/repl.txt +51 -0
- package/iter/cosine-wave/docs/types/index.d.ts +96 -0
- package/iter/cosine-wave/docs/types/test.ts +78 -0
- package/iter/cosine-wave/lib/index.js +54 -0
- package/iter/cosine-wave/lib/main.js +156 -0
- package/iter/cosine-wave/lib/validate.js +90 -0
- package/iter/cosine-wave/package.json +70 -0
- package/iter/dirac-comb/README.md +278 -0
- package/iter/dirac-comb/docs/img/equation_dirac_comb.svg +44 -0
- package/iter/dirac-comb/docs/repl.txt +48 -0
- package/iter/dirac-comb/docs/types/index.d.ts +89 -0
- package/iter/dirac-comb/docs/types/test.ts +78 -0
- package/iter/dirac-comb/lib/index.js +54 -0
- package/iter/dirac-comb/lib/main.js +152 -0
- package/iter/dirac-comb/lib/validate.js +82 -0
- package/iter/dirac-comb/package.json +72 -0
- package/iter/docs/types/index.d.ts +678 -0
- package/iter/docs/types/test.ts +29 -0
- package/iter/flat-top-pulse/README.md +330 -0
- package/iter/flat-top-pulse/docs/img/equation_flat_top_pulse_waveform.svg +177 -0
- package/iter/flat-top-pulse/docs/repl.txt +54 -0
- package/iter/flat-top-pulse/docs/types/index.d.ts +105 -0
- package/iter/flat-top-pulse/docs/types/test.ts +89 -0
- package/iter/flat-top-pulse/lib/index.js +54 -0
- package/iter/flat-top-pulse/lib/main.js +193 -0
- package/iter/flat-top-pulse/lib/validate.js +97 -0
- package/iter/flat-top-pulse/package.json +71 -0
- package/iter/hann-pulse/README.md +328 -0
- package/iter/hann-pulse/docs/img/equation_hann_pulse_waveform.svg +129 -0
- package/iter/hann-pulse/docs/repl.txt +54 -0
- package/iter/hann-pulse/docs/types/index.d.ts +105 -0
- package/iter/hann-pulse/docs/types/test.ts +89 -0
- package/iter/hann-pulse/lib/index.js +54 -0
- package/iter/hann-pulse/lib/main.js +171 -0
- package/iter/hann-pulse/lib/validate.js +97 -0
- package/iter/hann-pulse/package.json +72 -0
- package/iter/lanczos-pulse/README.md +325 -0
- package/iter/lanczos-pulse/docs/img/equation_lanczos_pulse_waveform.svg +122 -0
- package/iter/lanczos-pulse/docs/repl.txt +54 -0
- package/iter/lanczos-pulse/docs/types/index.d.ts +105 -0
- package/iter/lanczos-pulse/docs/types/test.ts +89 -0
- package/iter/lanczos-pulse/lib/index.js +54 -0
- package/iter/lanczos-pulse/lib/main.js +169 -0
- package/iter/lanczos-pulse/lib/validate.js +97 -0
- package/iter/lanczos-pulse/package.json +70 -0
- package/iter/lib/index.js +186 -0
- package/iter/package.json +63 -0
- package/iter/periodic-sinc/README.md +301 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc.svg +146 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_in_terms_of_period.svg +164 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_in_terms_of_sinc_function.svg +65 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_substitution_even.svg +34 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_substitution_odd.svg +34 -0
- package/iter/periodic-sinc/docs/repl.txt +54 -0
- package/iter/periodic-sinc/docs/types/index.d.ts +98 -0
- package/iter/periodic-sinc/docs/types/test.ts +102 -0
- package/iter/periodic-sinc/lib/index.js +50 -0
- package/iter/periodic-sinc/lib/main.js +241 -0
- package/iter/periodic-sinc/lib/validate.js +90 -0
- package/iter/periodic-sinc/package.json +70 -0
- package/iter/pulse/README.md +322 -0
- package/iter/pulse/docs/img/equation_pulse_waveform.svg +115 -0
- package/iter/pulse/docs/repl.txt +58 -0
- package/iter/pulse/docs/types/index.d.ts +109 -0
- package/iter/pulse/docs/types/test.ts +100 -0
- package/iter/pulse/lib/index.js +54 -0
- package/iter/pulse/lib/main.js +165 -0
- package/iter/pulse/lib/validate.js +105 -0
- package/iter/pulse/package.json +69 -0
- package/iter/sawtooth-wave/README.md +289 -0
- package/iter/sawtooth-wave/docs/img/equation_sawtooth_waveform.svg +73 -0
- package/iter/sawtooth-wave/docs/repl.txt +51 -0
- package/iter/sawtooth-wave/docs/types/index.d.ts +96 -0
- package/iter/sawtooth-wave/docs/types/test.ts +78 -0
- package/iter/sawtooth-wave/lib/index.js +54 -0
- package/iter/sawtooth-wave/lib/main.js +161 -0
- package/iter/sawtooth-wave/lib/validate.js +90 -0
- package/iter/sawtooth-wave/package.json +67 -0
- package/iter/sine-wave/README.md +292 -0
- package/iter/sine-wave/docs/img/equation_sine_waveform.svg +55 -0
- package/iter/sine-wave/docs/repl.txt +51 -0
- package/iter/sine-wave/docs/types/index.d.ts +96 -0
- package/iter/sine-wave/docs/types/test.ts +78 -0
- package/iter/sine-wave/lib/index.js +54 -0
- package/iter/sine-wave/lib/main.js +156 -0
- package/iter/sine-wave/lib/validate.js +90 -0
- package/iter/sine-wave/package.json +70 -0
- package/iter/square-wave/README.md +291 -0
- package/iter/square-wave/docs/img/equation_square_waveform.svg +115 -0
- package/iter/square-wave/docs/repl.txt +55 -0
- package/iter/square-wave/docs/types/index.d.ts +105 -0
- package/iter/square-wave/docs/types/test.ts +89 -0
- package/iter/square-wave/lib/index.js +54 -0
- package/iter/square-wave/lib/main.js +156 -0
- package/iter/square-wave/lib/validate.js +99 -0
- package/iter/square-wave/package.json +67 -0
- package/iter/triangle-wave/README.md +289 -0
- package/iter/triangle-wave/docs/img/equation_triangle_waveform.svg +75 -0
- package/iter/triangle-wave/docs/repl.txt +51 -0
- package/iter/triangle-wave/docs/types/index.d.ts +96 -0
- package/iter/triangle-wave/docs/types/test.ts +78 -0
- package/iter/triangle-wave/lib/index.js +54 -0
- package/iter/triangle-wave/lib/main.js +160 -0
- package/iter/triangle-wave/lib/validate.js +90 -0
- package/iter/triangle-wave/package.json +66 -0
- package/lib/index.js +51 -0
- package/package.json +72 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/* eslint-disable max-lines */
|
|
22
|
+
|
|
23
|
+
import iterawgn = require( './../../../iter/awgn' );
|
|
24
|
+
import iterawln = require( './../../../iter/awln' );
|
|
25
|
+
import iterawun = require( './../../../iter/awun' );
|
|
26
|
+
import iterBartlettHannPulse = require( './../../../iter/bartlett-hann-pulse' );
|
|
27
|
+
import iterBartlettPulse = require( './../../../iter/bartlett-pulse' );
|
|
28
|
+
import iterCosineWave = require( './../../../iter/cosine-wave' );
|
|
29
|
+
import iterDiracComb = require( './../../../iter/dirac-comb' );
|
|
30
|
+
import iterFlatTopPulse = require( './../../../iter/flat-top-pulse' );
|
|
31
|
+
import iterHannPulse = require( './../../../iter/hann-pulse' );
|
|
32
|
+
import iterLanczosPulse = require( './../../../iter/lanczos-pulse' );
|
|
33
|
+
import iterPeriodicSinc = require( './../../../iter/periodic-sinc' );
|
|
34
|
+
import iterPulse = require( './../../../iter/pulse' );
|
|
35
|
+
import iterSawtoothWave = require( './../../../iter/sawtooth-wave' );
|
|
36
|
+
import iterSineWave = require( './../../../iter/sine-wave' );
|
|
37
|
+
import iterSquareWave = require( './../../../iter/square-wave' );
|
|
38
|
+
import iterTriangleWave = require( './../../../iter/triangle-wave' );
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Interface describing the `iter` namespace.
|
|
42
|
+
*/
|
|
43
|
+
interface Namespace {
|
|
44
|
+
/**
|
|
45
|
+
* Returns an iterator which introduces additive white Gaussian noise with standard deviation `sigma`.
|
|
46
|
+
*
|
|
47
|
+
* @param iterator - input iterator
|
|
48
|
+
* @param sigma - standard deviation of the noise
|
|
49
|
+
* @param options - function options
|
|
50
|
+
* @param options.prng - pseudorandom number generator for generating pseudorandom numbers drawn from a standard normal distribution
|
|
51
|
+
* @param options.state - pseudorandom number generator state
|
|
52
|
+
* @param options.seed - pseudorandom number generator seed
|
|
53
|
+
* @param options.copy - boolean indicating whether to copy a provided pseudorandom number generator state (default: true)
|
|
54
|
+
* @throws `sigma` must be a positive number
|
|
55
|
+
* @throws must provide a valid state
|
|
56
|
+
* @returns iterator
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* var iterSineWave = require( './../../../iter/sine-wave' );
|
|
60
|
+
*
|
|
61
|
+
* var sine = iterSineWave({
|
|
62
|
+
* 'iter': 100
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* var it = ns.iterawgn( sine, 0.5 );
|
|
66
|
+
*
|
|
67
|
+
* var v = it.next().value;
|
|
68
|
+
* // returns <number>
|
|
69
|
+
*
|
|
70
|
+
* v = it.next().value;
|
|
71
|
+
* // returns <number>
|
|
72
|
+
*
|
|
73
|
+
* v = it.next().value;
|
|
74
|
+
* // returns <number>
|
|
75
|
+
*
|
|
76
|
+
* // ...
|
|
77
|
+
*/
|
|
78
|
+
iterawgn: typeof iterawgn;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Returns an iterator which introduces additive white Laplacian (a.k.a. biexponential or double-exponential) noise with standard deviation `sigma`.
|
|
82
|
+
*
|
|
83
|
+
* @param iterator - input iterator
|
|
84
|
+
* @param sigma - standard deviation of the noise
|
|
85
|
+
* @param options - function options
|
|
86
|
+
* @param options.prng - pseudorandom number generator for generating uniformly distributed pseudorandom numbers on the interval `[0,1)`
|
|
87
|
+
* @param options.state - pseudorandom number generator state
|
|
88
|
+
* @param options.seed - pseudorandom number generator seed
|
|
89
|
+
* @param options.copy - boolean indicating whether to copy a provided pseudorandom number generator state (default: true)
|
|
90
|
+
* @throws `sigma` must be a positive number
|
|
91
|
+
* @throws must provide a valid state
|
|
92
|
+
* @returns iterator
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* var iterSineWave = require( './../../../iter/sine-wave' );
|
|
96
|
+
*
|
|
97
|
+
* var sine = iterSineWave({
|
|
98
|
+
* 'iter': 100
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* var it = ns.iterawln( sine, 0.5 );
|
|
102
|
+
*
|
|
103
|
+
* var v = it.next().value;
|
|
104
|
+
* // returns <number>
|
|
105
|
+
*
|
|
106
|
+
* v = it.next().value;
|
|
107
|
+
* // returns <number>
|
|
108
|
+
*
|
|
109
|
+
* v = it.next().value;
|
|
110
|
+
* // returns <number>
|
|
111
|
+
*
|
|
112
|
+
* // ...
|
|
113
|
+
*/
|
|
114
|
+
iterawln: typeof iterawln;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Returns an iterator which introduces additive white uniform noise with standard deviation `sigma`.
|
|
118
|
+
*
|
|
119
|
+
* @param iterator - input iterator
|
|
120
|
+
* @param sigma - standard deviation of the noise
|
|
121
|
+
* @param options - function options
|
|
122
|
+
* @param options.prng - pseudorandom number generator for generating uniformly distributed pseudorandom numbers on the interval `[0,1)`
|
|
123
|
+
* @param options.state - pseudorandom number generator state
|
|
124
|
+
* @param options.seed - pseudorandom number generator seed
|
|
125
|
+
* @param options.copy - boolean indicating whether to copy a provided pseudorandom number generator state (default: true)
|
|
126
|
+
* @throws `sigma` must be a positive number
|
|
127
|
+
* @throws must provide a valid state
|
|
128
|
+
* @returns iterator
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* var iterSineWave = require( './../../../iter/sine-wave' );
|
|
132
|
+
*
|
|
133
|
+
* var sine = iterSineWave({
|
|
134
|
+
* 'iter': 100
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* var it = ns.iterawun( sine, 0.5 );
|
|
138
|
+
*
|
|
139
|
+
* var v = it.next().value;
|
|
140
|
+
* // returns <number>
|
|
141
|
+
*
|
|
142
|
+
* v = it.next().value;
|
|
143
|
+
* // returns <number>
|
|
144
|
+
*
|
|
145
|
+
* v = it.next().value;
|
|
146
|
+
* // returns <number>
|
|
147
|
+
*
|
|
148
|
+
* // ...
|
|
149
|
+
*/
|
|
150
|
+
iterawun: typeof iterawun;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Returns an iterator which generates a Bartlett-Hann pulse waveform.
|
|
154
|
+
*
|
|
155
|
+
* ## Notes
|
|
156
|
+
*
|
|
157
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
158
|
+
*
|
|
159
|
+
* @param options - function options
|
|
160
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
161
|
+
* @param options.duration - pulse duration (default: options.period)
|
|
162
|
+
* @param options.amplitude - amplitude (default: 1.0)
|
|
163
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
164
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
165
|
+
* @throws `duration` option must be a positive integer
|
|
166
|
+
* @throws `period` option must be a positive integer
|
|
167
|
+
* @throws `offset` option must be an integer
|
|
168
|
+
* @throws `amplitude` option must be a positive number
|
|
169
|
+
* @throws `iter` option must be a nonnegative integer
|
|
170
|
+
* @throws `duration` option must be less than or equal to the `period`
|
|
171
|
+
* @throws `duration` option must be greater than 2
|
|
172
|
+
* @returns iterator
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* var opts = {
|
|
176
|
+
* 'period': 10
|
|
177
|
+
* };
|
|
178
|
+
*
|
|
179
|
+
* var iter = ns.iterBartlettHannPulse( opts );
|
|
180
|
+
*
|
|
181
|
+
* var v = iter.next().value;
|
|
182
|
+
* // returns <number>
|
|
183
|
+
*
|
|
184
|
+
* v = iter.next().value;
|
|
185
|
+
* // returns <number>
|
|
186
|
+
*
|
|
187
|
+
* v = iter.next().value;
|
|
188
|
+
* // returns <number>
|
|
189
|
+
*
|
|
190
|
+
* // ...
|
|
191
|
+
*/
|
|
192
|
+
iterBartlettHannPulse: typeof iterBartlettHannPulse;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Returns an iterator which generates a Bartlett pulse waveform.
|
|
196
|
+
*
|
|
197
|
+
* ## Notes
|
|
198
|
+
*
|
|
199
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
200
|
+
*
|
|
201
|
+
* @param options - function options
|
|
202
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
203
|
+
* @param options.duration - pulse duration (default: options.period)
|
|
204
|
+
* @param options.amplitude - amplitude (default: 1.0)
|
|
205
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
206
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
207
|
+
* @throws `duration` option must be a positive integer
|
|
208
|
+
* @throws `period` option must be a positive integer
|
|
209
|
+
* @throws `offset` option must be an integer
|
|
210
|
+
* @throws `amplitude` option must be a positive number
|
|
211
|
+
* @throws `iter` option must be a nonnegative integer
|
|
212
|
+
* @throws `duration` option must be less than or equal to the `period`
|
|
213
|
+
* @throws `duration` option must be greater than 2
|
|
214
|
+
* @returns iterator
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* var opts = {
|
|
218
|
+
* 'period': 10
|
|
219
|
+
* };
|
|
220
|
+
*
|
|
221
|
+
* var iter = ns.iterBartlettPulse( opts );
|
|
222
|
+
*
|
|
223
|
+
* var v = iter.next().value;
|
|
224
|
+
* // returns <number>
|
|
225
|
+
*
|
|
226
|
+
* v = iter.next().value;
|
|
227
|
+
* // returns <number>
|
|
228
|
+
*
|
|
229
|
+
* v = iter.next().value;
|
|
230
|
+
* // returns <number>
|
|
231
|
+
*
|
|
232
|
+
* // ...
|
|
233
|
+
*/
|
|
234
|
+
iterBartlettPulse: typeof iterBartlettPulse;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Returns an iterator which generates a cosine wave.
|
|
238
|
+
*
|
|
239
|
+
* ## Notes
|
|
240
|
+
*
|
|
241
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
242
|
+
*
|
|
243
|
+
* @param options - function options
|
|
244
|
+
* @param options.period - number of iterations before a cosine wave repeats (default: 10)
|
|
245
|
+
* @param options.amplitude - peak amplitude (default: 1.0)
|
|
246
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
247
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
248
|
+
* @throws `period` option must be a positive integer
|
|
249
|
+
* @throws `amplitude` must be a nonnegative number
|
|
250
|
+
* @throws `offset` option must be an integer
|
|
251
|
+
* @throws `iter` option must be a nonnegative integer
|
|
252
|
+
* @returns iterator
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* var opts = {
|
|
256
|
+
* 'period': 4
|
|
257
|
+
* };
|
|
258
|
+
*
|
|
259
|
+
* var iter = ns.iterCosineWave( opts );
|
|
260
|
+
*
|
|
261
|
+
* var v = iter.next().value;
|
|
262
|
+
* // returns 1.0
|
|
263
|
+
*
|
|
264
|
+
* v = iter.next().value;
|
|
265
|
+
* // returns 0.0
|
|
266
|
+
*
|
|
267
|
+
* v = iter.next().value;
|
|
268
|
+
* // returns -1.0
|
|
269
|
+
*
|
|
270
|
+
* // ...
|
|
271
|
+
*/
|
|
272
|
+
iterCosineWave: typeof iterCosineWave;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Returns an iterator which generates a Dirac comb.
|
|
276
|
+
*
|
|
277
|
+
* ## Notes
|
|
278
|
+
*
|
|
279
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
280
|
+
*
|
|
281
|
+
* @param options - function options
|
|
282
|
+
* @param options.period - number of iterations before a waveform repeats (default: 10)
|
|
283
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
284
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
285
|
+
* @throws `period` option must be a positive integer
|
|
286
|
+
* @throws `offset` option must be an integer
|
|
287
|
+
* @throws `iter` option must be a nonnegative integer
|
|
288
|
+
* @returns iterator
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* var opts = {
|
|
292
|
+
* 'period': 4
|
|
293
|
+
* };
|
|
294
|
+
*
|
|
295
|
+
* var iter = ns.iterDiracComb( opts );
|
|
296
|
+
*
|
|
297
|
+
* var v = iter.next().value;
|
|
298
|
+
* // returns Infinity
|
|
299
|
+
*
|
|
300
|
+
* v = iter.next().value;
|
|
301
|
+
* // returns 0.0
|
|
302
|
+
*
|
|
303
|
+
* v = iter.next().value;
|
|
304
|
+
* // returns 0.0
|
|
305
|
+
*
|
|
306
|
+
* // ...
|
|
307
|
+
*/
|
|
308
|
+
iterDiracComb: typeof iterDiracComb;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Returns an iterator which generates a flat top pulse waveform.
|
|
312
|
+
*
|
|
313
|
+
* ## Notes
|
|
314
|
+
*
|
|
315
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
316
|
+
*
|
|
317
|
+
* @param options - function options
|
|
318
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
319
|
+
* @param options.duration - pulse duration (default: options.period)
|
|
320
|
+
* @param options.amplitude - amplitude (default: 1.0)
|
|
321
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
322
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
323
|
+
* @throws `duration` option must be a positive integer
|
|
324
|
+
* @throws `period` option must be a positive integer
|
|
325
|
+
* @throws `offset` option must be an integer
|
|
326
|
+
* @throws `amplitude` option must be a positive number
|
|
327
|
+
* @throws `iter` option must be a nonnegative integer
|
|
328
|
+
* @throws `duration` option must be less than or equal to the `period`
|
|
329
|
+
* @throws `duration` option must be greater than 2
|
|
330
|
+
* @returns iterator
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* var opts = {
|
|
334
|
+
* 'period': 10
|
|
335
|
+
* };
|
|
336
|
+
*
|
|
337
|
+
* var iter = ns.iterFlatTopPulse( opts );
|
|
338
|
+
*
|
|
339
|
+
* var v = iter.next().value;
|
|
340
|
+
* // returns <number>
|
|
341
|
+
*
|
|
342
|
+
* v = iter.next().value;
|
|
343
|
+
* // returns <number>
|
|
344
|
+
*
|
|
345
|
+
* v = iter.next().value;
|
|
346
|
+
* // returns <number>
|
|
347
|
+
*
|
|
348
|
+
* // ...
|
|
349
|
+
*/
|
|
350
|
+
iterFlatTopPulse: typeof iterFlatTopPulse;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Returns an iterator which generates a Hann pulse waveform.
|
|
354
|
+
*
|
|
355
|
+
* ## Notes
|
|
356
|
+
*
|
|
357
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
358
|
+
*
|
|
359
|
+
* @param options - function options
|
|
360
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
361
|
+
* @param options.duration - pulse duration (default: options.period)
|
|
362
|
+
* @param options.amplitude - amplitude (default: 1.0)
|
|
363
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
364
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
365
|
+
* @throws `duration` option must be a positive integer
|
|
366
|
+
* @throws `period` option must be a positive integer
|
|
367
|
+
* @throws `offset` option must be an integer
|
|
368
|
+
* @throws `amplitude` option must be a positive number
|
|
369
|
+
* @throws `iter` option must be a nonnegative integer
|
|
370
|
+
* @throws `duration` option must be less than or equal to the `period`
|
|
371
|
+
* @throws `duration` option must be greater than 2
|
|
372
|
+
* @returns iterator
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* var opts = {
|
|
376
|
+
* 'period': 10
|
|
377
|
+
* };
|
|
378
|
+
*
|
|
379
|
+
* var iter = ns.iterHannPulse( opts );
|
|
380
|
+
*
|
|
381
|
+
* var v = iter.next().value;
|
|
382
|
+
* // returns <number>
|
|
383
|
+
*
|
|
384
|
+
* v = iter.next().value;
|
|
385
|
+
* // returns <number>
|
|
386
|
+
*
|
|
387
|
+
* v = iter.next().value;
|
|
388
|
+
* // returns <number>
|
|
389
|
+
*
|
|
390
|
+
* // ...
|
|
391
|
+
*/
|
|
392
|
+
iterHannPulse: typeof iterHannPulse;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Returns an iterator which generates a Lanczos pulse waveform.
|
|
396
|
+
*
|
|
397
|
+
* ## Notes
|
|
398
|
+
*
|
|
399
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
400
|
+
*
|
|
401
|
+
* @param options - function options
|
|
402
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
403
|
+
* @param options.duration - pulse duration (default: options.period)
|
|
404
|
+
* @param options.amplitude - amplitude (default: 1.0)
|
|
405
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
406
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
407
|
+
* @throws `duration` option must be a positive integer
|
|
408
|
+
* @throws `period` option must be a positive integer
|
|
409
|
+
* @throws `offset` option must be an integer
|
|
410
|
+
* @throws `amplitude` option must be a positive number
|
|
411
|
+
* @throws `iter` option must be a nonnegative integer
|
|
412
|
+
* @throws `duration` option must be less than or equal to the `period`
|
|
413
|
+
* @throws `duration` option must be greater than 2
|
|
414
|
+
* @returns iterator
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* var opts = {
|
|
418
|
+
* 'period': 10
|
|
419
|
+
* };
|
|
420
|
+
*
|
|
421
|
+
* var iter = ns.iterLanczosPulse( opts );
|
|
422
|
+
*
|
|
423
|
+
* var v = iter.next().value;
|
|
424
|
+
* // returns <number>
|
|
425
|
+
*
|
|
426
|
+
* v = iter.next().value;
|
|
427
|
+
* // returns <number>
|
|
428
|
+
*
|
|
429
|
+
* v = iter.next().value;
|
|
430
|
+
* // returns <number>
|
|
431
|
+
*
|
|
432
|
+
* // ...
|
|
433
|
+
*/
|
|
434
|
+
iterLanczosPulse: typeof iterLanczosPulse;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Returns an iterator which generates a periodic sinc waveform.
|
|
438
|
+
*
|
|
439
|
+
* ## Notes
|
|
440
|
+
*
|
|
441
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
442
|
+
*
|
|
443
|
+
* @param n - order
|
|
444
|
+
* @param options - function options
|
|
445
|
+
* @param options.period - number of iterations before a waveform repeats (default: 100)
|
|
446
|
+
* @param options.amplitude - peak amplitude (default: 1.0)
|
|
447
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
448
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
449
|
+
* @throws first argument must be a positive integer
|
|
450
|
+
* @throws `period` option must be a positive integer
|
|
451
|
+
* @throws `amplitude` must be a nonnegative number
|
|
452
|
+
* @throws `offset` option must be an integer
|
|
453
|
+
* @throws `iter` option must be a nonnegative integer
|
|
454
|
+
* @returns iterator
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* var opts = {
|
|
458
|
+
* 'period': 1000
|
|
459
|
+
* };
|
|
460
|
+
*
|
|
461
|
+
* var iter = ns.iterPeriodicSinc( 7, opts );
|
|
462
|
+
*
|
|
463
|
+
* var v = iter.next().value;
|
|
464
|
+
* // returns <number>
|
|
465
|
+
*
|
|
466
|
+
* v = iter.next().value;
|
|
467
|
+
* // returns <number>
|
|
468
|
+
*
|
|
469
|
+
* v = iter.next().value;
|
|
470
|
+
* // returns <number>
|
|
471
|
+
*
|
|
472
|
+
* // ...
|
|
473
|
+
*/
|
|
474
|
+
iterPeriodicSinc: typeof iterPeriodicSinc;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Returns an iterator which generates a pulse waveform.
|
|
478
|
+
*
|
|
479
|
+
* ## Notes
|
|
480
|
+
*
|
|
481
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
482
|
+
*
|
|
483
|
+
* @param options - function options
|
|
484
|
+
* @param options.period - number of iterations before a waveform repeats (default: 10)
|
|
485
|
+
* @param options.duration - number of consecutive iterations of maximum amplitude during one period (default: options.period/2)
|
|
486
|
+
* @param options.min - minimum amplitude (default: 0.0)
|
|
487
|
+
* @param options.max - maximum amplitude (default: 1.0)
|
|
488
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
489
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
490
|
+
* @throws `duration` option must be a positive integer
|
|
491
|
+
* @throws `period` option must be a positive integer
|
|
492
|
+
* @throws `offset` option must be an integer
|
|
493
|
+
* @throws `iter` option must be a nonnegative integer
|
|
494
|
+
* @throws `duration` option must be less than the `period`
|
|
495
|
+
* @returns iterator
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* var opts = {
|
|
499
|
+
* 'period': 4
|
|
500
|
+
* };
|
|
501
|
+
*
|
|
502
|
+
* var iter = ns.iterPulse( opts );
|
|
503
|
+
*
|
|
504
|
+
* var v = iter.next().value;
|
|
505
|
+
* // returns 1.0
|
|
506
|
+
*
|
|
507
|
+
* v = iter.next().value;
|
|
508
|
+
* // returns 1.0
|
|
509
|
+
*
|
|
510
|
+
* v = iter.next().value;
|
|
511
|
+
* // returns 0.0
|
|
512
|
+
*
|
|
513
|
+
* // ...
|
|
514
|
+
*/
|
|
515
|
+
iterPulse: typeof iterPulse;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Returns an iterator which generates a sawtooth wave.
|
|
519
|
+
*
|
|
520
|
+
* ## Notes
|
|
521
|
+
*
|
|
522
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
523
|
+
*
|
|
524
|
+
* @param options - function options
|
|
525
|
+
* @param options.period - number of iterations before a waveform repeats (default: 10)
|
|
526
|
+
* @param options.amplitude - peak amplitude (default: 1.0)
|
|
527
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
528
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
529
|
+
* @throws `period` option must be a positive integer
|
|
530
|
+
* @throws `amplitude` must be a nonnegative number
|
|
531
|
+
* @throws `offset` option must be an integer
|
|
532
|
+
* @throws `iter` option must be a nonnegative integer
|
|
533
|
+
* @returns iterator
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* var opts = {
|
|
537
|
+
* 'period': 4
|
|
538
|
+
* };
|
|
539
|
+
*
|
|
540
|
+
* var iter = ns.iterSawtoothWave( opts );
|
|
541
|
+
*
|
|
542
|
+
* var v = iter.next().value;
|
|
543
|
+
* // returns 0.0
|
|
544
|
+
*
|
|
545
|
+
* v = iter.next().value;
|
|
546
|
+
* // returns ~0.5
|
|
547
|
+
*
|
|
548
|
+
* v = iter.next().value;
|
|
549
|
+
* // returns ~1.0
|
|
550
|
+
*
|
|
551
|
+
* // ...
|
|
552
|
+
*/
|
|
553
|
+
iterSawtoothWave: typeof iterSawtoothWave;
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Returns an iterator which generates a sine wave.
|
|
557
|
+
*
|
|
558
|
+
* ## Notes
|
|
559
|
+
*
|
|
560
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
561
|
+
*
|
|
562
|
+
* @param options - function options
|
|
563
|
+
* @param options.period - number of iterations before a sine wave repeats (default: 10)
|
|
564
|
+
* @param options.amplitude - peak amplitude (default: 1.0)
|
|
565
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
566
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
567
|
+
* @throws `period` option must be a positive integer
|
|
568
|
+
* @throws `amplitude` must be a nonnegative number
|
|
569
|
+
* @throws `offset` option must be an integer
|
|
570
|
+
* @throws `iter` option must be a nonnegative integer
|
|
571
|
+
* @returns iterator
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* var opts = {
|
|
575
|
+
* 'period': 4
|
|
576
|
+
* };
|
|
577
|
+
*
|
|
578
|
+
* var iter = ns.iterSineWave( opts );
|
|
579
|
+
*
|
|
580
|
+
* var v = iter.next().value;
|
|
581
|
+
* // returns 0.0
|
|
582
|
+
*
|
|
583
|
+
* v = iter.next().value;
|
|
584
|
+
* // returns 1.0
|
|
585
|
+
*
|
|
586
|
+
* v = iter.next().value;
|
|
587
|
+
* // returns 0.0
|
|
588
|
+
*
|
|
589
|
+
* // ...
|
|
590
|
+
*/
|
|
591
|
+
iterSineWave: typeof iterSineWave;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Returns an iterator which generates a square wave.
|
|
595
|
+
*
|
|
596
|
+
* ## Notes
|
|
597
|
+
*
|
|
598
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
599
|
+
*
|
|
600
|
+
* @param options - function options
|
|
601
|
+
* @param options.period - number of iterations before a square wave repeats (default: 10)
|
|
602
|
+
* @param options.min - minimum amplitude (default: -1.0)
|
|
603
|
+
* @param options.max - maximum amplitude (default: 1.0)
|
|
604
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
605
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
606
|
+
* @throws `period` option must be a positive even integer
|
|
607
|
+
* @throws `offset` option must be an integer
|
|
608
|
+
* @throws `iter` option must be a nonnegative integer
|
|
609
|
+
* @returns iterator
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* var opts = {
|
|
613
|
+
* 'period': 4
|
|
614
|
+
* };
|
|
615
|
+
*
|
|
616
|
+
* var iter = ns.iterSquareWave( opts );
|
|
617
|
+
*
|
|
618
|
+
* var v = iter.next().value;
|
|
619
|
+
* // returns 1.0
|
|
620
|
+
*
|
|
621
|
+
* v = iter.next().value;
|
|
622
|
+
* // returns 1.0
|
|
623
|
+
*
|
|
624
|
+
* v = iter.next().value;
|
|
625
|
+
* // returns -1.0
|
|
626
|
+
*
|
|
627
|
+
* // ...
|
|
628
|
+
*/
|
|
629
|
+
iterSquareWave: typeof iterSquareWave;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Returns an iterator which generates a triangle wave.
|
|
633
|
+
*
|
|
634
|
+
* ## Notes
|
|
635
|
+
*
|
|
636
|
+
* - If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
637
|
+
*
|
|
638
|
+
* @param options - function options
|
|
639
|
+
* @param options.period - number of iterations before a waveform repeats (default: 10)
|
|
640
|
+
* @param options.amplitude - peak amplitude (default: 1.0)
|
|
641
|
+
* @param options.offset - phase offset (in units of iterations; default: 0)
|
|
642
|
+
* @param options.iter - number of iterations (default: 1e308)
|
|
643
|
+
* @throws `period` option must be a positive integer
|
|
644
|
+
* @throws `amplitude` must be a nonnegative number
|
|
645
|
+
* @throws `offset` option must be an integer
|
|
646
|
+
* @throws `iter` option must be a nonnegative integer
|
|
647
|
+
* @returns iterator
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* var opts = {
|
|
651
|
+
* 'period': 4
|
|
652
|
+
* };
|
|
653
|
+
*
|
|
654
|
+
* var iter = ns.iterTriangleWave( opts );
|
|
655
|
+
*
|
|
656
|
+
* var v = iter.next().value;
|
|
657
|
+
* // returns 0.0
|
|
658
|
+
*
|
|
659
|
+
* v = iter.next().value;
|
|
660
|
+
* // returns 1.0
|
|
661
|
+
*
|
|
662
|
+
* v = iter.next().value;
|
|
663
|
+
* // returns 0.0
|
|
664
|
+
*
|
|
665
|
+
* // ...
|
|
666
|
+
*/
|
|
667
|
+
iterTriangleWave: typeof iterTriangleWave;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Simulation iterators.
|
|
672
|
+
*/
|
|
673
|
+
declare var ns: Namespace;
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
// EXPORTS //
|
|
677
|
+
|
|
678
|
+
export = ns;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
20
|
+
|
|
21
|
+
import ns = require( './index' );
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// TESTS //
|
|
25
|
+
|
|
26
|
+
// The exported value is the expected interface...
|
|
27
|
+
{
|
|
28
|
+
ns; // $ExpectType Namespace
|
|
29
|
+
}
|