-
-
Notifications
You must be signed in to change notification settings - Fork 799
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 and refactor stats/base/nanmskmax
#6161
base: develop
Are you sure you want to change the base?
feat: add accessor protocol and refactor stats/base/nanmskmax
#6161
Conversation
--- 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: passed - task: lint_javascript_tests status: passed - 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: passed - task: lint_license_headers status: passed ---
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
||
The `N` and `stride` parameters determine which elements are accessed at runtime. For example, to compute the maximum value of every other element in `x`, | ||
The `N` and stride parameters determine which elements int the strided arrays are accessed at runtime. For example, to compute the maximum value of every other element in `x`, |
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.
The `N` and stride parameters determine which elements int the strided arrays are accessed at runtime. For example, to compute the maximum value of every other element in `x`, | |
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the maximum value of every other element in `x`, |
|
||
```javascript | ||
var floor = require( '@stdlib/math/base/special/floor' ); | ||
|
||
var x = [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, 5.0, 6.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.
var x = [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, 5.0, 6.0 ]; | |
var x = [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, 5.0, 6.0, NaN ]; |
|
||
```javascript | ||
var floor = require( '@stdlib/math/base/special/floor' ); | ||
|
||
var x = [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, 5.0, 6.0 ]; | ||
var mask = [ 0, 0, 0, 0, 0, 0, 1, 1 ]; |
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.
var mask = [ 0, 0, 0, 0, 0, 0, 1, 1 ]; | |
var mask = [ 0, 0, 0, 0, 0, 0, 1, 1, 1 ]; |
|
||
var v = nanmskmax( N, x, 2, mask, 2 ); | ||
var v = nanmskmax( 4, x, 2, mask, 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.
var v = nanmskmax( 4, x, 2, mask, 2 ); | |
var v = nanmskmax( 5, x, 2, mask, 2 ); |
We should explicitly traverse over the NaN
element to show how it is being ignored by the algorithm
@@ -76,17 +73,14 @@ Note that indexing is relative to the first index. To introduce offsets, use [`t | |||
```javascript | |||
var Float64Array = require( '@stdlib/array/float64' ); | |||
var Uint8Array = require( '@stdlib/array/uint8' ); | |||
var floor = require( '@stdlib/math/base/special/floor' ); | |||
|
|||
var x0 = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, 5.0, 6.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.
same comment regarding NaN
values in examples
@@ -104,14 +103,13 @@ | |||
// Standard Usage: | |||
> var x = [ 1.0, -2.0, 2.0, 4.0, NaN ]; | |||
> var mask = [ 0, 0, 0, 1, 0 ]; | |||
> {{alias}}.ndarray( x.length, x, 1, 0, mask, 1, 0 ) | |||
> {{alias}}.ndarray( 5, x, 1, 0, mask, 1, 0 ) | |||
2.0 | |||
|
|||
// Using offset parameter: | |||
> x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, 4.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.
same comment regarding NaN
values in exaamples
@@ -26,7 +27,7 @@ import nanmskmax = require( './index' ); | |||
const x = new Float64Array( 10 ); | |||
const mask = new Uint8Array( 10 ); | |||
|
|||
nanmskmax( x.length, x, 1, mask, 1 ); // $ExpectType number | |||
nanmskmax( x.length, new AccessorArray( x ), 1, mask, 1 ); // $ExpectType number |
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.
nanmskmax( x.length, new AccessorArray( x ), 1, mask, 1 ); // $ExpectType number | |
nanmskmax( x.length, x, 1, mask, 1 ); | |
nanmskmax( x.length, new AccessorArray( x ), 1, mask, 1 ); // $ExpectType number |
don't remove the old test, add a new one for accessor arrays
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.
same comment for the ndarray
API below
|
||
x = toAccessorArray( x ); | ||
|
||
v = nanmskmax( 5, x, 2, 0, toAccessorArray( mask ), 2, 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.
v = nanmskmax( 5, x, 2, 0, toAccessorArray( mask ), 2, 0 ); | |
v = nanmskmax( 6, x, 2, 0, toAccessorArray( mask ), 2, 0 ); |
follow the commented indices given above
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.
same comment for all other instances
kindly also adhere to the file structure that we're trying to follow, your |
--- 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: passed - 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 ---
Hi @aayush0325, I have addressed requested changes. pls review it. |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves #5662 .
Description
This pull request:
accessors.js
.nanmskmax.js
.ndarray.js
.Important
Instead of above code in
nanmskmax.js
and tests files, I have used below code due to eslint warnings about maximum character allowed in a single line.If we should not bother about warnings, request changes in review, i will modify it.
Related Issues
This pull request:
stats/base/nanmskmax
#5662Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers