Skip to content

Commit e1b4bd1

Browse files
committed
docs: add C API documentation and usage examples for exponential mode
1 parent ee57398 commit e1b4bd1

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/exponential/mode/README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,96 @@ for ( i = 0; i < 10; i++ ) {
114114

115115
<!-- /.examples -->
116116

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

119209
<section class="references">

lib/node_modules/@stdlib/stats/base/dists/exponential/mode/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
}
1515
],
1616
"main": "./lib",
17+
"gypfile": true,
1718
"directories": {
1819
"benchmark": "./benchmark",
1920
"doc": "./docs",
2021
"example": "./examples",
22+
"include": "./include",
2123
"lib": "./lib",
24+
"src": "./src",
2225
"test": "./test"
2326
},
2427
"types": "./docs/types",

0 commit comments

Comments
 (0)