-
-
Notifications
You must be signed in to change notification settings - Fork 822
feat: add C implementation for stats/base/dists/normal/logcdf
#3988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
lib/node_modules/@stdlib/stats/base/dists/normal/logcdf/README.md
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/normal/logcdf/src/main.c
Outdated
Show resolved
Hide resolved
stats/base/dists/normal/logcdf
/stdlib update-copyright-years |
* // returns ~-0.023 | ||
*/ | ||
double stdlib_base_dists_normal_logcdf( const double x, const double mu, const double sigma ) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line can be removed.
* @param x input value | ||
* @param mu mean of the distribution | ||
* @param sigma standard deviation of the distribution | ||
* @return evaluated log CDF | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter descriptions should be aligned.
|
||
#### stdlib_base_dists_normal_logcdf( x, mu, sigma ) | ||
|
||
Evaluates the logarithm of the cumulative distribution function (logCDF) for a normal distribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evaluates the logarithm of the cumulative distribution function (logCDF) for a normal distribution. | |
Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [normal][normal-distribution] distribution with parameters `mu` (mean) and `sigma` (standard deviation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small edits, but looks good overall!
#include <time.h> | ||
|
||
static double random_uniform( const double min, const double max ) { | ||
double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All C files in this PR should use TAB-indentation.
#include "stdlib/math/base/special/abs2.h" | ||
#include "stdlib/constants/float64/ninf.h" | ||
|
||
#define INV_SQRT_TWO 0.7071067811865475 // 1/sqrt(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use static const double
rather than #define
for defining constants (offers type safety and scoped visibility of the contsant to the file, preventing any name clashes).
Resolves #3774
Description
This pull request:
Related Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers