-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add blas/ext/base/ndarray/dsort2hp
#9272
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. |
| 'dtype': 'generic' | ||
| }); | ||
|
|
||
| var out = dsort2hp( [ x, y, order ] ); |
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.
You should probably show that the return array is the first input array.
var bool = ( out === x );
// returns true| var out = dsort2hp( [ x, y, order ] ); | ||
| // returns <ndarray> | ||
|
|
||
| var arrX = ndarray2array( out ); |
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.
Using ndarray2array here is fine, as it is not readily doable to use <ndarray>[ ... ] notation above.
| for ( i = min; i <= max; i++ ) { | ||
| len = pow( 10, i ); | ||
| f = createBenchmark( len ); | ||
| bench( pkg+':len='+len, f ); |
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.
@MeKaustubh07 Mind for all future PRs going ahead and heeding the lint warning here? Namely, using @string/string/format for benchmark descriptions. This will save ourselves future work.
| Simultaneously sorts two one-dimensional double-precision floating-point | ||
| ndarrays based on the sort order of the first array using heapsort. | ||
|
|
||
| When the sort order is less than zero, the input ndarrays are sorted in |
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.
This note is not accurate. We only sort the first input ndarray in decreasing order. The second input ndarray is sorted based on the first and that likely means it is not sorted in either ascending or descending order.
| decreasing order. When the sort order is greater than zero, the input | ||
| ndarrays are sorted in increasing order. When the sort order is equal to | ||
| zero, the input ndarrays are left unchanged. | ||
|
|
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.
Compared to blas/ext/base/dsort2hp, you've left out a number of the notes regarding sort properties. Why?
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.
We should likely include those notes, with some modification, as well as include the omitted notes in the sorting packages you've already landed.
| * | ||
| * ## Notes | ||
| * | ||
| * - When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. |
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.
This note isn't accurate.
| * | ||
| * ## Notes | ||
| * | ||
| * - When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. |
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.
This note isn't accurate.
| * - When the sort order is less than zero, the input ndarrays are sorted in **decreasing** order. When the sort order is greater than zero, the input ndarrays are sorted in **increasing** order. When the sort order is equal to zero, the input ndarrays are left unchanged. | ||
| * | ||
| * @param {ArrayLikeObject<Object>} arrays - array-like object containing two one-dimensional input ndarrays and a zero-dimensional ndarray specifying the sort order | ||
| * @returns {ndarray} first input ndarray |
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.
| * @returns {ndarray} first input ndarray | |
| * @returns {Object} first input ndarray |
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.
Why do we use Object here? The reason is due to how these packages are used. Namely, they are consumed by higher-order machinery which doesn't actually pass in an ndarray here, but an object with ndarray-like properties. Hence, we use Object, rather than ndarray, where the latter conveys an instance.
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.
We could use ndarrayLike, but we've already established precedent with ArrayLikeObject<Object>.
kgryte
left a comment
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.
Left an initial review.
|
@kgryte: I understand the concerns.I’ll address all of the suggested changes and ensure greater consistency going forward to avoid this in future PRs. |
a958d5e to
c140521
Compare
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: 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
Resolves None.
Description
What is the purpose of this pull request?
This pull request:
blas/ext/base/ndarray/dsort2hpRelated Issues
Does this pull request have any related issues?
This pull request has the following related issues:
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.
AI Assistance
When authoring the changes proposed in this PR, did you use any kind of AI assistance?
If you answered "yes" above, how did you use AI assistance?
Disclosure
If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".
This PR was created by duplicating the
dsorthppackage and adapting it to compute the maximum absolute value instead of the maximum value. GitHub Copilot assisted with updating test cases, documentation, and verifying consistency across all files.@stdlib-js/reviewers