Conversation
Add bytewise conditional selection, the Node-API bridge and native dispatch while preserving BooleanArray semantics, independent ndarray views, sequential aliases and legacy JavaScript fallback behavior. Add meaningful native parity, regression coverage and complete C package assets. Assisted-by: OpenAI Codex
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #14819.
Description
blas/ext/base/ndarray/dwherecurrently provides a JavaScript ndarray interface but no native C interface. This PR adds the complete native conditional-selection kernel, Node-API addon, optional native dispatch, and C examples/benchmark/documentation under the accepted native implementation initiative.The native kernel reads condition storage as bytes so every nonzero BooleanArray byte selects the first input, preserving ArrayBuffer-backed BooleanArray behavior. Each of the four views retains its own stride and offset, including overlapping input/output storage. Package-local guards keep previously accepted non-native buffers and scalar/error cases on the unchanged JavaScript path; fresh view metadata avoids invoking custom hooks or reusing stale serialized metadata. Common ndarray/N-API helpers are unchanged, and browser consumers continue using JavaScript.
Package scaffolding follows the existing
blas/ext/base/ndarray/dxpyconventions. The bytewise conditional loop preserves BooleanArray truthiness rather than assuming arbitrary ArrayBuffer bytes are canonical C boolean representations.Related Issues
blas/ext/base/ndarraypackages #14819Validation
Questions
No.
Other
Original
lib/main.jsis byte-for-byte unchanged. The standalone package patch and retained source hashes/output are available in the contribution campaign evidence. This PR adds one package's native interface and does not close the general tracking RFC.Checklist
AI Assistance
Yes
No
Code generation
Test/benchmark generation
Documentation (including examples)
Research and understanding
Disclosure
This contribution was authored primarily with OpenAI Codex. Codex generated the implementation, tests, benchmarks and documentation, investigated compatibility behavior, and ran the recorded validation. A second Codex agent independently reviewed and exercised the native implementation. The contributing-guidelines acknowledgment records Codex's review and application of the guidelines under benatsf's explicit authorization to contribute. It does not claim that benatsf personally read the guide or manually reviewed the code. No manual applicant review is claimed.
@stdlib-js/reviewers