Skip to content

Commit 505511d

Browse files
committed
docs: update README with C API documentation
--- 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: na - 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 646fc0a commit 505511d

File tree

1 file changed

+98
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/degenerate/quantile

1 file changed

+98
-0
lines changed

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

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,104 @@ for ( i = 0; i < 10; i++ ) {
110110

111111
<!-- /.examples -->
112112

113+
<!-- C interface documentation. -->
114+
115+
* * *
116+
117+
<section class="c">
118+
119+
## C APIs
120+
121+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
122+
123+
<section class="intro">
124+
125+
</section>
126+
127+
<!-- /.intro -->
128+
129+
<!-- C usage documentation. -->
130+
131+
<section class="usage">
132+
133+
### Usage
134+
135+
```c
136+
#include "stdlib/stats/base/dists/degenerate/quantile.h"
137+
```
138+
139+
#### stdlib_base_dists_degenerate_quantile( p, mu )
140+
141+
Evaluates the quantile function for a degenerate distribution centered at `mu`.
142+
143+
```c
144+
double out = stdlib_base_dists_degenerate_quantile( 0.5, 2.0 );
145+
// returns 2.0
146+
```
147+
148+
The function accepts the following arguments:
149+
150+
- **p**: `[in] double` input value (probability).
151+
- **mu**: `[in] double` constant value of the distribution.
152+
153+
```c
154+
double stdlib_base_dists_degenerate_quantile( const double p, const double mu );
155+
```
156+
157+
</section>
158+
159+
<!-- /.usage -->
160+
161+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
162+
163+
<section class="notes">
164+
165+
</section>
166+
167+
<!-- /.notes -->
168+
169+
<!-- C API usage examples. -->
170+
171+
<section class="examples">
172+
173+
### Examples
174+
175+
```c
176+
#include "stdlib/stats/base/dists/degenerate/quantile.h"
177+
#include <stdlib.h>
178+
#include <stdio.h>
179+
180+
static double random_uniform( const double min, const double max ) {
181+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
182+
return min + ( v * ( max - min ) );
183+
}
184+
185+
int main( void ) {
186+
double p;
187+
double mu;
188+
double result;
189+
int i;
190+
191+
for ( i = 0; i < 10; i++ ) {
192+
p = random_uniform( 0.0, 1.0 );
193+
mu = random_uniform( -20.0, 20.0 );
194+
result = stdlib_base_dists_degenerate_quantile( p, mu );
195+
196+
printf( "p: %lf, mu: %lf, Quantile: %lf \n", p, mu, result );
197+
}
198+
199+
return 0;
200+
}
201+
```
202+
203+
</section>
204+
205+
<!-- /.examples -->
206+
207+
</section>
208+
209+
<!-- /.c -->
210+
113211
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
114212

115213
<section class="related">

0 commit comments

Comments
 (0)