Skip to content

Commit b3908cf

Browse files
stdlib-botnirmaljb
authored andcommitted
fix: added the missing files and modified some file
--- 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: passed - 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: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 64f0f71 commit b3908cf

7 files changed

Lines changed: 219 additions & 5 deletions

File tree

lib/node_modules/@stdlib/stats/base/dists/signrank/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
}
1515
],
1616
"main": "./lib",
17+
"gypfile": true,
1718
"directories": {
19+
"benchmark": "./benchmark",
1820
"doc": "./docs",
1921
"example": "./examples",
22+
"include": "./include",
2023
"lib": "./lib",
24+
"src": "./src",
2125
"test": "./test"
2226
},
2327
"types": "./docs/types",

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

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@license Apache-2.0
44
5-
Copyright (c) 2020 The Stdlib Authors.
5+
Copyright (c) 2026 The Stdlib Authors.
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
@@ -124,6 +124,103 @@ for ( i = 0; i < 10; i++ ) {
124124

125125
<!-- /.examples -->
126126

127+
<!-- C interface documentation. -->
128+
129+
* * *
130+
131+
<section class="c">
132+
133+
## C APIs
134+
135+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
136+
137+
<section class="intro">
138+
139+
</section>
140+
141+
<!-- /.intro -->
142+
143+
<!-- C usage documentation. -->
144+
145+
<section class="usage">
146+
147+
### Usage
148+
149+
```c
150+
#include "stdlib/stats/base/dists/signrank/quantile.h"
151+
```
152+
153+
#### stdlib_base_dists_signrank_quantile( p, n )
154+
155+
Evaluates the quantile function of the Wilcoxon signed rank test statistic with `n` observations.
156+
157+
```c
158+
double out = stdlib_base_dists_signrank_quantile( 0.8, 5 );
159+
// returns 11.0
160+
```
161+
162+
The function accepts the following arguments:
163+
164+
- **p**: `[in] double` probability value.
165+
- **n**: `[in] int32_t` number of observations.
166+
167+
```c
168+
double stdlib_base_dists_signrank_quantile( const double p, const int32_t n );
169+
```
170+
171+
</section>
172+
173+
<!-- /.usage -->
174+
175+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
176+
177+
<section class="notes">
178+
179+
</section>
180+
181+
<!-- /.notes -->
182+
183+
<!-- C API usage examples. -->
184+
185+
<section class="examples">
186+
187+
### Examples
188+
189+
```c
190+
#include "stdlib/stats/base/dists/signrank/quantile.h"
191+
#include "stdlib/math/base/special/ceil.h"
192+
#include <stdlib.h>
193+
#include <stdio.h>
194+
#include <stdint.h>
195+
196+
static double random_uniform( const double min, const double max ) {
197+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
198+
return min + ( v*(max-min) );
199+
}
200+
201+
int main( void ) {
202+
int32_t n;
203+
double p;
204+
double y;
205+
int i;
206+
207+
for ( i = 0; i < 10; i++ ) {
208+
p = random_uniform( 0.0, 1.0 );
209+
n = (int32_t)stdlib_base_ceil( random_uniform( 1.0, 20.0 ) );
210+
y = stdlib_base_dists_signrank_quantile( p, n );
211+
printf( "p: %lf, n: %d, f(x;n): %lf\n", p, n, y );
212+
}
213+
}
214+
```
215+
216+
</section>
217+
218+
<!-- /.examples -->
219+
220+
</section>
221+
222+
<!-- /.c -->
223+
127224
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
128225

129226
<section class="related">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bench( format( '%s::native', pkg ), opts, function benchmark(b) {
5151
opts = {
5252
'dtype': 'float64'
5353
};
54-
p = uniform( 100, 0.0, 30.0, opts );
54+
p = uniform( 100, 0.0, 1.0, opts );
5555
n = discreteUniform( 100, 1, 30, opts );
5656

5757
b.tic();

lib/node_modules/@stdlib/stats/base/dists/signrank/quantile/benchmark/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2025 The Stdlib Authors.
4+
# Copyright (c) 2026 The Stdlib Authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/signrank/quantile/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@
6969
]
7070
}
7171
]
72-
}
72+
}

lib/node_modules/@stdlib/stats/base/dists/signrank/quantile/src/addon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var resolve = require( 'path' ).resolve;
24+
var tape = require( 'tape' );
25+
var tryRequire = require( '@stdlib/utils/try-require' );
26+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27+
var abs = require( '@stdlib/math/base/special/abs' );
28+
var PINF = require( '@stdlib/constants/float64/pinf' );
29+
var NINF = require( '@stdlib/constants/float64/ninf' );
30+
var EPS = require( '@stdlib/constants/float64/eps' );
31+
32+
33+
// VARIABLES //
34+
35+
var quantile = tryRequire( resolve( __dirname, './../lib/native.js' ) );
36+
var opts = {
37+
'skip': ( quantile instanceof Error )
38+
};
39+
40+
41+
// FIXTURES //
42+
43+
var data = require( './fixtures/r/data.json' );
44+
45+
46+
// TESTS //
47+
48+
tape( 'main export is a function', opts, function test( t ) {
49+
t.ok( true, __filename );
50+
t.strictEqual( typeof quantile, 'function', 'main export is a function' );
51+
t.end();
52+
});
53+
54+
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
55+
var y = quantile( NaN, 1.0 );
56+
t.strictEqual( isnan( y ), true, 'returns expected value' );
57+
y = quantile( 0.0, NaN );
58+
t.strictEqual( isnan( y ), true, 'returns expected value' );
59+
t.end();
60+
});
61+
62+
tape( 'if provided a number outside `[0,1]` for `p` and a valid `n`, the function returns `NaN`', opts, function test( t ) {
63+
var y = quantile( 1.1, 1.0 );
64+
t.strictEqual( isnan( y ), true, 'returns expected value' );
65+
y = quantile( -0.1, 1.0 );
66+
t.strictEqual( isnan( y ), true, 'returns expected value' );
67+
t.end();
68+
});
69+
70+
tape( 'if provided a negative or non-integer `n`, the function returns `NaN`', opts, function test( t ) {
71+
var y;
72+
73+
y = quantile( 0.5, -1.0 );
74+
t.strictEqual( isnan( y ), true, 'returns expected value' );
75+
76+
y = quantile( 0.2, -1.0 );
77+
t.strictEqual( isnan( y ), true, 'returns expected value' );
78+
79+
y = quantile( 0.8, NINF );
80+
t.strictEqual( isnan( y ), true, 'returns expected value' );
81+
82+
y = quantile( 0.2, PINF );
83+
t.strictEqual( isnan( y ), true, 'returns expected value' );
84+
85+
t.end();
86+
});
87+
88+
tape( 'the function evaluates the quantile function at `p` given `n` observations', opts, function test( t ) {
89+
var expected;
90+
var delta;
91+
var tol;
92+
var n;
93+
var i;
94+
var p;
95+
var y;
96+
97+
expected = data.expected;
98+
p = data.p;
99+
n = data.n;
100+
for ( i = 0; i < p.length; i++ ) {
101+
y = quantile( p[i], n[i] );
102+
if ( expected[i] !== null ) {
103+
if ( y === expected[i] ) {
104+
t.strictEqual( y, expected[i], 'p: '+p[i]+', n: '+n[i]+', y: '+y+', expected: '+expected[i] );
105+
} else {
106+
delta = abs( y - expected[ i ] );
107+
tol = 1.0 * EPS * abs( expected[ i ] );
108+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
109+
}
110+
}
111+
}
112+
t.end();
113+
});

0 commit comments

Comments
 (0)