Skip to content

Commit 9b55c3f

Browse files
chore: added changes in README.md file and minor changes
1 parent 4e9e75b commit 9b55c3f

File tree

4 files changed

+104
-3
lines changed

4 files changed

+104
-3
lines changed

lib/node_modules/@stdlib/stats/base/dists/gamma/skewness/README.md

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

143143
<!-- /.examples -->
144144

145+
<!-- C interface documentation. -->
146+
147+
* * *
148+
149+
<section class="c">
150+
151+
## C APIs
152+
153+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
154+
155+
<section class="intro">
156+
157+
</section>
158+
159+
<!-- /.intro -->
160+
161+
<!-- C usage documentation. -->
162+
163+
<section class="usage">
164+
165+
### Usage
166+
167+
```c
168+
#include "stdlib/stats/base/dists/gamma/skewness.h"
169+
```
170+
171+
#### stdlib_base_dists_gamma_skewness( alpha, beta )
172+
173+
Returns the skewness of a gamma distribution.
174+
175+
```c
176+
double out = stdlib_base_dists_gamma_skewness( 1.0, 1.0 );
177+
// returns 1.0
178+
```
179+
180+
The function accepts the following arguments:
181+
182+
- **alpha**: `[in] double` shape parameter.
183+
- **beta**: `[in] double` rate parameter.
184+
185+
```c
186+
double stdlib_base_dists_gamma_skewness( const double alpha, const double beta );
187+
```
188+
189+
</section>
190+
191+
<!-- /.usage -->
192+
193+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
194+
195+
<section class="notes">
196+
197+
</section>
198+
199+
<!-- /.notes -->
200+
201+
<!-- C API usage examples. -->
202+
203+
<section class="examples">
204+
205+
### Examples
206+
207+
```c
208+
#include "stdlib/stats/base/dists/gamma/skewness.h"
209+
#include <stdlib.h>
210+
#include <stdio.h>
211+
212+
static double random_uniform( const double min, const double max ) {
213+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
214+
return min + ( v*(max-min) );
215+
}
216+
217+
int main( void ) {
218+
double alpha;
219+
double beta;
220+
double y;
221+
int i;
222+
223+
for ( i = 0; i < 25; i++ ) {
224+
alpha = random_uniform( 0.0, 20.0 );
225+
beta = random_uniform( 0.0, 20.0 );
226+
y = stdlib_base_dists_gamma_skewness( alpha, beta );
227+
printf( "α: %lf, β: %lf, skew(X;α,β): %lf\n", alpha, beta, y );
228+
}
229+
}
230+
```
231+
232+
</section>
233+
234+
<!-- /.examples -->
235+
236+
</section>
237+
238+
<!-- /.c -->
239+
145240
<!-- 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. -->
146241

147242
<section class="references">

lib/node_modules/@stdlib/stats/base/dists/gamma/skewness/benchmark/c/benchmark.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dists/gamma/skewness.h"
20+
#include "stdlib/constants/float64/eps.h"
2021
#include <stdlib.h>
2122
#include <stdio.h>
2223
#include <math.h>
@@ -100,8 +101,8 @@ static double benchmark( void ) {
100101
int i;
101102

102103
for ( i = 0; i < 100; i++ ) {
103-
alpha[ i ] = random_uniform( 0.0, 20.0 );
104-
beta[ i ] = random_uniform( 0.0, 20.0 );
104+
alpha[ i ] = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
105+
beta[ i ] = random_uniform( 0.0, 20.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
105106
}
106107

107108
t = tic();

lib/node_modules/@stdlib/stats/base/dists/gamma/skewness/lib/native.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222

2323
var addon = require( './../src/addon.node' );
2424

25+
26+
// MAIN //
27+
2528
/**
2629
* Returns the skewness of a gamma distribution.
2730
*
31+
* @private
2832
* @param {PositiveNumber} alpha - shape parameter
2933
* @param {PositiveNumber} beta - rate parameter
3034
* @returns {PositiveNumber} skewness

lib/node_modules/@stdlib/stats/base/dists/gamma/skewness/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"libpath": [],
5757
"dependencies": [
5858
"@stdlib/math/base/assert/is-nan",
59-
"@stdlib/math/base/special/sqrt"
59+
"@stdlib/math/base/special/sqrt",
60+
"@stdlib/constants/float64/eps"
6061
]
6162
},
6263
{

0 commit comments

Comments
 (0)