feat: add implementation of stats/base/dists/anglit/cdf#10596
feat: add implementation of stats/base/dists/anglit/cdf#10596bhargava-d16 wants to merge 8 commits intostdlib-js:developfrom
stats/base/dists/anglit/cdf#10596Conversation
Signed-off-by: Bhargav Dabhade <bhargava2005dabhade@gmail.com>
---
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: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: missing_dependencies
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: missing_dependencies
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Signed-off-by: Bhargav Dabhade <bhargava2005dabhade@gmail.com>
---
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: na
- 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: passed
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
Signed-off-by: Bhargav Dabhade <bhargava2005dabhade@gmail.com>
---
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: na
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
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: na
- task: lint_package_json
status: passed
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
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: na
- task: lint_package_json
status: passed
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
add implementation of stats/base/dists/anglit/cdfAdd implementation of stats/base/dists/anglit/cdf
Add implementation of stats/base/dists/anglit/cdfadd implementation of stats/base/dists/anglit/cdf
add implementation of stats/base/dists/anglit/cdfstats/base/dists/anglit/cdf
Neerajpathak07
left a comment
There was a problem hiding this comment.
@bhargava-d16 Didn't get a chance to take an in-depth look. For now have left out a few comments!!
| double sigma[ 100 ]; | ||
| double mu[ 100 ]; | ||
| double x[ 100 ]; | ||
| double y; |
There was a problem hiding this comment.
| double y; | |
| static double benchmark( void ) { | |
| double sigma[ 100 ]; | |
| double mu[ 100 ]; | |
| double x[ 100 ]; | |
| double elapsed; | |
| double y; |
Ordering by length
| } else { | ||
| delta = abs( y - expected[i] ); | ||
| tol = 2.0 * EPS * abs( expected[i] ); | ||
| t.ok(delta <= tol, 'within tolerance. x: '+x[i]+'. mu: '+mu[i]+'. σ: '+sigma[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.'); |
There was a problem hiding this comment.
here this can optimized by utilizing the in-house utility of isAlmostSameValue from @stdlib/assert/is-almost-same-value.
Ref:-
If you feel this adds more value do go ahead and update it in the other test files as well.
|
|
||
| #### stdlib_base_dists_anglit_cdf( x, mu, sigma ) | ||
|
|
||
| Evaluates the cumulative distribution function (CDF) for Anglit distribution. |
There was a problem hiding this comment.
Let's sync this description documented here with the one used for the C implementation at main.c.
---
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: passed
- 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: missing_dependencies
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
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: na
- 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: passed
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
| @@ -0,0 +1,74 @@ | |||
|
|
|||
| {{alias}}( x, mu, sigma ) | |||
| Evaluates the cumulative distribution function (CDF) for anglit | |||
There was a problem hiding this comment.
Missing article "an" before "anglit". Should be "for an anglit distribution" here and "of an anglit distribution" on line 47.
| Evaluates the cumulative distribution function (CDF) for anglit | |
| Evaluates the cumulative distribution function (CDF) for an anglit |
|
|
||
| {{alias}}.factory( mu, sigma ) | ||
| Returns a function for evaluating the cumulative distribution | ||
| function (CDF) of anglit distribution with location parameter |
There was a problem hiding this comment.
Same missing article here:
| function (CDF) of anglit distribution with location parameter | |
| function (CDF) of an anglit distribution with location parameter |
| // TypeScript Version: 4.1 | ||
|
|
||
| /** | ||
| * Evaluates the cumulative distribution function (CDF) for Anglit distribution. |
There was a problem hiding this comment.
Missing article "an" before "Anglit" in several places in this file. Let's also be consistent and use lowercases here.
| * Evaluates the cumulative distribution function (CDF) for Anglit distribution. | |
| * Evaluates the cumulative distribution function (CDF) for an anglit distribution. |
| * @param {number} mu - location parameter | ||
| * @param {number} sigma - scale parameter | ||
| * @returns {number} evaluated CDF | ||
| * |
There was a problem hiding this comment.
Two things: sigma should be typed {PositiveNumber} (since sigma <= 0 returns NaN), and the return type should be {Probability}, not {number}.
| * @param {number} mu - location parameter | |
| * @param {number} sigma - scale parameter | |
| * @returns {number} evaluated CDF | |
| * | |
| * @param {number} x - input value | |
| * @param {number} mu - location parameter | |
| * @param {PositiveNumber} sigma - scale parameter | |
| * @returns {Probability} evaluated CDF |
| * | ||
| * @private | ||
| * @param {number} x - input value | ||
| * @returns {number} evaluated CDF |
There was a problem hiding this comment.
Return type should be {Probability}.
| * @returns {number} evaluated CDF | |
| * @returns {Probability} evaluated CDF |
| * @param {number} x - input value | ||
| * @param {number} mu - location parameter | ||
| * @param {number} sigma - scale parameter | ||
| * @returns {number} evaluated CDF |
There was a problem hiding this comment.
Same as main.js: sigma should be {PositiveNumber} and return type should be {Probability}.
| * @param {number} x - input value | |
| * @param {number} mu - location parameter | |
| * @param {number} sigma - scale parameter | |
| * @returns {number} evaluated CDF | |
| * @param {number} x - input value | |
| * @param {number} mu - location parameter | |
| * @param {PositiveNumber} sigma - scale parameter | |
| * @returns {Probability} evaluated CDF |
|
|
||
| b.tic(); | ||
| for ( i = 0; i < b.iterations; i++ ) { | ||
| y = cdf(x[ i % x.length ], mu[ i % mu.length ], sigma[ i % sigma.length ]); |
There was a problem hiding this comment.
Missing spaces inside the parentheses per stdlib style:
| y = cdf(x[ i % x.length ], mu[ i % mu.length ], sigma[ i % sigma.length ]); | |
| y = cdf( x[ i % x.length ], mu[ i % mu.length ], sigma[ i % sigma.length ] ); |
---
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: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- 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: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Progresses: #9960
Description
This pull request:
stats/base/dists/anglit/cdfRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
@stdlib-js/reviewers