-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
feat(stats): add C implementation for stats/base/dists/chisquare/mgf
#4593
feat(stats): add C implementation for stats/base/dists/chisquare/mgf
#4593
Conversation
--- 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 ---
Coverage Report
The above coverage report was generated for the changes in this PR. |
/stdlib lint-autofix |
Thank you for the OH. I was wondering if I can get some feedback from you on this PR. This is my most recent PR of all the ones I have created, based on learning from previous ones. I hope I can use the feedback I get on this PR and make any necessary changes in my other PRs as well based on this one. Thank you so much! |
@anandkaranubc Taking a look now... |
|
||
result = stdlib_base_dists_chisquare_mgf( t, k ); | ||
|
||
printf( "t: %lf, k: %lf, MGF: %lf \n", t, k, result ); |
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.
See JS example:
printf( "t: %lf, k: %lf, MGF: %lf \n", t, k, result ); | |
printf( "t: %lf, k: %lf, M_X(t;k): %lf \n", t, k, result ); |
/stdlib update-copyright-years |
|
||
result = stdlib_base_dists_chisquare_mgf( t, k ); | ||
|
||
printf( "t: %lf, k: %lf, MGF: %lf \n", t, k, result ); |
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.
printf( "t: %lf, k: %lf, MGF: %lf \n", t, k, result ); | |
printf( "t: %lf, k: %lf, M_X(t;k): %lf \n", t, k, result ); |
double t; | ||
double k; | ||
double result; | ||
int i; |
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.
By convention, we order variable declarations by length:
double t; | |
double k; | |
double result; | |
int i; | |
double result; | |
double t; | |
double k; | |
int i; |
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.
thanks for mentioning! Was checking the other PRs comments so that I may fix the similar mistakes in mine! ehe!
/stdlib lint-autofix |
"include": "./include", | ||
"example": "./examples", |
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.
Ordered alphabetically to make the CI linter happy:
"include": "./include", | |
"example": "./examples", | |
"example": "./examples", | |
"include": "./include", |
#include <stdio.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.
This file should be tab-indented. We had a bug on CI that caused the EditorConfig linting to not catch these. Make sure you have EditorConfig setup in your IDE; then saving C files should automatically indent them using TABs
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md | ||
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md | ||
{ | ||
# List of files to include in this file: |
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.
Should be two-space indented. Should be correctly formatted on save when EditorConfig is setup.
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md | ||
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md | ||
{ | ||
# Define variables to be used throughout the configuration for all targets: |
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.
Two-space indentation.
* @example | ||
* double y = stdlib_base_dists_chisquare_mgf( 0.4, 2.0 ); | ||
* // returns ~5.0 | ||
* | ||
* @example | ||
* double y = stdlib_base_dists_chisquare_mgf( -1.0, 5.0 ); | ||
* // returns ~0.0642 | ||
* | ||
* @example | ||
* double y = stdlib_base_dists_chisquare_mgf( 0.0, 10.0 ); | ||
* // returns 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.
Per convention, we only keep one example in the C files:
* @example | |
* double y = stdlib_base_dists_chisquare_mgf( 0.4, 2.0 ); | |
* // returns ~5.0 | |
* | |
* @example | |
* double y = stdlib_base_dists_chisquare_mgf( -1.0, 5.0 ); | |
* // returns ~0.0642 | |
* | |
* @example | |
* double y = stdlib_base_dists_chisquare_mgf( 0.0, 10.0 ); | |
* // returns 1.0 | |
*/ | |
* @example | |
* double y = stdlib_base_dists_chisquare_mgf( 0.4, 2.0 ); | |
* // returns ~5.0 | |
*/ |
* // returns 1.0 | ||
*/ | ||
double stdlib_base_dists_chisquare_mgf( const double t, const double k ) { | ||
if ( stdlib_base_is_nan( t ) || stdlib_base_is_nan( k ) || k < 0.0 || t >= 0.5 ) { |
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.
Should be TAB-indentation here. You could also break up the if-clause over multiple lines.
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 the changes have been merged successfully! 😃
lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/README.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Philipp Burckhardt <[email protected]>
lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/src/main.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/examples/c/example.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/chisquare/mgf/README.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Philipp Burckhardt <[email protected]>
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.
Thanks for your updates! PR should be in good shape now. Will merge shortly after CI checks have passed.
PR Commit Message
Please review the above commit message and make any necessary adjustments. |
Resolves
#3506
Description
Purpose of this pull request
This pull request:
Related Issues
Does this pull request have any related issues?
This pull request:
Questions
Any questions for reviewers of this pull request?
No.
Other Information
Any other relevant information?
No.
Checklist
Please ensure the following tasks are completed before submitting this pull request:
@stdlib-js/reviewers