Skip to content

feat: add ndarray/find #4398

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gururaj1512
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: 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 ---

type: pre_push_report
description: Results of running various checks prior to pushing changes. report:

  • task: run_javascript_examples status: passed
  • task: run_c_examples status: na
  • task: run_cpp_examples status: na
  • task: run_javascript_readme_examples status: passed
  • task: run_c_benchmarks status: na
  • task: run_cpp_benchmarks status: na
  • task: run_fortran_benchmarks status: na
  • task: run_javascript_benchmarks status: passed
  • task: run_julia_benchmarks status: na
  • task: run_python_benchmarks status: na
  • task: run_r_benchmarks status: na
  • task: run_javascript_tests status: passed ---

Resolves a part of #2656.

Description

What is the purpose of this pull request?

This pull request:

  • Adds implementation for ndarray/find

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: 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
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 30, 2024
@stdlib-bot
Copy link
Contributor

Coverage Report

Package Statements Branches Functions Lines
ndarray/find $\color{red}206/211$
$\color{green}+97.63\%$
$\color{red}28/29$
$\color{green}+96.55\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{red}206/211$
$\color{green}+97.63\%$

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

@kgryte
Copy link
Member

kgryte commented Dec 30, 2024

@gururaj1512 Before you start doing too many of things in #2656 and us needing to go back and fix things, I'd put these on pause. As mentioned in #2656, the issue is that find (and every) are reductions, and thus should support specifying axes over which to perform the reductions. And furthermore, the implementation proposed in this PR may work for the flattened case; however, it won't work for the axes case. And lastly, we should always return ndarrays, not scalars. In short, there is a bit of R&D which needs to be done in order for these to move forward.

@kgryte
Copy link
Member

kgryte commented Dec 30, 2024

One other thing: each top-level ndarray implementation should be a wrapper around a "base" implementation. Notice how in base/for-each, we write kernels for efficient iteration: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/for-each/lib. I would expect something similar for reductions.

@kgryte
Copy link
Member

kgryte commented Dec 30, 2024

So before top-level implementations, we need to create the "base" implementations.

@kgryte kgryte added the Needs Discussion Needs further discussion. label Dec 30, 2024
@gururaj1512
Copy link
Member Author

@gururaj1512 Before you start doing too many of things in #2656 and us needing to go back and fix things, I'd put these on pause. As mentioned in #2656, the issue is that find (and every) are reductions, and thus should support specifying axes over which to perform the reductions. And furthermore, the implementation proposed in this PR may work for the flattened case; however, it won't work for the axes case. And lastly, we should always return ndarrays, not scalars. In short, there is a bit of R&D which needs to be done in order for these to move forward.

Yaa I had similar doubts while creating this PR. Just created this quick PR to discuss about it.

@gururaj1512
Copy link
Member Author

@kgryte, Should we pause this, or is there something I can work on? I would love to work on issues related to this.

@kgryte
Copy link
Member

kgryte commented Dec 30, 2024

@gururaj1512 Yes, let's pause. I pinged you on the tracking issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Needs further discussion. Needs Review A pull request which needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants