Skip to content

Commit ed5c4cc

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: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - 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: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 90e96d0 commit ed5c4cc

File tree

10 files changed

+85
-69
lines changed

10 files changed

+85
-69
lines changed

lib/node_modules/@stdlib/array/base/unary5d-by/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ function identity( value: number ): number {
139139
unary5dBy( [ x, y ], [ 1, 1, 1, 2, 2 ] ); // $ExpectError
140140
unary5dBy( [ x, y ], [ 1, 1, 1, 2, 2 ], identity ); // $ExpectError
141141
unary5dBy( [ x, y ], [ 1, 1, 1, 2, 2 ], identity, identity, {}, {} ); // $ExpectError
142-
}
142+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
julia 1.5
2-
JSON 0.21
1+
julia 1.5
2+
JSON 0.21

lib/node_modules/@stdlib/stats/base/dists/bernoulli/mode/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
]
7474
}
7575
]
76-
}
76+
}

lib/node_modules/@stdlib/stats/base/dists/exponential/mode/test/test.native.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var tryRequire = require( '@stdlib/utils/try-require' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27-
var abs = require( '@stdlib/math/base/special/abs' );
2827
var NINF = require( '@stdlib/constants/float64/ninf' );
29-
var EPS = require( '@stdlib/constants/float64/eps' );
3028

3129

3230
// VARIABLES //
@@ -71,22 +69,14 @@ tape( 'if provided a rate parameter `lambda` that is not a nonnegative number, t
7169
tape( 'the function returns the mode of an exponential distribution', opts, function test( t ) {
7270
var expected;
7371
var lambda;
74-
var delta;
75-
var tol;
7672
var i;
7773
var y;
7874

7975
expected = data.expected;
8076
lambda = data.lambda;
8177
for ( i = 0; i < expected.length; i++ ) {
8278
y = mode( lambda[i] );
83-
if ( y === expected[ i ] ) {
84-
t.equal( y, expected[i], 'lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
85-
} else {
86-
delta = abs( y - expected[ i ] );
87-
tol = 2.0 * EPS * abs( expected[ i ] );
88-
t.ok( delta <= tol, 'within tolerance. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
89-
}
79+
t.equal( y, expected[i], 'lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
9080
}
9181
t.end();
9282
});

lib/node_modules/@stdlib/stats/base/dists/f/entropy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ double out = stdlib_base_dists_f_entropy( 3.0, 7.0 );
182182
The function accepts the following arguments:
183183

184184
- **d1**: `[in] double` numerator degrees of freedom.
185-
- **d2**: `[in] double` maximum support.
185+
- **d2**: `[in] double` denominator degrees of freedom.
186186

187187
```c
188188
double stdlib_base_dists_f_entropy( const double d1, const double d2 );

lib/node_modules/@stdlib/stats/base/dists/gumbel/skewness/test/test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ tape( 'if provided a nonpositive `beta`, the function returns `NaN`', function t
7272
});
7373

7474
tape( 'the function returns `~1.14` as the skewness of a Gumbel distribution ', function test( t ) {
75-
var a;
76-
var b;
75+
var beta;
76+
var mu;
7777
var i;
7878
var v;
7979

8080
for ( i = 0; i < 10; i++ ) {
81-
a = ( randu()*10.0 );
82-
b = ( randu()*10.0 ) + a;
83-
v = skewness( a, b );
81+
mu = ( randu()*10.0 );
82+
beta = ( randu()*10.0 ) + 1.0;
83+
v = skewness( mu, beta );
8484
t.equal( v, 1.1395470994046488, 'returns ~1.14' );
8585
}
8686
t.end();

lib/node_modules/@stdlib/stats/base/dists/t/logpdf/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ for ( i = 0; i < 10; i++ ) {
168168
#include "stdlib/stats/base/dists/t/logpdf.h"
169169
```
170170

171-
#### stdlib_base_dists_t_logpdf( x, a, b )
171+
#### stdlib_base_dists_t_logpdf( x, v )
172172

173-
Evaluates the natural logarithm of the [PDF][pdf] for a [Student's t][t-distribution] distribution with degree of freedom `v`.
173+
Evaluates the natural logarithm of the [probability density function][pdf] (PDF) for a [Student's t][t-distribution] distribution with degrees of freedom `v`.
174174

175175
```c
176176
double out = stdlib_base_dists_t_logpdf( 0.5, 1.0 );

lib/node_modules/@stdlib/stats/base/dists/t/logpdf/benchmark/c/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include <sys/time.h>
2019
#include "stdlib/stats/base/dists/t/logpdf.h"
2120
#include <math.h>
2221
#include <stdio.h>
2322
#include <stdlib.h>
2423
#include <time.h>
24+
#include <sys/time.h>
2525

2626
#define NAME "t-logpdf"
2727
#define ITERATIONS 1000000

lib/node_modules/@stdlib/stats/base/dists/t/logpdf/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
* limitations under the License.
1717
*/
1818

19+
#include "stdlib/stats/base/dists/t/logpdf.h"
1920
#include "stdlib/math/base/assert/is_nan.h"
2021
#include "stdlib/math/base/special/betaln.h"
2122
#include "stdlib/math/base/special/ln.h"
2223
#include "stdlib/math/base/special/pow.h"
2324
#include "stdlib/math/base/special/sqrt.h"
24-
#include "stdlib/stats/base/dists/t/logpdf.h"
2525

2626
/**
2727
* Evaluates the log probability density function (logPDF) for a Student's t distribution with degrees of freedom `v` at a value `x`.

lib/node_modules/@stdlib/stats/base/dists/t/logpdf/test/test.native.js

Lines changed: 70 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var tape = require( 'tape' );
2525
var tryRequire = require( '@stdlib/utils/try-require' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var abs = require( '@stdlib/math/base/special/abs' );
28+
var PINF = require( '@stdlib/constants/float64/pinf' );
29+
var NINF = require( '@stdlib/constants/float64/ninf' );
2830
var EPS = require( '@stdlib/constants/float64/eps' );
2931

3032

@@ -60,19 +62,55 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f
6062
t.end();
6163
});
6264

63-
tape( 'if provided `v <= 0`, the function returns `NaN`', opts, function test( t ) {
65+
tape( 'if provided `Infinity` for `x` and a finite `v`, the function returns `-Infinity`', opts, function test( t ) {
66+
var y = logpdf( PINF, 1.0 );
67+
t.equal( y, NINF, 'returns -Infinity' );
68+
t.end();
69+
});
70+
71+
tape( 'if provided `-Infinity` for `x` and a finite `v`, the function returns `-Infinity`', opts, function test( t ) {
72+
var y = logpdf( NINF, 1.0 );
73+
t.equal( y, NINF, 'returns -Infinity' );
74+
t.end();
75+
});
76+
77+
tape( 'if provided `Infinity` for `v`, the function returns `NaN`', opts, function test( t ) {
6478
var y;
6579

80+
y = logpdf( 0.0, PINF );
81+
t.equal( isnan( y ), true, 'returns NaN' );
82+
83+
y = logpdf( NaN, PINF );
84+
t.equal( isnan( y ), true, 'returns NaN' );
85+
86+
y = logpdf( PINF, PINF );
87+
t.equal( isnan( y ), true, 'returns NaN' );
88+
89+
y = logpdf( NINF, PINF );
90+
t.equal( isnan( y ), true, 'returns NaN' );
91+
92+
t.end();
93+
});
94+
95+
tape( 'if provided a nonpositive `v`, the function always returns `NaN`', opts, function test( t ) {
96+
var y;
97+
98+
y = logpdf( 2.0, 0.0 );
99+
t.equal( isnan( y ), true, 'returns NaN' );
100+
101+
y = logpdf( 2.0, -1.0 );
102+
t.equal( isnan( y ), true, 'returns NaN' );
103+
66104
y = logpdf( 0.0, -1.0 );
67105
t.equal( isnan( y ), true, 'returns NaN' );
68106

69-
y = logpdf( 0.0, 0.0 );
107+
y = logpdf( 2.0, NINF );
70108
t.equal( isnan( y ), true, 'returns NaN' );
71109

72110
t.end();
73111
});
74112

75-
tape( 'the function evaluates the logpdf for `x` given a large range of `v` and `x`', opts, function test( t ) {
113+
tape( 'the function evaluates the logpdf for `x` given parameter `v` (when `x` and `v` are small)', opts, function test( t ) {
76114
var expected;
77115
var delta;
78116
var tol;
@@ -81,26 +119,23 @@ tape( 'the function evaluates the logpdf for `x` given a large range of `v` and
81119
var y;
82120
var i;
83121

84-
expected = largeLarge.expected;
85-
x = largeLarge.x;
86-
v = largeLarge.v;
122+
expected = smallSmall.expected;
123+
x = smallSmall.x;
124+
v = smallSmall.v;
87125
for ( i = 0; i < x.length; i++ ) {
88-
y = logpdf( x[ i ], v[ i ] );
89-
if ( y === expected[ i ] ) {
90-
t.equal( y, expected[ i ], 'x: ' + x[ i ] + ', v: ' + v[ i ] + ', y: ' + y + ', expected: ' + expected[ i ] );
126+
y = logpdf( x[i], v[i] );
127+
if ( y === expected[i] ) {
128+
t.equal( y, expected[i], 'x: '+x[i]+'. v: '+v[i]+', y: '+y+', expected: '+expected[i] );
91129
} else {
92130
delta = abs( y - expected[ i ] );
93-
tol = 2.0 * EPS * abs( expected[ i ] );
94-
if ( tol < 1e-14 ) {
95-
tol = 1e-14; // Set a minimum tolerance
96-
}
97-
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. v: ' + v[ i ] + '. y: ' + y + '. E: ' + expected[ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' );
131+
tol = 10.0 * EPS * abs( expected[ i ] );
132+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+v[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
98133
}
99134
}
100135
t.end();
101136
});
102137

103-
tape( 'the function evaluates the logpdf for `x` given a large range of `v` and small range of `x`', opts, function test( t ) {
138+
tape( 'the function evaluates the logpdf for `x` given parameter `v` (when `x` is large and `v` small)', opts, function test( t ) {
104139
var expected;
105140
var delta;
106141
var tol;
@@ -113,22 +148,19 @@ tape( 'the function evaluates the logpdf for `x` given a large range of `v` and
113148
x = largeSmall.x;
114149
v = largeSmall.v;
115150
for ( i = 0; i < x.length; i++ ) {
116-
y = logpdf( x[ i ], v[ i ] );
117-
if ( y === expected[ i ] ) {
118-
t.equal( y, expected[ i ], 'x: ' + x[ i ] + ', v: ' + v[ i ] + ', y: ' + y + ', expected: ' + expected[ i ] );
151+
y = logpdf( x[i], v[i] );
152+
if ( y === expected[i] ) {
153+
t.equal( y, expected[i], 'x: '+x[i]+'. v: '+v[i]+', y: '+y+', expected: '+expected[i] );
119154
} else {
120155
delta = abs( y - expected[ i ] );
121-
tol = 2.0 * EPS * abs( expected[ i ] );
122-
if ( tol < 1e-14 ) {
123-
tol = 1e-14; // Set a minimum tolerance
124-
}
125-
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. v: ' + v[ i ] + '. y: ' + y + '. E: ' + expected[ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' );
156+
tol = 10.0 * EPS * abs( expected[ i ] );
157+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+v[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
126158
}
127159
}
128160
t.end();
129161
});
130162

131-
tape( 'the function evaluates the logpdf for `x` given a small range of `v` and large range of `x`', opts, function test( t ) {
163+
tape( 'the function evaluates the logpdf for `x` given parameter `v` (when `x` is small and `v` large)', opts, function test( t ) {
132164
var expected;
133165
var delta;
134166
var tol;
@@ -141,22 +173,19 @@ tape( 'the function evaluates the logpdf for `x` given a small range of `v` and
141173
x = smallLarge.x;
142174
v = smallLarge.v;
143175
for ( i = 0; i < x.length; i++ ) {
144-
y = logpdf( x[ i ], v[ i ] );
145-
if ( y === expected[ i ] ) {
146-
t.equal( y, expected[ i ], 'x: ' + x[ i ] + ', v: ' + v[ i ] + ', y: ' + y + ', expected: ' + expected[ i ] );
176+
y = logpdf( x[i], v[i] );
177+
if ( y === expected[i] ) {
178+
t.equal( y, expected[i], 'x: '+x[i]+'. v: '+v[i]+', y: '+y+', expected: '+expected[i] );
147179
} else {
148180
delta = abs( y - expected[ i ] );
149-
tol = 2.0 * EPS * abs( expected[ i ] );
150-
if ( tol < 1e-14 ) {
151-
tol = 1e-14; // Set a minimum tolerance
152-
}
153-
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. v: ' + v[ i ] + '. y: ' + y + '. E: ' + expected[ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' );
181+
tol = 50.0 * EPS * abs( expected[ i ] );
182+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+v[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
154183
}
155184
}
156185
t.end();
157186
});
158187

159-
tape( 'the function evaluates the logpdf for `x` given a small range of `v` and `x`', opts, function test( t ) {
188+
tape( 'the function evaluates the logpdf for `x` given parameter `v` (when `x` and `v` are large)', opts, function test( t ) {
160189
var expected;
161190
var delta;
162191
var tol;
@@ -165,20 +194,17 @@ tape( 'the function evaluates the logpdf for `x` given a small range of `v` and
165194
var y;
166195
var i;
167196

168-
expected = smallSmall.expected;
169-
x = smallSmall.x;
170-
v = smallSmall.v;
197+
expected = largeLarge.expected;
198+
x = largeLarge.x;
199+
v = largeLarge.v;
171200
for ( i = 0; i < x.length; i++ ) {
172-
y = logpdf( x[ i ], v[ i ] );
173-
if ( y === expected[ i ] ) {
174-
t.equal( y, expected[ i ], 'x: ' + x[ i ] + ', v: ' + v[ i ] + ', y: ' + y + ', expected: ' + expected[ i ] );
201+
y = logpdf( x[i], v[i] );
202+
if ( y === expected[i] ) {
203+
t.equal( y, expected[i], 'x: '+x[i]+'. v: '+v[i]+', y: '+y+', expected: '+expected[i] );
175204
} else {
176205
delta = abs( y - expected[ i ] );
177-
tol = 2.0 * EPS * abs( expected[ i ] );
178-
if ( tol < 1e-14 ) {
179-
tol = 1e-14; // Set a minimum tolerance
180-
}
181-
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. v: ' + v[ i ] + '. y: ' + y + '. E: ' + expected[ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' );
206+
tol = 40.0 * EPS * abs( expected[ i ] );
207+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+v[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
182208
}
183209
}
184210
t.end();

0 commit comments

Comments
 (0)