Skip to content

Commit 49df870

Browse files
committed
Updated the README to include the 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 df8b29c commit 49df870

File tree

1 file changed

+98
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/arcsine/mean

1 file changed

+98
-0
lines changed

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

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

134134
<!-- /.examples -->
135135

136+
<!-- C interface documentation. -->
137+
138+
* * *
139+
140+
<section class="c">
141+
142+
## C APIs
143+
144+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
145+
146+
<section class="intro">
147+
148+
</section>
149+
150+
<!-- /.intro -->
151+
152+
<!-- C usage documentation. -->
153+
154+
<section class="usage">
155+
156+
### Usage
157+
158+
```c
159+
#include "stdlib/stats/base/dists/arcsine/mean.h"
160+
```
161+
162+
#### stdlib_base_dists_arcsine_mean( a, b )
163+
164+
Returns the expected value (mean) of an arcsine distribution.
165+
166+
```c
167+
double out = stdlib_base_dists_arcsine_mean( 4.0, 12.0 );
168+
// returns 8.0
169+
```
170+
171+
The function accepts the following arguments:
172+
173+
- **a**: `[in] double` minimum support.
174+
- **b**: `[in] double` maximum support.
175+
176+
```c
177+
double stdlib_base_dists_arcsine_mean( const double a, const double b );
178+
```
179+
180+
</section>
181+
182+
<!-- /.usage -->
183+
184+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
185+
186+
<section class="notes">
187+
188+
</section>
189+
190+
<!-- /.notes -->
191+
192+
<!-- C API usage examples. -->
193+
194+
<section class="examples">
195+
196+
### Examples
197+
198+
```c
199+
#include "stdlib/stats/base/dists/arcsine/mean.h"
200+
#include <stdlib.h>
201+
#include <stdio.h>
202+
203+
static double random_uniform( const double min, const double max ) {
204+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
205+
return min + ( v * ( max - min ) );
206+
}
207+
208+
int main( void ) {
209+
double a;
210+
double b;
211+
double m;
212+
int i;
213+
214+
for ( i = 0; i < 10; i++ ) {
215+
a = random_uniform( -20.0, 0.0 );
216+
b = random_uniform( a, a + 40.0 );
217+
m = stdlib_base_dists_arcsine_mean( a, b );
218+
219+
printf( "a: %lf, b: %lf, Mean: %lf\n", a, b, m );
220+
}
221+
222+
return 0;
223+
}
224+
```
225+
226+
</section>
227+
228+
<!-- /.examples -->
229+
230+
</section>
231+
232+
<!-- /.c -->
233+
136234
<!-- 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. -->
137235

138236
<section class="references">

0 commit comments

Comments
 (0)