Skip to content
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

feat: add C ndarray implementation for blas/base/zscal #4864

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

Conversation

aman-095
Copy link
Member

Resolves #2039.

Description

What is the purpose of this pull request?

This pull request adds C ndarray implementation for zscal.

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: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - 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 BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). label Jan 23, 2025
@stdlib-bot
Copy link
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/zscal $\color{green}379/379$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}379/379$
$\color{green}+100.00\%$

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

@aman-095 aman-095 added Feature Issue or pull request for adding a new feature. C Issue involves or relates to C. labels Jan 23, 2025
@aman-095 aman-095 marked this pull request as ready for review January 23, 2025 09:30
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jan 23, 2025
var ix;
var i;

if ( N <= 0 ) {
return zx;
}
// Reinterpret the input array as a real-valued array of interleaved real and imaginary components:
view = reinterpret( zx, 0 );
Copy link
Member

Choose a reason for hiding this comment

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

@aman-095 Please revert this refactoring. I just recently updated this to avoid complex number instantiation. Don't simply copy-paste from cscal.

@@ -32,7 +32,7 @@ var ndarray = require( './ndarray.js' );
* @param {PositiveInteger} N - number of indexed elements
* @param {Complex128} za - constant
* @param {Complex128Array} zx - input array
* @param {integer} strideZX - `zx` stride length
* @param {integer} strideX - `zx` stride length
Copy link
Member

Choose a reason for hiding this comment

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

FTR, I recently changed these: c97212e#diff-1135e703968b45bc6a897ad9dc728fb0d90a6b633a520e9c455d7bc6c13a78caR36

Namely, because we are not consistent. Personally, instead of za and zx, I'd prefer if we just used alpha and x for both real and complex. The use of za, ca, etc, stems from Fortran in order to signal the dtype. I think we just create more work for ourselves when going from real to complex by following suit and renaming variables from x to cx or zx. The function name and the C type signatures are enough to convey what is expected. I don't think we need to encode the type info directly into the parameter names themselves.

t.end();
});

tape( 'the function supports a negative `zx` stride', function test( t ) {
Copy link
Member

Choose a reason for hiding this comment

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

@aman-095 Why is this added given L250 which tests the same thing?

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.

Left an initial round of comments.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Jan 25, 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). C Issue involves or relates to C. Feature Issue or pull request for adding a new feature. Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Add BLAS bindings and implementations for linear algebra (tracking issue)
3 participants