-
-
Notifications
You must be signed in to change notification settings - Fork 993
feat: add ndarray/find-last
#8724
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
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
| ```javascript | ||
| var array = require( '@stdlib/ndarray/array' ); | ||
| var ndarray2array = require( '@stdlib/ndarray/to-array' ); | ||
|
|
||
| function isEven( value ) { | ||
| return value % 2.0 === 0.0; | ||
| } | ||
|
|
||
| // Create an input ndarray: | ||
| var x = array( [ [ [ 1.0, 3.0 ], [ 5.0, 7.0 ] ], [ [ 9.0, 11.0 ], [ 13.0, 15.0 ] ] ] ); | ||
| // returns <ndarray> | ||
|
|
||
| var opts = { | ||
| 'sentinelValue': -999 | ||
| }; | ||
|
|
||
| // Perform reduction: | ||
| var out = findLast( x, opts, isEven ); | ||
| // returns <ndarray> | ||
|
|
||
| var v = out.get(); | ||
| // returns -999 | ||
| ``` |
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.
@kgryte I think there may be a bug in ndarray/find when passing a custom sentinelValue in the options object. I'm not sure how the CI for ndarray/find passed and it's missing tests.
I checked debugging ndarray/find by modifying the example in the examples/index.js, same thing. Could you confirm if there is indeed a bug in ndarray/find? I'll then open a PR for it.
Resolves stdlib-js/metr-issue-tracker#122.
Description
This pull request:
ndarray/find-lastRelated Issues
This pull request has the following related issues:
ndarray/find-lastmetr-issue-tracker#122Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers