Skip to content
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: add accessor protocol support and refactor stats/base/nanvariancech #6048

Closed

Conversation

rahulptl165
Copy link
Contributor

…riancech

Resolves #5674 .

Description

What is the purpose of this pull request?
Add accessor protocol support and refactored @stdlib/stats/base/nanvariancech.

This pull request:

  • {{TODO: add description describing what this pull request does}}
  • Add new file lib/accessors.js.
  • modify lib/ndaaray.js.
  • modify lib/nanvariancech.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Sorry, something went wrong.

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 14, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Mar 14, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/nanvariancech 396 / 396
+ 100.00 %
46 / 46
+ 100.00 %
3 / 3
+ 100.00 %
396 / 396
+ 100.00 %

The above coverage report was generated for the changes in this PR.

Comment on lines 75 to 77
if ( N <= 0 ) {
return NaN;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( N <= 0 ) {
return NaN;
}

this is already being checked for in ndarray.js


// Find an estimate for the mean...
for ( i = 0; i < N; i++ ) {
v = xget( xbuf, ix);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
v = xget( xbuf, ix);
v = xget( xbuf, ix );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dnanvariancepn/examples/index.js

kindly refer to this to see how we write examples. also, use generic data type instead of float64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you deleting this file...


```javascript
var floor = require( '@stdlib/math/base/special/floor' );

var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ];

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should explicitly show how we're handling the NaN element


var v = nanvariancech.ndarray( N, 1, x, 2, 1 );
var v = nanvariancech.ndarray( 4, 1, x, 2, 1 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var v = nanvariancech.ndarray( 4, 1, x, 2, 1 );
var v = nanvariancech.ndarray( 5, 1, x, 2, 1 );

Comment on lines 200 to 195
var round = require( '@stdlib/math/base/special/round' );
var Float64Array = require( '@stdlib/array/float64' );
var normal = require( '@stdlib/random/array/normal' );
var nanvariancech = require( '@stdlib/stats/base/nanvariancech' );

var x;
var i;

x = new Float64Array( 10 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = round( (randu()*100.0) - 50.0 );
}
var x = normal( 10, 0, 1 );
x[4] = NaN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments as examples/index.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments for your other benchmark file

@aayush0325 aayush0325 changed the title feat: Add accessor protocol support and refactored @stdlib/stats/base/nanvariancech feat: add accessor protocol support and refactor stats/base/nanvariancech Mar 16, 2025
---
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: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - 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: na
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@rahulptl165
Copy link
Contributor Author

Hi @aayush0325, i have implemented the requested changes. Please let me know if you need any further modification.

@stdlib-bot stdlib-bot removed the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Mar 18, 2025
@aayush0325
Copy link
Member

kindly address the CI failure errors before further review, this saves a lot of time for both of us! thank you :)

---
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: passed
  - 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: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@rahulptl165 rahulptl165 force-pushed the feat/accessor-nanvariancech branch from 5c97c25 to 06fc847 Compare March 18, 2025 21:23
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Mar 18, 2025
@rahulptl165 rahulptl165 deleted the feat/accessor-nanvariancech branch March 18, 2025 21:30
@rahulptl165
Copy link
Contributor Author

Hi @aayush0325, I’m sorry for any confusion caused. this branch was removed to address some concerns. A new PR #6167 is now available with the requested changes.

Sorry again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: refactor and add protocol support to stats/base/nanvariancech
3 participants