Skip to content

Commit c4ef550

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: na - task: lint_license_headers status: passed ---
1 parent a99f045 commit c4ef550

File tree

11 files changed

+53
-46
lines changed

11 files changed

+53
-46
lines changed

lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/include/stdlib/stats/base/dists/chisquare/mgf.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ extern "C" {
2929
/**
3030
* Evaluates the moment-generating function (MGF) for a chi-squared distribution
3131
* with degrees of freedom `k` at a value `t`.
32-
*
33-
* @param t input value
34-
* @param k degrees of freedom (must be non-negative)
35-
* @return evaluated MGF
3632
*/
3733
double stdlib_base_dists_chisquare_mgf( const double t, const double k );
3834

lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var abs = require( '@stdlib/math/base/special/abs' );
2625
var PINF = require( '@stdlib/constants/float64/pinf' );
2726
var NINF = require( '@stdlib/constants/float64/ninf' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2927
var median = require( './../lib' );
3028

3129

@@ -79,8 +77,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test
7977

8078
tape( 'the function returns the median of a raised cosine distribution', function test( t ) {
8179
var expected;
82-
var delta;
83-
var tol;
8480
var mu;
8581
var s;
8682
var y;
@@ -92,13 +88,7 @@ tape( 'the function returns the median of a raised cosine distribution', functio
9288
for ( i = 0; i < mu.length; i++ ) {
9389
y = median( mu[i], s[i] );
9490
if ( expected[i] !== null ) {
95-
if ( y === expected[i] ) {
96-
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
97-
} else {
98-
delta = abs( y - expected[ i ] );
99-
tol = 1.0 * EPS * abs( expected[ i ] );
100-
t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
101-
}
91+
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
10292
}
10393
}
10494
t.end();

lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.native.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26-
var abs = require( '@stdlib/math/base/special/abs' );
2726
var PINF = require( '@stdlib/constants/float64/pinf' );
2827
var NINF = require( '@stdlib/constants/float64/ninf' );
29-
var EPS = require( '@stdlib/constants/float64/eps' );
3028
var tryRequire = require( '@stdlib/utils/try-require' );
3129

3230

@@ -88,8 +86,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio
8886

8987
tape( 'the function returns the median of a raised cosine distribution', opts, function test( t ) {
9088
var expected;
91-
var delta;
92-
var tol;
9389
var mu;
9490
var s;
9591
var y;
@@ -101,13 +97,7 @@ tape( 'the function returns the median of a raised cosine distribution', opts, f
10197
for ( i = 0; i < mu.length; i++ ) {
10298
y = median( mu[i], s[i] );
10399
if ( expected[i] !== null ) {
104-
if ( y === expected[i] ) {
105-
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
106-
} else {
107-
delta = abs( y - expected[ i ] );
108-
tol = 1.0 * EPS * abs( expected[ i ] );
109-
t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
110-
}
100+
t.equal( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
111101
}
112102
}
113103
t.end();

lib/node_modules/@stdlib/stats/base/dists/degenerate/logpmf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ for ( i = 0; i < 100; i++ ) {
125125

126126
#### stdlib_base_dists_degenerate_logpmf( x, mu )
127127

128-
Evaluate the natural logarithm of the [probability mass function][pmf] (PMF) for a [degenerate distribution][degenerate-distribution].
128+
Evaluates the natural logarithm of the [probability mass function][pmf] (PMF) for a [degenerate distribution][degenerate-distribution].
129129

130130
```c
131131
double out = stdlib_base_dists_degenerate_logpmf( 2.0, 3.0 );

lib/node_modules/@stdlib/stats/base/dists/degenerate/stdev/benchmark/c/benchmark.c

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dists/degenerate/stdev.h"
20-
#include <math.h>
21-
#include <stdio.h>
2220
#include <stdlib.h>
21+
#include <stdio.h>
22+
#include <math.h>
2323
#include <time.h>
2424
#include <sys/time.h>
2525

2626
#define NAME "degenerate-stdev"
2727
#define ITERATIONS 1000000
2828
#define REPEATS 3
2929

30+
/**
31+
* Prints the TAP version.
32+
*/
3033
static void print_version( void ) {
3134
printf( "TAP version 13\n" );
3235
}
3336

37+
/**
38+
* Prints the TAP summary.
39+
*
40+
* @param total total number of tests
41+
* @param passing total number of passing tests
42+
*/
3443
static void print_summary( int total, int passing ) {
3544
printf( "#\n" );
3645
printf( "1..%d\n", total ); // TAP plan
@@ -40,6 +49,11 @@ static void print_summary( int total, int passing ) {
4049
printf( "# ok\n" );
4150
}
4251

52+
/**
53+
* Prints benchmarks results.
54+
*
55+
* @param elapsed elapsed time in seconds
56+
*/
4357
static void print_results( double elapsed ) {
4458
double rate = (double)ITERATIONS / elapsed;
4559
printf( " ---\n" );
@@ -49,57 +63,76 @@ static void print_results( double elapsed ) {
4963
printf( " ...\n" );
5064
}
5165

66+
/**
67+
* Returns a clock time.
68+
*
69+
* @return clock time
70+
*/
5271
static double tic( void ) {
5372
struct timeval now;
5473
gettimeofday( &now, NULL );
55-
return (double)now.tv_sec + (double)now.tv_usec / 1.0e6;
74+
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
5675
}
5776

77+
/**
78+
* Generates a random number on the interval [min,max).
79+
*
80+
* @param min minimum value (inclusive)
81+
* @param max maximum value (exclusive)
82+
* @return random number
83+
*/
5884
static double random_uniform( const double min, const double max ) {
5985
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
60-
return min + ( v * ( max - min ) );
86+
return min + ( v*(max-min) );
6187
}
6288

89+
/**
90+
* Runs a benchmark.
91+
*
92+
* @return elapsed time in seconds
93+
*/
6394
static double benchmark( void ) {
6495
double elapsed;
6596
double mu[ 100 ];
6697
double y;
67-
double start;
98+
double t;
6899
int i;
69100

70101
for ( i = 0; i < 100; i++ ) {
71102
mu[ i ] = random_uniform( -20.0, 20.0 );
72103
}
73104

74-
start = tic();
105+
t = tic();
75106
for ( i = 0; i < ITERATIONS; i++ ) {
76107
y = stdlib_base_dists_degenerate_stdev( mu[ i % 100 ] );
77-
if ( isnan( y ) ) {
108+
if ( y != y ) {
78109
printf( "should not return NaN\n" );
79110
break;
80111
}
81112
}
82-
elapsed = tic() - start;
83-
84-
if ( isnan( y ) ) {
113+
elapsed = tic() - t;
114+
if ( y != y ) {
85115
printf( "should not return NaN\n" );
86116
}
87117
return elapsed;
88118
}
89119

120+
/**
121+
* Main execution sequence.
122+
*/
90123
int main( void ) {
91124
double elapsed;
92125
int i;
93126

94-
// Seed the random number generator:
127+
// Use the current time to seed the random number generator:
95128
srand( time( NULL ) );
96129

97130
print_version();
98131
for ( i = 0; i < REPEATS; i++ ) {
99132
printf( "# c::%s\n", NAME );
100133
elapsed = benchmark();
101134
print_results( elapsed );
102-
printf( "ok %d benchmark finished\n", i + 1 );
135+
printf( "ok %d benchmark finished\n", i+1 );
103136
}
104137
print_summary( REPEATS, REPEATS );
105138
}

lib/node_modules/@stdlib/stats/base/dists/degenerate/stdev/include/stdlib/stats/base/dists/degenerate/stdev.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ extern "C" {
2828

2929
/**
3030
* Returns the standard deviation of a degenerate distribution centered at `mu`.
31-
*
32-
* @param mu constant value of the distribution
33-
* @return standard deviation
3431
*/
3532
double stdlib_base_dists_degenerate_stdev( const double mu );
3633

lib/node_modules/@stdlib/stats/base/dists/degenerate/stdev/src/addon.c

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

19-
#include "stdlib/math/base/napi/unary.h"
2019
#include "stdlib/stats/base/dists/degenerate/stdev.h"
20+
#include "stdlib/math/base/napi/unary.h"
2121

2222
// cppcheck-suppress shadowFunction
2323
STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_degenerate_stdev )

lib/node_modules/@stdlib/stats/base/dists/degenerate/stdev/src/main.c

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

19+
#include "stdlib/stats/base/dists/degenerate/stdev.h"
1920
#include "stdlib/math/base/assert/is_nan.h"
2021

2122
/**

lib/node_modules/@stdlib/stats/base/dists/weibull/cdf/test/test.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var opts = {
4747

4848
// TESTS //
4949

50-
tape( 'main export is a function', opts, opts, function test( t ) {
50+
tape( 'main export is a function', opts, function test( t ) {
5151
t.ok( true, __filename );
5252
t.strictEqual( typeof cdf, 'function', 'main export is a function' );
5353
t.end();

lib/node_modules/@stdlib/stats/base/dists/weibull/logcdf/test/test.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var opts = {
4747

4848
// TESTS //
4949

50-
tape( 'main export is a function', opts, opts, opts, function test( t ) {
50+
tape( 'main export is a function', opts, function test( t ) {
5151
t.ok( true, __filename );
5252
t.strictEqual( typeof cdf, 'function', 'main export is a function' );
5353
t.end();

0 commit comments

Comments
 (0)