Skip to content

Commit 43e7a33

Browse files
committed
chore: minor clean-up after code review
1 parent efbff47 commit 43e7a33

File tree

9 files changed

+87
-90
lines changed

9 files changed

+87
-90
lines changed

lib/node_modules/@stdlib/assert/is-same-typed-array-like/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
1919
-->
2020

21-
# isSameArrayLike
21+
# isSameTypedArrayLike
2222

2323
> Test if two arguments are both typed-array-like objects and have the [same values][@stdlib/assert/is-same-value].
2424

lib/node_modules/@stdlib/assert/is-same-typed-array-like/docs/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @example
2929
* var Int8Array = require( '@stdlib/array/int8' );
3030
* var Int16Array = require( '@stdlib/array/int16' );
31+
*
3132
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
3233
* var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
3334
*
@@ -36,6 +37,7 @@
3637
*
3738
* @example
3839
* var Int8Array = require( '@stdlib/array/int8' );
40+
*
3941
* var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
4042
* var y = new Int8Array( [ 1.0, 2.0, 4.0 ] );
4143
*

lib/node_modules/@stdlib/iter/cunone/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ var iterCuNone = require( '@stdlib/iter/cunone' );
4242

4343
#### iterCuNone( iterator )
4444

45-
Returns an [iterator][mdn-iterator-protocol] which cumulatively tests whether every
46-
iterated value is falsy.
45+
Returns an [iterator][mdn-iterator-protocol] which cumulatively tests whether every iterated value is falsy.
4746

4847
```javascript
4948
var array2iterator = require( '@stdlib/array/to-iterator' );
@@ -115,7 +114,7 @@ var riter = randu( opts );
115114
// Create an iterator which applies a threshold to generated numbers:
116115
var miter = iterMap( riter, threshold );
117116

118-
// Create an iterator which cumulatively tests whether every iterated value is falsy.
117+
// Create an iterator which cumulatively tests whether every iterated value is falsy:
119118
var it = iterCuNone( miter );
120119

121120
// Perform manual iteration...

lib/node_modules/@stdlib/stats/base/dists/chi/README.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ var filledarrayBy = require( '@stdlib/array/filled-by' );
109109
var variance = require( '@stdlib/stats/base/variance' );
110110
var linspace = require( '@stdlib/array/base/linspace' );
111111
var rayleigh = require( '@stdlib/stats/base/dists/rayleigh' );
112+
var absdiff = require( '@stdlib/math/base/utils/absolute-difference' );
112113
var mean = require( '@stdlib/stats/base/mean' );
113114
var abs = require( '@stdlib/math/base/special/abs' );
115+
var max = require( '@stdlib/math/base/special/max' );
114116
var chi = require( '@stdlib/stats/base/dists/chi' );
115117

116118
// Define the degrees of freedom parameter:
@@ -128,20 +130,20 @@ var chiCDF = chi.cdf.factory( k );
128130
var cdf = filledarrayBy( x.length, 'float64', chiCDF );
129131

130132
// Output the PDF and CDF values:
131-
console.log( 'x values:', x );
132-
console.log( 'PDF values:', pdf );
133-
console.log( 'CDF values:', cdf );
133+
console.log( 'x values: ', x );
134+
console.log( 'PDF values: ', pdf );
135+
console.log( 'CDF values: ', cdf );
134136

135137
// Compute statistical properties:
136138
var theoreticalMean = chi.mean( k );
137139
var theoreticalVariance = chi.variance( k );
138140
var theoreticalSkewness = chi.skewness( k );
139141
var theoreticalKurtosis = chi.kurtosis( k );
140142

141-
console.log( 'Theoretical Mean:', theoreticalMean );
142-
console.log( 'Theoretical Variance:', theoreticalVariance );
143-
console.log( 'Skewness:', theoreticalSkewness );
144-
console.log( 'Kurtosis:', theoreticalKurtosis );
143+
console.log( 'Theoretical Mean: ', theoreticalMean );
144+
console.log( 'Theoretical Variance: ', theoreticalVariance );
145+
console.log( 'Skewness: ', theoreticalSkewness );
146+
console.log( 'Kurtosis: ', theoreticalKurtosis );
145147

146148
// Generate random samples from the Chi distribution:
147149
var rchi = chiRandomFactory( k );
@@ -152,12 +154,12 @@ var samples = filledarrayBy( n, 'float64', rchi );
152154
var sampleMean = mean( n, samples, 1 );
153155
var sampleVariance = variance( n, 1, samples, 1 );
154156

155-
console.log( 'Sample Mean:', sampleMean );
156-
console.log( 'Sample Variance:', sampleVariance );
157+
console.log( 'Sample Mean: ', sampleMean );
158+
console.log( 'Sample Variance: ', sampleVariance );
157159

158160
// Compare sample statistics to theoretical values:
159-
console.log( 'Difference in Mean:', abs( theoreticalMean - sampleMean ) );
160-
console.log( 'Difference in Variance:', abs( theoreticalVariance - sampleVariance ) );
161+
console.log( 'Difference in Mean: ', abs( theoreticalMean - sampleMean ) );
162+
console.log( 'Difference in Variance: ', abs( theoreticalVariance - sampleVariance ) );
161163

162164
// Demonstrate the relationship with the Rayleigh distribution when k=2:
163165
var rayleighPDF = rayleigh.pdf.factory( 1.0 );
@@ -175,17 +177,13 @@ var diffPDF;
175177
var diffCDF;
176178
var i;
177179
for ( i = 0; i < x.length; i++ ) {
178-
diffPDF = abs( pdf[ i ] - rayleighPDFValues[ i ] );
179-
if ( diffPDF > maxDiffPDF ) {
180-
maxDiffPDF = diffPDF;
181-
}
182-
diffCDF = abs( cdf[ i ] - rayleighCDFValues[ i ] );
183-
if ( diffCDF > maxDiffCDF ) {
184-
maxDiffCDF = diffCDF;
185-
}
180+
diffPDF = absdiff( pdf[ i ], rayleighPDFValues[ i ] );
181+
maxDiffPDF = max( maxDiffPDF, diffPDF );
182+
diffCDF = absdiff( cdf[ i ], rayleighCDFValues[ i ] );
183+
maxDiffCDF = max( maxDiffCDF, diffCDF );
186184
}
187-
console.log( 'Maximum difference between Chi(k=2) PDF and Rayleigh PDF:', maxDiffPDF );
188-
console.log( 'Maximum difference between Chi(k=2) CDF and Rayleigh CDF:', maxDiffCDF );
185+
console.log( 'Maximum difference between Chi(k=2) PDF and Rayleigh PDF: ', maxDiffPDF );
186+
console.log( 'Maximum difference between Chi(k=2) CDF and Rayleigh CDF: ', maxDiffCDF );
189187
```
190188

191189
</section>

lib/node_modules/@stdlib/stats/base/dists/chi/examples/index.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ var filledarrayBy = require( '@stdlib/array/filled-by' );
2323
var variance = require( '@stdlib/stats/base/variance' );
2424
var linspace = require( '@stdlib/array/base/linspace' );
2525
var rayleigh = require( '@stdlib/stats/base/dists/rayleigh' );
26+
var absdiff = require( '@stdlib/math/base/utils/absolute-difference' );
2627
var mean = require( '@stdlib/stats/base/mean' );
2728
var abs = require( '@stdlib/math/base/special/abs' );
29+
var max = require( '@stdlib/math/base/special/max' );
2830
var chi = require( './../lib' );
2931

3032
// Define the degrees of freedom parameter:
@@ -42,20 +44,20 @@ var chiCDF = chi.cdf.factory( k );
4244
var cdf = filledarrayBy( x.length, 'float64', chiCDF );
4345

4446
// Output the PDF and CDF values:
45-
console.log( 'x values:', x );
46-
console.log( 'PDF values:', pdf );
47-
console.log( 'CDF values:', cdf );
47+
console.log( 'x values: ', x );
48+
console.log( 'PDF values: ', pdf );
49+
console.log( 'CDF values: ', cdf );
4850

4951
// Compute statistical properties:
5052
var theoreticalMean = chi.mean( k );
5153
var theoreticalVariance = chi.variance( k );
5254
var theoreticalSkewness = chi.skewness( k );
5355
var theoreticalKurtosis = chi.kurtosis( k );
5456

55-
console.log( 'Theoretical Mean:', theoreticalMean );
56-
console.log( 'Theoretical Variance:', theoreticalVariance );
57-
console.log( 'Skewness:', theoreticalSkewness );
58-
console.log( 'Kurtosis:', theoreticalKurtosis );
57+
console.log( 'Theoretical Mean: ', theoreticalMean );
58+
console.log( 'Theoretical Variance: ', theoreticalVariance );
59+
console.log( 'Skewness: ', theoreticalSkewness );
60+
console.log( 'Kurtosis: ', theoreticalKurtosis );
5961

6062
// Generate random samples from the Chi distribution:
6163
var rchi = chiRandomFactory( k );
@@ -66,12 +68,12 @@ var samples = filledarrayBy( n, 'float64', rchi );
6668
var sampleMean = mean( n, samples, 1 );
6769
var sampleVariance = variance( n, 1, samples, 1 );
6870

69-
console.log( 'Sample Mean:', sampleMean );
70-
console.log( 'Sample Variance:', sampleVariance );
71+
console.log( 'Sample Mean: ', sampleMean );
72+
console.log( 'Sample Variance: ', sampleVariance );
7173

7274
// Compare sample statistics to theoretical values:
73-
console.log( 'Difference in Mean:', abs( theoreticalMean - sampleMean ) );
74-
console.log( 'Difference in Variance:', abs( theoreticalVariance - sampleVariance ) );
75+
console.log( 'Difference in Mean: ', abs( theoreticalMean - sampleMean ) );
76+
console.log( 'Difference in Variance: ', abs( theoreticalVariance - sampleVariance ) );
7577

7678
// Demonstrate the relationship with the Rayleigh distribution when k=2:
7779
var rayleighPDF = rayleigh.pdf.factory( 1.0 );
@@ -89,14 +91,10 @@ var diffPDF;
8991
var diffCDF;
9092
var i;
9193
for ( i = 0; i < x.length; i++ ) {
92-
diffPDF = abs( pdf[ i ] - rayleighPDFValues[ i ] );
93-
if ( diffPDF > maxDiffPDF ) {
94-
maxDiffPDF = diffPDF;
95-
}
96-
diffCDF = abs( cdf[ i ] - rayleighCDFValues[ i ] );
97-
if ( diffCDF > maxDiffCDF ) {
98-
maxDiffCDF = diffCDF;
99-
}
94+
diffPDF = absdiff( pdf[ i ], rayleighPDFValues[ i ] );
95+
maxDiffPDF = max( maxDiffPDF, diffPDF );
96+
diffCDF = absdiff( cdf[ i ], rayleighCDFValues[ i ] );
97+
maxDiffCDF = max( maxDiffCDF, diffCDF );
10098
}
101-
console.log( 'Maximum difference between Chi(k=2) PDF and Rayleigh PDF:', maxDiffPDF );
102-
console.log( 'Maximum difference between Chi(k=2) CDF and Rayleigh CDF:', maxDiffCDF );
99+
console.log( 'Maximum difference between Chi(k=2) PDF and Rayleigh PDF: ', maxDiffPDF );
100+
console.log( 'Maximum difference between Chi(k=2) CDF and Rayleigh CDF: ', maxDiffCDF );

lib/node_modules/@stdlib/stats/base/dists/exponential/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ var interarrivalTimes = randomExponential( numCustomers, lambda, {
123123
'dtype': 'float64'
124124
});
125125

126-
console.log( 'Simulated interarrival times for ' + numCustomers + ' customers:' );
126+
console.log( 'Simulated interarrival times for ' + numCustomers + ' customers: ' );
127127
console.log( interarrivalTimes );
128128

129129
// Calculate cumulative arrival times by computing the cumulative sum of interarrival times:
130130
var arrivalTimes = new Float64Array( interarrivalTimes.length );
131131
dcusum( interarrivalTimes.length, 0.0, interarrivalTimes, 1, arrivalTimes, 1 );
132132

133-
console.log( '\nCustomer arrival times:' );
133+
console.log( '\nCustomer arrival times: ' );
134134
console.log( arrivalTimes );
135135

136136
// Probability that a customer arrives within two minutes:
@@ -153,7 +153,7 @@ console.log( 'PDF at x = 1: ' + out.toFixed(4) );
153153

154154
// Evaluate the MGF at t = 0.1:
155155
out = dist.mgf( 0.1 );
156-
console.log( 'MGF at t = 0.5: ' + out.toFixed(4) );
156+
console.log( 'MGF at t = 0.1: ' + out.toFixed(4) );
157157
```
158158

159159
</section>

lib/node_modules/@stdlib/stats/base/dists/exponential/examples/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ var interarrivalTimes = randomExponential( numCustomers, lambda, {
3232
'dtype': 'float64'
3333
});
3434

35-
console.log( 'Simulated interarrival times for ' + numCustomers + ' customers:' );
35+
console.log( 'Simulated interarrival times for ' + numCustomers + ' customers: ' );
3636
console.log( interarrivalTimes );
3737

3838
// Calculate cumulative arrival times by computing the cumulative sum of interarrival times:
3939
var arrivalTimes = new Float64Array( interarrivalTimes.length );
4040
dcusum( interarrivalTimes.length, 0.0, interarrivalTimes, 1, arrivalTimes, 1 );
4141

42-
console.log( '\nCustomer arrival times:' );
42+
console.log( '\nCustomer arrival times: ' );
4343
console.log( arrivalTimes );
4444

4545
// Probability that a customer arrives within two minutes:
@@ -62,4 +62,4 @@ console.log( 'PDF at x = 1: ' + out.toFixed(4) );
6262

6363
// Evaluate the MGF at t = 0.1:
6464
out = dist.mgf( 0.1 );
65-
console.log( 'MGF at t = 0.5: ' + out.toFixed(4) );
65+
console.log( 'MGF at t = 0.1: ' + out.toFixed(4) );

lib/node_modules/@stdlib/stats/base/dists/geometric/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,20 @@ var geometricCDF = geometric.cdf.factory( p );
136136
var cdf = filledarrayBy( x.length, 'float64', geometricCDF );
137137

138138
// Output the PMF and CDF values:
139-
console.log( 'x values:', x );
140-
console.log( 'PMF values:', pmf );
141-
console.log( 'CDF values:', cdf );
139+
console.log( 'x values: ', x );
140+
console.log( 'PMF values: ', pmf );
141+
console.log( 'CDF values: ', cdf );
142142

143143
// Compute statistical properties:
144144
var theoreticalMean = geometric.mean( p );
145145
var theoreticalVariance = geometric.variance( p );
146146
var theoreticalSkewness = geometric.skewness( p );
147147
var theoreticalKurtosis = geometric.kurtosis( p );
148148

149-
console.log( 'Theoretical Mean:', theoreticalMean );
150-
console.log( 'Theoretical Variance:', theoreticalVariance );
151-
console.log( 'Skewness:', theoreticalSkewness );
152-
console.log( 'Kurtosis:', theoreticalKurtosis );
149+
console.log( 'Theoretical Mean: ', theoreticalMean );
150+
console.log( 'Theoretical Variance: ', theoreticalVariance );
151+
console.log( 'Skewness: ', theoreticalSkewness );
152+
console.log( 'Kurtosis: ', theoreticalKurtosis );
153153

154154
// Generate random samples from the geometric distribution:
155155
var rgeom = geometricRandomFactory( p );
@@ -160,19 +160,19 @@ var samples = filledarrayBy( n, 'float64', rgeom );
160160
var sampleMean = mean( n, samples, 1 );
161161
var sampleVariance = variance( n, 1, samples, 1 );
162162

163-
console.log( 'Sample Mean:', sampleMean );
164-
console.log( 'Sample Variance:', sampleVariance );
163+
console.log( 'Sample Mean: ', sampleMean );
164+
console.log( 'Sample Variance: ', sampleVariance );
165165

166166
// Demonstrate the memoryless property:
167167
var s = 2.0;
168168
var t = 3.0;
169169
var prob1 = ( 1.0 - geometric.cdf( s + t - 1.0, p ) ) /
170-
( 1.0 - geometric.cdf( s - 1.0, p ));
170+
( 1.0 - geometric.cdf( s - 1.0, p ) );
171171
var prob2 = 1.0 - geometric.cdf( t - 1.0, p );
172172

173-
console.log( 'P(X > s + t | X > s):', prob1 );
174-
console.log( 'P(X > t):', prob2 );
175-
console.log( 'Difference:', abs( prob1 - prob2 ) );
173+
console.log( 'P(X > s + t | X > s): ', prob1 );
174+
console.log( 'P(X > t): ', prob2 );
175+
console.log( 'Difference: ', abs( prob1 - prob2 ) );
176176

177177
// Demonstrate that the sum of k independent geometric random variables follows a negative binomial distribution:
178178
var k = 5;
@@ -194,14 +194,14 @@ var sumSampleVariance = variance( n, 1, sumSamples, 1 );
194194
var nbMean = negativeBinomial.mean( k, p );
195195
var nbVariance = negativeBinomial.variance( k, p );
196196

197-
console.log( 'Sum Sample Mean:', sumSampleMean );
198-
console.log( 'Sum Sample Variance:', sumSampleVariance );
199-
console.log( 'Negative Binomial Mean:', nbMean );
200-
console.log( 'Negative Binomial Variance:', nbVariance );
197+
console.log( 'Sum Sample Mean: ', sumSampleMean );
198+
console.log( 'Sum Sample Variance: ', sumSampleVariance );
199+
console.log( 'Negative Binomial Mean: ', nbMean );
200+
console.log( 'Negative Binomial Variance: ', nbVariance );
201201

202202
// Compare sample statistics to theoretical values:
203-
console.log( 'Difference in Mean:', abs( nbMean - sumSampleMean ) );
204-
console.log( 'Difference in Variance:', abs( nbVariance - sumSampleVariance ) );
203+
console.log( 'Difference in Mean: ', abs( nbMean - sumSampleMean ) );
204+
console.log( 'Difference in Variance: ', abs( nbVariance - sumSampleVariance ) );
205205
```
206206

207207
</section>

lib/node_modules/@stdlib/stats/base/dists/geometric/examples/index.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ var geometricCDF = geometric.cdf.factory( p );
4242
var cdf = filledarrayBy( x.length, 'float64', geometricCDF );
4343

4444
// Output the PMF and CDF values:
45-
console.log( 'x values:', x );
46-
console.log( 'PMF values:', pmf );
47-
console.log( 'CDF values:', cdf );
45+
console.log( 'x values: ', x );
46+
console.log( 'PMF values: ', pmf );
47+
console.log( 'CDF values: ', cdf );
4848

4949
// Compute statistical properties:
5050
var theoreticalMean = geometric.mean( p );
5151
var theoreticalVariance = geometric.variance( p );
5252
var theoreticalSkewness = geometric.skewness( p );
5353
var theoreticalKurtosis = geometric.kurtosis( p );
5454

55-
console.log( 'Theoretical Mean:', theoreticalMean );
56-
console.log( 'Theoretical Variance:', theoreticalVariance );
57-
console.log( 'Skewness:', theoreticalSkewness );
58-
console.log( 'Kurtosis:', theoreticalKurtosis );
55+
console.log( 'Theoretical Mean: ', theoreticalMean );
56+
console.log( 'Theoretical Variance: ', theoreticalVariance );
57+
console.log( 'Skewness: ', theoreticalSkewness );
58+
console.log( 'Kurtosis: ', theoreticalKurtosis );
5959

6060
// Generate random samples from the geometric distribution:
6161
var rgeom = geometricRandomFactory( p );
@@ -66,19 +66,19 @@ var samples = filledarrayBy( n, 'float64', rgeom );
6666
var sampleMean = mean( n, samples, 1 );
6767
var sampleVariance = variance( n, 1, samples, 1 );
6868

69-
console.log( 'Sample Mean:', sampleMean );
70-
console.log( 'Sample Variance:', sampleVariance );
69+
console.log( 'Sample Mean: ', sampleMean );
70+
console.log( 'Sample Variance: ', sampleVariance );
7171

7272
// Demonstrate the memoryless property:
7373
var s = 2.0;
7474
var t = 3.0;
7575
var prob1 = ( 1.0 - geometric.cdf( s + t - 1.0, p ) ) /
76-
( 1.0 - geometric.cdf( s - 1.0, p ));
76+
( 1.0 - geometric.cdf( s - 1.0, p ) );
7777
var prob2 = 1.0 - geometric.cdf( t - 1.0, p );
7878

79-
console.log( 'P(X > s + t | X > s):', prob1 );
80-
console.log( 'P(X > t):', prob2 );
81-
console.log( 'Difference:', abs( prob1 - prob2 ) );
79+
console.log( 'P(X > s + t | X > s): ', prob1 );
80+
console.log( 'P(X > t): ', prob2 );
81+
console.log( 'Difference: ', abs( prob1 - prob2 ) );
8282

8383
// Demonstrate that the sum of k independent geometric random variables follows a negative binomial distribution:
8484
var k = 5;
@@ -100,11 +100,11 @@ var sumSampleVariance = variance( n, 1, sumSamples, 1 );
100100
var nbMean = negativeBinomial.mean( k, p );
101101
var nbVariance = negativeBinomial.variance( k, p );
102102

103-
console.log( 'Sum Sample Mean:', sumSampleMean );
104-
console.log( 'Sum Sample Variance:', sumSampleVariance );
105-
console.log( 'Negative Binomial Mean:', nbMean );
106-
console.log( 'Negative Binomial Variance:', nbVariance );
103+
console.log( 'Sum Sample Mean: ', sumSampleMean );
104+
console.log( 'Sum Sample Variance: ', sumSampleVariance );
105+
console.log( 'Negative Binomial Mean: ', nbMean );
106+
console.log( 'Negative Binomial Variance: ', nbVariance );
107107

108108
// Compare sample statistics to theoretical values:
109-
console.log( 'Difference in Mean:', abs( nbMean - sumSampleMean ) );
110-
console.log( 'Difference in Variance:', abs( nbVariance - sumSampleVariance ) );
109+
console.log( 'Difference in Mean: ', abs( nbMean - sumSampleMean ) );
110+
console.log( 'Difference in Variance: ', abs( nbVariance - sumSampleVariance ) );

0 commit comments

Comments
 (0)