Skip to content

Conversation

headlessNode
Copy link
Member


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: 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: na
  • task: lint_license_headers status: passed ---

Progresses #2656.

Description

What is the purpose of this pull request?

This pull request:

  • fix fromIndex handling in blas/ext/base/ndarray/dlast-index-of

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

---
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: 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: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Needs Review A pull request which needs code review. labels Aug 16, 2025
@headlessNode headlessNode added GSoC Google Summer of Code. gsoc: 2025 Google Summer of Code (2025). labels Aug 16, 2025
@headlessNode headlessNode requested a review from kgryte August 16, 2025 07:37
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Aug 16, 2025

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/ndarray/dlast-index-of $\color{green}146/146$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}146/146$
$\color{green}+100.00\%$

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

@headlessNode
Copy link
Member Author

@kgryte I think only this function needed the change, blas/ext/base/dlast-index-of works as expected. And coming from top-level fromIndex will get resolved here.

@kgryte
Copy link
Member

kgryte commented Aug 29, 2025

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Aug 29, 2025
Signed-off-by: Athan <kgryte@gmail.com>
@@ -78,14 +78,11 @@ function dlastIndexOf( arrays ) {
} else if ( fromIndex >= N ) {
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

@headlessNode This behavior does not match Array.prototype.lastIndexOf (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf#fromindex). Namely, when fromIndex exceeds the last index N-1, the fromIndex is clamped to the last index. We should probably follow similarly here. We should also check that index-of semantics more or less align with Array.prototype.indexOf.

@@ -78,14 +78,11 @@ function dlastIndexOf( arrays ) {
} else if ( fromIndex >= N ) {
Copy link
Member

Choose a reason for hiding this comment

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

L76 also does not align with Array.prototype.lastIndexOf. Looks like you just copied these blocks from index-of, where those blocks are correct. Here, they are not correct. You need to fix the bounds checking behavior.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Other than the bounds checking behavior, this is shaping up. Once the bounds behavior is addressed, you should double-check that the tests are correct.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). GSoC Google Summer of Code. gsoc: 2025 Google Summer of Code (2025). Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants