feat: add stats/base/dists/anglit/stdev#11489
feat: add stats/base/dists/anglit/stdev#11489Om-A-osc wants to merge 1 commit intostdlib-js:developfrom
stats/base/dists/anglit/stdev#11489Conversation
---
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: passed
- task: lint_r
status: na
- task: lint_c_src
status: passed
- task: lint_c_examples
status: passed
- task: lint_c_benchmarks
status: passed
- 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
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
Neerajpathak07
left a comment
There was a problem hiding this comment.
@Om-A-osc Thank you for working on this!!! Left out a few comments.
| static double benchmark( void ) { | ||
| double elapsed; | ||
| double sigma[ 100 ]; | ||
| double mu[ 100 ]; |
There was a problem hiding this comment.
| double mu[ 100 ]; | |
| static double benchmark( void ) { | |
| double sigma[ 100 ]; | |
| double mu[ 100 ]; | |
| double elapsed; |
Ordering by length
| // TypeScript Version: 4.1 | ||
|
|
||
| /** | ||
| * Returns the standard deviation for an anglit distribution with location `mu` and scale `sigma`. |
There was a problem hiding this comment.
| * Returns the standard deviation for an anglit distribution with location `mu` and scale `sigma`. | |
| * Returns the standard deviation for an anglit distribution with location parameter `mu` and scale parameter `sigma`. |
Feel free to update the description wherever relevant throughout the PR if you feel this makes more sense.
| NaN | ||
|
|
||
| See Also | ||
| -------- |
There was a problem hiding this comment.
| -------- | |
| -------- | |
|
|
||
| // VARIABLES // | ||
|
|
||
| // sqrt( (π²/16) - (1/2) ): |
There was a problem hiding this comment.
| // sqrt( (π²/16) - (1/2) ): | |
| // sqrt( (π²/16) - (1/2) ) |
| #include "stdlib/stats/base/dists/anglit/stdev.h" | ||
| #include "stdlib/math/base/assert/is_nan.h" | ||
|
|
||
| static const double STDLIB_ANGLIT_STDEV_CONST = 0.3418336950449515; // sqrt( (π²/16) - (1/2) ) |
There was a problem hiding this comment.
Using this const here would be acceptable as per discussed in the Office Hours conducted on April 14th.
| static const double STDLIB_ANGLIT_STDEV_CONST = 0.3418336950449515; // sqrt( (π²/16) - (1/2) ) | |
| // sqrt( (π²/16) - (1/2) ) | |
| static const double STDEV_CONST = 0.3418336950449515; |
Let's stay consist with the variable name as per used in the JS implementation. Also something which we closely follow for special math functions. Re:- powf
| stdlib_base_is_nan( sigma ) || | ||
| sigma <= 0.0 | ||
| ) { | ||
| return 0.0/0.0; // NaN |
There was a problem hiding this comment.
| return 0.0/0.0; // NaN | |
| return 0.0 / 0.0; // NaN |
|
|
||
| # Arguments | ||
|
|
||
| * `mean`: mean parameter (mu) |
There was a problem hiding this comment.
| * `mean`: mean parameter (mu) | |
| * `mean`: location parameter (mu) |
mu here is a location parameter not mean.
| # Examples | ||
|
|
||
| ``` python | ||
| python> mean = rand(1000) * 10.0 - 5.0 |
| """Generate fixture data.""" | ||
| mean = rand(1000) * 10.0 - 5.0 | ||
| scale = rand(1000) * 10.0 + 1.0 | ||
| gen(mean, scale, "data.json") |
There was a problem hiding this comment.
Would be better to do a clean-up on this runner file.
|
|
||
| The [standard deviation][stdev] for an [anglit][anglit-distribution] random variable with location parameter `mu` and scale parameter `sigma` is | ||
|
|
||
| <!-- <equation class="equation" label="eq:anglit_stdev" align="center" raw="\operatorname{SD}(X) = \sigma \sqrt{\left({\frac{\pi^{2}}{16}}-\frac{1}{2}\right)}" alt="Standard deviation for an anglit distribution."> --> |

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/stdevRelated Issues
This pull request has the following related issues:
Questions
No.
Other
Implementation follows existing distribution mode modules and adheres to stdlib coding standards.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
N/A
@stdlib-js/reviewers