Skip to content

Commit 41cea0d

Browse files
fix(readme): add c implementation for @stdlib/stats/base/dists/invgamma/pdf
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- 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 6ac3196 commit 41cea0d

File tree

1 file changed

+87
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/smean

1 file changed

+87
-0
lines changed

lib/node_modules/@stdlib/stats/base/smean/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,93 @@ console.log( v );
175175

176176
<!-- /.examples -->
177177

178+
<!-- C interface documentation. -->
179+
180+
* * *
181+
182+
<section class="c">
183+
184+
## C APIs
185+
186+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
187+
188+
<section class="intro">
189+
190+
</section>
191+
192+
<!-- /.intro -->
193+
194+
<!-- C usage documentation. -->
195+
196+
<section class="usage">
197+
198+
### Usage
199+
200+
```c
201+
#include "stdlib/stats/base/dists/invgamma/pdf.h"
202+
```
203+
204+
#### stdlib_base_dists_invgamma_pdf( x, alpha, beta )
205+
206+
Evaluates the probability density function (PDF) for an inverse gamma distribution with shape parameter `alpha` and scale parameter `beta` at a value `x`.
207+
208+
```c
209+
double out = stdlib_base_dists_invgamma_pdf( 2.0, 0.5, 1.0 );
210+
// returns ~0.121
211+
```
212+
213+
The function accepts the following arguments:
214+
215+
- **x**: `[in] double` value parameter.
216+
- **alpha**: `[in] double` shape parameter.
217+
- **beta**: `[in] double` rate parameter.
218+
219+
```c
220+
double stdlib_base_dists_invgamma_pdf( const double x, const double alpha, const double beta );
221+
```
222+
223+
</section>
224+
<!-- /.usage -->
225+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
226+
<section class="notes">
227+
</section>
228+
<!-- /.notes -->
229+
<!-- C API usage examples. -->
230+
<section class="examples">
231+
### Examples
232+
```c
233+
#include "stdlib/stats/base/dists/invgamma/pdf.h"
234+
#include "stdlib/constants/float64/eps.h"
235+
#include <stdlib.h>
236+
#include <stdio.h>
237+
static double random_uniform( const double min, const double max ) {
238+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
239+
return min + ( v*(max-min) );
240+
}
241+
int main( void ) {
242+
double alpha;
243+
double beta;
244+
double x;
245+
double y;
246+
int i;
247+
for ( i = 0; i < 25; i++ ) {
248+
x = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
249+
alpha = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
250+
beta = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
251+
y = stdlib_base_dists_invgamma_pdf( x, alpha, beta );
252+
printf( "x: %lf, α: %lf, β: %lf, Pdf(X;x,α,β): %lf\n", x, alpha, beta, y );
253+
}
254+
}
255+
```
256+
257+
</section>
258+
259+
<!-- /.examples -->
260+
261+
</section>
262+
263+
<!-- /.c -->
264+
178265
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
179266

180267
<section class="related">

0 commit comments

Comments
 (0)