Skip to content

Commit 12bed1a

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 2dae204 commit 12bed1a

File tree

1 file changed

+95
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/chi/stdev

1 file changed

+95
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/chi/stdev/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,101 @@ for ( i = 0; i < 10; i++ ) {
116116

117117
<!-- /.examples -->
118118

119+
<!-- C interface documentation. -->
120+
121+
* * *
122+
123+
<section class="c">
124+
125+
## C APIs
126+
127+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
128+
129+
<section class="intro">
130+
131+
</section>
132+
133+
<!-- /.intro -->
134+
135+
<!-- C usage documentation. -->
136+
137+
<section class="usage">
138+
139+
### Usage
140+
141+
```c
142+
#include "stdlib/stats/base/dists/chi/stdev.h"
143+
```
144+
145+
#### stdlib_base_dists_chi_stdev( k )
146+
147+
Returns the standard deviation of a chi distribution.
148+
149+
```c
150+
double out = stdlib_base_dists_chi_stdev( 9.0 );
151+
// returns ~0.697
152+
```
153+
154+
The function accepts the following arguments:
155+
156+
- **k**: `[in] double` degrees of freedom (must be positive)
157+
158+
```c
159+
double stdlib_base_dists_chi_stdev( const double k );
160+
```
161+
162+
</section>
163+
164+
<!-- /.usage -->
165+
166+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
167+
168+
<section class="notes">
169+
170+
</section>
171+
172+
<!-- /.notes -->
173+
174+
<!-- C API usage examples. -->
175+
176+
<section class="examples">
177+
178+
### Examples
179+
180+
```c
181+
#include "stdlib/stats/base/dists/chi/stdev.h"
182+
#include <stdlib.h>
183+
#include <stdio.h>
184+
185+
static double random_uniform( const double min, const double max ) {
186+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
187+
return min + ( v * ( max - min ) );
188+
}
189+
190+
int main( void ) {
191+
double k;
192+
double result;
193+
int i;
194+
195+
for ( i = 0; i < 10; i++ ) {
196+
k = random_uniform( 0.1, 10.0 ); // Ensure `k` is positive
197+
result = stdlib_base_dists_chi_stdev( k );
198+
199+
printf( "k: %lf, Standard Deviation: %lf \n", k, result );
200+
}
201+
202+
return 0;
203+
}
204+
```
205+
206+
</section>
207+
208+
<!-- /.examples -->
209+
210+
</section>
211+
212+
<!-- /.c -->
213+
119214
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
120215

121216
<section class="references">

0 commit comments

Comments
 (0)