Skip to content

Commit 524dd90

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 ee9ae37 commit 524dd90

File tree

1 file changed

+95
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/degenerate/mean

1 file changed

+95
-0
lines changed

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

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

109109
<!-- /.examples -->
110110

111+
<!-- C interface documentation. -->
112+
113+
* * *
114+
115+
<section class="c">
116+
117+
## C APIs
118+
119+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
120+
121+
<section class="intro">
122+
123+
</section>
124+
125+
<!-- /.intro -->
126+
127+
<!-- C usage documentation. -->
128+
129+
<section class="usage">
130+
131+
### Usage
132+
133+
```c
134+
#include "stdlib/stats/base/dists/degenerate/mean.h"
135+
```
136+
137+
#### stdlib_base_dists_degenerate_mean( mu )
138+
139+
Returns the expected value (mean) of a degenerate distribution.
140+
141+
```c
142+
double out = stdlib_base_dists_degenerate_mean( 0.1 );
143+
// returns 0.1
144+
```
145+
146+
The function accepts the following arguments:
147+
148+
- **mu**: `[in] double` constant value of the distribution.
149+
150+
```c
151+
double stdlib_base_dists_degenerate_mean( const double mu );
152+
```
153+
154+
</section>
155+
156+
<!-- /.usage -->
157+
158+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
159+
160+
<section class="notes">
161+
162+
</section>
163+
164+
<!-- /.notes -->
165+
166+
<!-- C API usage examples. -->
167+
168+
<section class="examples">
169+
170+
### Examples
171+
172+
```c
173+
#include "stdlib/stats/base/dists/degenerate/mean.h"
174+
#include <stdlib.h>
175+
#include <stdio.h>
176+
177+
static double random_uniform( const double min, const double max ) {
178+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
179+
return min + ( v * ( max - min ) );
180+
}
181+
182+
int main( void ) {
183+
double mu;
184+
double m;
185+
int i;
186+
187+
for ( i = 0; i < 10; i++ ) {
188+
mu = random_uniform( -20.0, 20.0 );
189+
m = stdlib_base_dists_degenerate_mean( mu );
190+
191+
printf( "mu: %lf, Mean: %lf\n", mu, m );
192+
}
193+
194+
return 0;
195+
}
196+
```
197+
198+
</section>
199+
200+
<!-- /.examples -->
201+
202+
</section>
203+
204+
<!-- /.c -->
205+
111206
<!-- 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. -->
112207

113208
<section class="references">

0 commit comments

Comments
 (0)