Skip to content

Commit 6f1a799

Browse files
chore: updates minor mistakes and fix tests
--- 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: passed - 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: passed - task: lint_c_benchmarks status: na - 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 f768887 commit 6f1a799

File tree

6 files changed

+27
-63
lines changed

6 files changed

+27
-63
lines changed

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ for ( i = 0; i < 10; i++ ) {
173173

174174
#### stdlib_base_dists_levy_quantile( p, mu, c )
175175

176-
Returns the quantile function for a Lévy distribution with location parameter `mu` and scale parameter `c`.
176+
Evaluates the [quantile function][quantile-function] for a [Lévy][levy-distribution] distribution with parameters `mu` (location parameter) and `c` (scale parameter).
177177

178178
```c
179-
double out = stdlib_base_dists_levy_quantile( 1.1, 0.0, 1.0 );
180-
// returns NaN
179+
double out = stdlib_base_dists_levy_quantile( 0.8, 0.0, 1.0 );
180+
// returns ~15.58
181181
```
182182

183183
The function accepts the following arguments:
@@ -210,7 +210,6 @@ double stdlib_base_dists_levy_quantile( const double p, const double mu, const d
210210
211211
```c
212212
#include "stdlib/stats/base/dists/levy/quantile.h"
213-
214213
#include <stdlib.h>
215214
#include <stdio.h>
216215
@@ -229,7 +228,7 @@ int main( void ) {
229228
p = random_uniform( 0.0, 1.0 );
230229
mu = random_uniform( 0.0, 10.0 );
231230
c = random_uniform( 0.0, 10.0 );
232-
y = stdlib_base_dists_levy_quantile( mu, c );
231+
y = stdlib_base_dists_levy_quantile( p, mu, c );
233232
printf( "p: %lf, µ: %lf, c: %lf, Q(p;µ,c): %lf\n", p, mu, c, y );
234233
}
235234
}

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/examples/c/example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ int main( void ) {
3737
mu = random_uniform( 0.0, 10.0 );
3838
c = random_uniform( 0.0, 10.0 );
3939
y = stdlib_base_dists_levy_quantile( p, mu, c );
40-
printf( "p:%lf, µ: %lf, c: %lf, Q(p;µ,c): %lf\n", p, mu, c, y );
40+
printf( "p: %lf, µ: %lf, c: %lf, Q(p;µ,c): %lf\n", p, mu, c, y );
4141
}
4242
}

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/lib/native.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' );
2828
/**
2929
* Evaluates the quantile function for a Lévy distribution with location parameter `mu` and scale parameter `c` at a probability `p`.
3030
*
31+
* @private
3132
* @param {Probability} p - input value
3233
* @param {number} mu - location parameter
3334
* @param {NonNegativeNumber} c - scale parameter

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
* @return evaluated quantile function
3030
*
3131
* @example
32-
* double y = stdlib_base_levy_quantile( 1.1, 0.0, 1.0 );
33-
* // returns NaN
32+
* double y = stdlib_base_levy_quantile( 0.8, 0.0, 1.0 );
33+
* // returns ~15.58
3434
*/
3535
double stdlib_base_dists_levy_quantile( const double p, const double mu, const double c ) {
3636
double fval;
@@ -45,5 +45,5 @@ double stdlib_base_dists_levy_quantile( const double p, const double mu, const d
4545
return 0.0 / 0.0; //NaN
4646
}
4747
fval = stdlib_base_erfcinv( p );
48-
return mu + ( c / ( 2.0*fval*fval ) );
48+
return mu + ( c / ( 2.0 * fval * fval ) );
4949
}

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/test/test.native.js

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,9 @@ tape( 'the function evaluates the quantile function at `p` given positive `mu`',
111111
c = positiveMean.c;
112112
for ( i = 0; i < p.length; i++ ) {
113113
y = quantile( p[i], mu[i], c[i] );
114-
if ( expected[i] !== null ) {
115-
if ( y === expected[i] ) {
116-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
117-
} else {
118-
delta = abs( y - expected[ i ] );
119-
tol = 20.0 * EPS * abs( expected[ i ] );
120-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
121-
}
122-
}
114+
delta = abs( y - expected[ i ] );
115+
tol = 20.0 * EPS * abs( expected[ i ] );
116+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
123117
}
124118
t.end();
125119
});
@@ -140,15 +134,9 @@ tape( 'the function evaluates the quantile function at `p` given negative `mu`',
140134
c = negativeMean.c;
141135
for ( i = 0; i < p.length; i++ ) {
142136
y = quantile( p[i], mu[i], c[i] );
143-
if ( expected[i] !== null ) {
144-
if ( y === expected[i] ) {
145-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
146-
} else {
147-
delta = abs( y - expected[ i ] );
148-
tol = 350.0 * EPS * abs( expected[ i ] );
149-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
150-
}
151-
}
137+
delta = abs( y - expected[ i ] );
138+
tol = 350.0 * EPS * abs( expected[ i ] );
139+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
152140
}
153141
t.end();
154142
});
@@ -169,15 +157,9 @@ tape( 'the function evaluates the quantile function at `p` given large variance
169157
c = largeVariance.c;
170158
for ( i = 0; i < p.length; i++ ) {
171159
y = quantile( p[i], mu[i], c[i] );
172-
if ( expected[i] !== null ) {
173-
if ( y === expected[i] ) {
174-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
175-
} else {
176-
delta = abs( y - expected[ i ] );
177-
tol = 30.0 * EPS * abs( expected[ i ] );
178-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
179-
}
180-
}
160+
delta = abs( y - expected[ i ] );
161+
tol = 30.0 * EPS * abs( expected[ i ] );
162+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
181163
}
182164
t.end();
183165
});

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/test/test.quantile.js

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,9 @@ tape( 'the function evaluates the quantile function at `p` given positive `mu`',
102102
c = positiveMean.c;
103103
for ( i = 0; i < p.length; i++ ) {
104104
y = quantile( p[i], mu[i], c[i] );
105-
if ( expected[i] !== null ) {
106-
if ( y === expected[i] ) {
107-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
108-
} else {
109-
delta = abs( y - expected[ i ] );
110-
tol = 20.0 * EPS * abs( expected[ i ] );
111-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
112-
}
113-
}
105+
delta = abs( y - expected[ i ] );
106+
tol = 20.0 * EPS * abs( expected[ i ] );
107+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
114108
}
115109
t.end();
116110
});
@@ -131,15 +125,9 @@ tape( 'the function evaluates the quantile function at `p` given negative `mu`',
131125
c = negativeMean.c;
132126
for ( i = 0; i < p.length; i++ ) {
133127
y = quantile( p[i], mu[i], c[i] );
134-
if ( expected[i] !== null ) {
135-
if ( y === expected[i] ) {
136-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
137-
} else {
138-
delta = abs( y - expected[ i ] );
139-
tol = 350.0 * EPS * abs( expected[ i ] );
140-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
141-
}
142-
}
128+
delta = abs( y - expected[ i ] );
129+
tol = 350.0 * EPS * abs( expected[ i ] );
130+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
143131
}
144132
t.end();
145133
});
@@ -160,15 +148,9 @@ tape( 'the function evaluates the quantile function at `p` given large variance
160148
c = largeVariance.c;
161149
for ( i = 0; i < p.length; i++ ) {
162150
y = quantile( p[i], mu[i], c[i] );
163-
if ( expected[i] !== null ) {
164-
if ( y === expected[i] ) {
165-
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
166-
} else {
167-
delta = abs( y - expected[ i ] );
168-
tol = 30.0 * EPS * abs( expected[ i ] );
169-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
170-
}
171-
}
151+
delta = abs( y - expected[ i ] );
152+
tol = 30.0 * EPS * abs( expected[ i ] );
153+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
172154
}
173155
t.end();
174156
});

0 commit comments

Comments
 (0)