Skip to content

Commit 6d0b444

Browse files
authored
chore: minor clean-up
Signed-off-by: Philipp Burckhardt <[email protected]>
1 parent b7b9f89 commit 6d0b444

File tree

4 files changed

+31
-49
lines changed

4 files changed

+31
-49
lines changed

lib/node_modules/@stdlib/stats/base/dists/invgamma/logpdf/README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ for ( i = 0; i < 10; i++ ) {
171171
#include "stdlib/stats/base/dists/invgamma/logpdf.h"
172172
```
173173

174-
#### stdlib_base_dists_invgamma_logpdf( mu, b )
174+
#### stdlib_base_dists_invgamma_logpdf( alpha, beta )
175175

176176
Evaluates the natural logarithm of the probability density function (PDF) for an inverse gamma distribution with shape parameter `alpha` and scale parameter `beta` at a value `x`.
177177

@@ -183,42 +183,55 @@ double out = stdlib_base_dists_invgamma_logpdf( 2.0, 0.5, 1.0 );
183183
The function accepts the following arguments:
184184

185185
- **x**: `[in] double` input value.
186-
- **mu**: `[in] double` location parameter.
187-
- **b**: `[in] double` rate parameter.
186+
- **alpha**: `[in] double` shape parameter.
187+
- **beta**: `[in] double` scale parameter.
188188

189189
```c
190190
double stdlib_base_dists_invgamma_logpdf( const double x, const double mu, const double b );
191191
```
192192
193193
</section>
194+
194195
<!-- /.usage -->
196+
195197
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
198+
196199
<section class="notes">
200+
197201
</section>
202+
198203
<!-- /.notes -->
204+
199205
<!-- C API usage examples. -->
206+
200207
<section class="examples">
208+
201209
### Examples
210+
202211
```c
203212
#include "stdlib/stats/base/dists/laplace/logpdf.h"
213+
#include "stdlib/constants/float64/eps.h"
204214
#include <stdlib.h>
205215
#include <stdio.h>
216+
206217
static double random_uniform( const double min, const double max ) {
207218
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
208219
return min + ( v*(max-min) );
209220
}
221+
210222
int main( void ) {
211-
double mu;
212-
double b;
223+
double alpha;
224+
double beta;
213225
double x;
214226
double y;
215227
int i;
228+
216229
for ( i = 0; i < 25; i++ ) {
217-
mu = random_uniform( -5.0, 5.0 );
218-
b = random_uniform( 0.0, 20.0 );
219-
x = random_uniform( 0.0, 20.0 );
220-
y = stdlib_base_dists_invgamma_logpdf( x, mu, b );
221-
printf( "x: %lf, µ: %lf, b: %lf, logpdf(X;x,µ,b): %lf\n", x, mu, b, y );
230+
x = random_uniform( 0.0, 10.0 );
231+
alpha = random_uniform( 0.0, 10.0 );
232+
beta = random_uniform( 0.0, 10.0 );
233+
y = stdlib_base_dists_invgamma_logpdf( x, alpha, beta );
234+
printf( "x: %lf, α: %lf, β: %lf, ln(f(x;α,β))(X;x,µ,b): %lf\n", x, alpha, beta, y );
222235
}
223236
}
224237
```

lib/node_modules/@stdlib/stats/base/dists/invgamma/logpdf/examples/c/example.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ int main( void ) {
3434
int i;
3535

3636
for ( i = 0; i < 25; i++ ) {
37-
x = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
38-
alpha = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
39-
beta = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
37+
x = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
38+
alpha = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
39+
beta = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
4040
y = stdlib_base_dists_invgamma_logpdf( x, alpha, beta );
4141
printf( "x: %lf, α: %lf, β: %lf, Logpdf(X;x,α,β): %lf\n", x, alpha, beta, y );
4242
}

lib/node_modules/@stdlib/stats/base/dists/invgamma/logpdf/src/addon.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
#include "stdlib/stats/base/dists/invgamma/logpdf.h"
2020
#include "stdlib/math/base/napi/ternary.h"
2121

22-
// cppcheck-suppress shadowFunction
2322
STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( stdlib_base_dists_invgamma_logpdf )

lib/node_modules/@stdlib/stats/base/dists/invgamma/logpdf/src/main.c

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,16 @@
2323
#include "stdlib/constants/float64/ninf.h"
2424

2525
/**
26-
* Returns the natural logarithm of the probability density function (PDF) for an inverse gamma distribution with shape parameter `alpha` and scale parameter `beta` at a value `x`.
26+
* Evaluates the natural logarithm of the probability density function (PDF) for an inverse gamma distribution with shape parameter `alpha` and scale parameter `beta` at a value `x`.
2727
*
28-
* @param {number} x - input value
29-
* @param {PositiveNumber} alpha - shape parameter
30-
* @param {PositiveNumber} beta - scale parameter
31-
* @returns {number} evaluated logPDF
28+
* @param x input value
29+
* @param alpha shape parameter
30+
* @param beta scale parameter
31+
* @return evaluated logPDF
3232
*
3333
* @example
3434
* double y = stdlib_base_dists_invgamma_logpdf( 2.0, 0.5, 1.0 );
3535
* // returns ~-2.112
36-
*
37-
* @example
38-
* double y = stdlib_base_dists_invgamma_logpdf( 0.2, 1.0, 1.0 );
39-
* // returns ~-1.781
40-
*
41-
* @example
42-
* double y = stdlib_base_dists_invgamma_logpdf( -1.0, 4.0, 2.0 );
43-
* // returns -Infinity
44-
*
45-
* @example
46-
* double y = stdlib_base_dists_invgamma_logpdf( NaN, 1.0, 1.0 );
47-
* // returns NaN
48-
*
49-
* @example
50-
* double y = stdlib_base_dists_invgamma_logpdf( 0.0, NaN, 1.0 );
51-
* // returns NaN
52-
*
53-
* @example
54-
* double y = stdlib_base_dists_invgamma_logpdf( 0.0, 1.0, NaN );
55-
* // returns NaN
56-
*
57-
* @example
58-
* // Negative shape parameter:
59-
* double y = stdlib_base_dists_invgamma_logpdf( 2.0, -1.0, 1.0 );
60-
* // returns NaN
61-
*
62-
* @example
63-
* // Negative scale parameter:
64-
* double y = stdlib_base_dists_invgamma_logpdf( 2.0, 1.0, -1.0 );
65-
* // returns NaN
6636
*/
6737
double stdlib_base_dists_invgamma_logpdf( const double x, const double alpha, const double beta ) {
6838
double out;

0 commit comments

Comments
 (0)