Skip to content

Conversation

@Pranavchiku
Copy link
Member

@Pranavchiku Pranavchiku commented Mar 28, 2023


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

Progresses #2039.

Description

What is the purpose of this pull request?

This pull request:

  • Adds Fortran implementation of @stdlib/blas/base/srotg
  • Adds C implementation of @stdlib/blas/base/srotg
  • Refactors @stdlib/blas/base/srotg
  • Adds Tests , Benchmarks and Examples for C, Fortran and JS

Related 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

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?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

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.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@Pranavchiku Pranavchiku marked this pull request as draft March 28, 2023 12:48
@Pranavchiku
Copy link
Member Author

When I try to run c examples, it throws me the following log

$ make examples-c EXAMPLES_FILTER=.*/blas/base/srotg/.*

Running example: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c/example.c
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
Resolving package path...
Package path: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
Resolving package manifest...
Successfully resolved package manifest.
Resolving include directories...
Resolving source files...
Resolving libraries...
Resolving library paths...
Compiling example...
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
../../src/srotg.c:20:10: fatal error: stdlib/math/base/special/absf.h: No such file or directory
   20 | #include "stdlib/math/base/special/absf.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:107: example.out] Error 1
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
Error when attempting to compile example.
ERROR: An error was encountered during execution.

make: *** [/home/pranavchiku/stdlib/tools/make/lib/examples/c.mk:48: examples-c] Error 1

* @param s sine of the rotation angle
*/
void c_srotg( float *a, float *b, float *c, float *s ) {
float scale;
Copy link
Member

Choose a reason for hiding this comment

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

I believe this should be TAB indentation. Ensure you have EditorConfig enabled.

@kgryte
Copy link
Member

kgryte commented Apr 10, 2023

@Pranavchiku How are you running the example mentioned above? E.g., what is the command you are running?

Also, how have you tried debugging this already?

@kgryte
Copy link
Member

kgryte commented Apr 10, 2023

Feel free to push up the example code and associated Makefile. Without being able to see the files, hard to debug.

@kgryte
Copy link
Member

kgryte commented Apr 10, 2023

Can you also add an include entry to the package.json file?

@Pranavchiku
Copy link
Member Author

How are you running the example mentioned above? E.g., what is the command you are running?

make examples-c EXAMPLES_FILTER=.*/blas/base/srotg/.*

Also, how have you tried debugging this already?

Everything else looks fine, I tried playing with package.json and manifest.json but was not able to resolve this.

@Pranavchiku
Copy link
Member Author

Can you also add an include entry to the package.json file?

I am not sure. Do you mean "include": List of dependencies?

@kgryte
Copy link
Member

kgryte commented Apr 11, 2023

I mean in the "directories" field, along with src, benchmark, etc.

"doc": "./docs",
"example": "./examples",
"lib": "./lib",
"src": "./src",
Copy link
Member

Choose a reason for hiding this comment

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

Add the "include" path here.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Still, I get the same error

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Native Addons Issue involves or relates to Node.js native add-ons. BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). labels Apr 11, 2023
@kgryte
Copy link
Member

kgryte commented Apr 11, 2023

Am able to reproduce locally. Debugging now...

@kgryte
Copy link
Member

kgryte commented Apr 11, 2023

Okay. I know what the problem is. Working on a fix.

@kgryte
Copy link
Member

kgryte commented Apr 11, 2023

Should work now. In short, we need to update the build configurations to allow for using stdlib packages, which means supporting dependency resolution. Other BLAS packages, such as dcopy, etc, work with their current Makefiles as they don't depend at all on stdlib packages, such as absf, etc.

@Pranavchiku
Copy link
Member Author

Pranavchiku commented Apr 11, 2023

Okay, perfect! I will add rest of the files by today. Thank you for resolving this.

@Pranavchiku
Copy link
Member Author

@kgryte I guess binding.gyp and include.gypi needs to be modified as well ( according to new manifest.json )

When I try to build node addons

make install-node-addons NODE_ADDONS_PATTERN=blas/base/srotg

It throws

$ make install-node-addons NODE_ADDONS_PATTERN=blas/base/srotg

Cleaning add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/src'
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/src'
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 

Building add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.9.12 found at "/home/pranavchiku/conda_root/bin/python3"
(node:38420) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /home/pranavchiku/conda_root/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/pranavchiku/stdlib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pranavchiku/stdlib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pranavchiku/.cache/node-gyp/16.19.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/pranavchiku/.cache/node-gyp/16.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/pranavchiku/stdlib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/pranavchiku/.cache/node-gyp/16.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
[eval]:1
var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }
                                                                                                                                                                            ^

TypeError: Cannot read properties of undefined (reading 'length')
    at [eval]:1:173
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:313:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:78:60)
    at node:internal/main/eval_string:27:3
gyp: Call to 'node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/pranavchiku/stdlib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 5.19.0-38-generic
gyp ERR! command "/home/pranavchiku/.nvm/versions/node/v16.19.0/bin/node" "/home/pranavchiku/stdlib/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
gyp ERR! node -v v16.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
Error: failed to build add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg

@kgryte kgryte added C Issue involves or relates to C. Needs Changes Pull request which needs changes before being merged. labels Feb 23, 2024
@Planeshifter Planeshifter changed the title feat: add C implementation for @stdlib/blas/base/srotg feat: add C implementation for blas/base/srotg Sep 8, 2024
@MeKaustubh07 MeKaustubh07 changed the title feat: add C implementation for blas/base/srotg feat: add C and Fortran implementation for blas/base/srotg Jan 15, 2026
@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jan 15, 2026

Coverage Report

Package Statements Branches Functions Lines
blas/base/srotg $\color{green}318/318$
$\color{green}+0.00%$
$\color{green}16/16$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{green}318/318$
$\color{green}+0.00%$

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

@MeKaustubh07
Copy link
Contributor

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jan 15, 2026
@MeKaustubh07
Copy link
Contributor

/stdlib update-copyright-years

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jan 15, 2026
@stdlib-bot
Copy link
Contributor

/stdlib merge

@MeKaustubh07, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@MeKaustubh07
Copy link
Contributor

@kgryte ready for review

@MeKaustubh07 MeKaustubh07 added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Jan 15, 2026
@MeKaustubh07 MeKaustubh07 requested a review from kgryte January 15, 2026 17:49
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. Native Addons Issue involves or relates to Node.js native add-ons. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants