Skip to content

Commit adc427b

Browse files
committed
style: fix indentation in Rayleigh MGF C implementation
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent e90c31f commit adc427b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/node_modules/@stdlib/stats/base/dists/rayleigh/mgf/benchmark/benchmark.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/base/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var EPS = require( '@stdlib/constants/float64/eps' );
2828
var pkg = require( './../package.json' ).name;
@@ -35,21 +35,20 @@ bench( pkg, function benchmark( b ) {
3535
var sigma;
3636
var len;
3737
var t;
38-
var x;
3938
var y;
4039
var i;
4140

4241
len = 100;
4342
sigma = new Float64Array( len );
4443
t = new Float64Array( len );
4544
for ( i = 0; i < len; i++ ) {
46-
sigma[ i ] = ( randu()*20.0 ) + EPS;
47-
t[ i ] = ( randu()*20.0 ) + EPS;
45+
t[ i ] = uniform( 0.0, 1.0 );
46+
sigma[ i ] = uniform( EPS, 5.0 );
4847
}
4948

5049
b.tic();
5150
for ( i = 0; i < b.iterations; i++ ) {
52-
y = mgf( x[ i % len ], sigma[ i % len ] );
51+
y = mgf( t[ i % len ], sigma[ i % len ] );
5352
if ( isnan( y ) ) {
5453
b.fail( 'should not return NaN' );
5554
}
@@ -74,7 +73,7 @@ bench( pkg+':factory', function benchmark( b ) {
7473

7574
b.tic();
7675
for ( i = 0; i < b.iterations; i++ ) {
77-
x = ( randu()*5.0 ) - 5.0;
76+
x = uniform( -2.5, 2.5 );
7877
y = mymgf( x );
7978
if ( isnan( y ) ) {
8079
b.fail( 'should not return NaN' );

lib/node_modules/@stdlib/stats/base/dists/rayleigh/mgf/src/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#include "stdlib/math/base/assert/is_nan.h"
2121
#include "stdlib/math/base/special/exp.h"
2222
#include "stdlib/math/base/special/erf.h"
23-
24-
#define STDLIB_CONSTANT_FLOAT64_SQRT_HALF_PI 1.2533141373155002512
25-
#define STDLIB_CONSTANT_FLOAT64_SQRT2 1.4142135623730950488
23+
#include "stdlib/constants/float64/sqrt_half_pi.h"
24+
#include "stdlib/constants/float64/sqrt_two.h"
2625

2726
// MAIN //
2827

@@ -49,6 +48,6 @@ double stdlib_base_dists_rayleigh_mgf( const double t, const double sigma ) {
4948
}
5049
sigmat = t * sigma;
5150
out = 1.0 + (sigmat * stdlib_base_exp( sigmat*sigmat / 2.0 ));
52-
out *= STDLIB_CONSTANT_FLOAT64_SQRT_HALF_PI * ( stdlib_base_erf( sigmat / STDLIB_CONSTANT_FLOAT64_SQRT2 ) + 1.0 );
51+
out *= STDLIB_CONSTANT_FLOAT64_SQRT_HALF_PI * ( stdlib_base_erf( sigmat / STDLIB_CONSTANT_FLOAT64_SQRT2 ) + 1.0 );
5352
return out;
5453
}

0 commit comments

Comments
 (0)