File tree Expand file tree Collapse file tree 4 files changed +8
-19
lines changed
lib/node_modules/@stdlib/stats/base/dists/bradford/stdev Expand file tree Collapse file tree 4 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,9 @@ static double benchmark( void ) {
99
99
double y ;
100
100
int i ;
101
101
102
- // Generate test data:
103
102
for ( i = 0 ; i < 100 ; i ++ ) {
104
103
c [ i ] = random_uniform ( STDLIB_CONSTANT_FLOAT64_EPS , 10.0 );
105
104
}
106
-
107
- // Run the benchmark:
108
105
t = tic ();
109
106
for ( i = 0 ; i < ITERATIONS ; i ++ ) {
110
107
y = stdlib_base_dists_bradford_stdev ( c [ i % 100 ] );
@@ -125,21 +122,17 @@ static double benchmark( void ) {
125
122
*/
126
123
int main ( void ) {
127
124
double elapsed ;
128
- int count ;
129
125
int i ;
130
126
131
127
// Use the current time to seed the pseudorandom number generator:
132
128
srand ( time ( NULL ) );
133
129
134
130
print_version ();
135
- count = 0 ;
136
131
for ( i = 0 ; i < REPEATS ; i ++ ) {
137
- count += 1 ;
138
132
printf ( "# c::%s\n" , NAME );
139
133
elapsed = benchmark ();
140
- printf ( "ok %d benchmark finished\n" , count );
141
134
print_results ( elapsed );
142
- printf ( "\n" );
135
+ printf ( "ok %d benchmark finished \n" , i + 1 );
143
136
}
144
- print_summary ( count , count );
137
+ print_summary ( REPEATS , REPEATS );
145
138
}
Original file line number Diff line number Diff line change @@ -59,10 +59,7 @@ var sqrt = require( '@stdlib/math/base/special/sqrt' );
59
59
*/
60
60
function stdev ( c ) {
61
61
var k ;
62
- if (
63
- isnan ( c ) ||
64
- c <= 0.0
65
- ) {
62
+ if ( isnan ( c ) || c <= 0.0 ) {
66
63
return NaN ;
67
64
}
68
65
k = ln ( 1.0 + c ) ;
Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ var addon = require( './../src/addon.node' );
56
56
* var v = stdev( NaN );
57
57
* // returns NaN
58
58
*/
59
- var stdev = addon ;
59
+ function stdev ( c ) {
60
+ return addon ( c ) ;
61
+ }
60
62
61
63
62
64
// EXPORTS //
Original file line number Diff line number Diff line change 33
33
*/
34
34
double stdlib_base_dists_bradford_stdev ( const double c ) {
35
35
double k ;
36
- if (
37
- stdlib_base_is_nan ( c ) ||
38
- c <= 0.0
39
- ) {
36
+ if ( stdlib_base_is_nan ( c ) || c <= 0.0 ) {
40
37
return 0.0 /0.0 ; // NaN
41
38
}
42
39
k = stdlib_base_ln ( 1.0 + c );
43
- return stdlib_base_sqrt ( ( ( ( 2.0 + c ) * k ) - ( 2.0 * c ) ) / ( 2.0 * c * k * k ) );
40
+ return stdlib_base_sqrt ( ( ( ( 2.0 + c ) * k ) - ( 2.0 * c ) ) / ( 2.0 * c * k * k ) );
44
41
}
You can’t perform that action at this time.
0 commit comments