Skip to content

feat: add C implementation for stats/base/ndarray/sminsorted - #14358

Open
AryanSharma48 wants to merge 9 commits into
stdlib-js:developfrom
AryanSharma48:feat/stats-base-ndarray-sminsorted
Open

AryanSharma48 wants to merge 9 commits into
stdlib-js:developfrom
AryanSharma48:feat/stats-base-ndarray-sminsorted

Conversation

@AryanSharma48

@AryanSharma48 AryanSharma48 commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #14034.

Description

What is the purpose of this pull request?

This pull request:

  • adds a C implementation and Node-API native bindings for @stdlib/stats/base/ndarray/sminsorted.
  • delegates base ndarray operations directly to the underlying strided C kernel @stdlib/stats/strided/sminsorted.
  • adds C benchmark and example files exercising stdlib_base_ndarray_sminsorted.

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

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?

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

I used AI assistance (Cursor/LLM) to help research on the existing canonical reference packages (snanmin, smean), followed by code implementatio, review, linting, and local test verification.


@stdlib-js/reviewers

Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
@AryanSharma48
AryanSharma48 requested a review from a team August 17, 2026 18:33
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Aug 17, 2026
@AryanSharma48 AryanSharma48 changed the title feat: add C implementation for stats/base/ndarray/sminsorted feat: add C implementation for stats/base/ndarray/sminsorted Aug 17, 2026
@stdlib-bot

stdlib-bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/ndarray/sminsorted $\\color{green}176/176$
$\\color{green}+0.00\\%$
$\\color{green}7/7$
$\\color{green}+0.00\\%$
$\\color{green}2/2$
$\\color{green}+0.00\\%$
$\\color{green}176/176$
$\\color{green}+0.00\\%$

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

@AryanSharma48

Copy link
Copy Markdown
Contributor Author

@stdlib-js/reviewers The PR is up-to-date with develop, and all CI checks/tests are passing. Ready for review whenever you have time!

@kgryte

kgryte commented Sep 28, 2026

Copy link
Copy Markdown
Member

@ujjwalv01 Mind doing a first pass review over this PR? Cheers!

@kgryte kgryte added Feature Issue or pull request for adding a new feature. C Issue involves or relates to C. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. labels Sep 28, 2026
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/sminsorted/examples/c/example.c Outdated
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/sminsorted/lib/native.js Outdated
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/sminsorted/README.md Outdated
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/sminsorted/README.md Outdated
@ujjwalv01

Copy link
Copy Markdown
Member

@ujjwalv01 Mind doing a first pass review over this PR? Cheers!

Done, left a few small suggestions. Rest LGTM!

AryanSharma48 and others added 3 commits September 29, 2026 04:32
Co-authored-by: Ujjwal Verma <ujjwalverma010305@gmail.com>
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
fix: update copyright years, JSDoc verbs and C formatting
…bs, and C formatting

Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
@AryanSharma48

Copy link
Copy Markdown
Contributor Author

Thanks @ujjwalv01 for the review!

I've applied all your suggestions, updated the copyright years to 2026, adjusted the JSDoc description verb in lib/native.js, and cleaned up the C formatting.

(Please excuse the mistyped commit title on the previous push, accidentally had -s captured in the subject line).

This should be good for final review now!

count = 0;
for ( i = MIN; i <= MAX; i++ ) {
len = pow( 10, i );
iter = ITERATIONS / pow( 10, i - 1 );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
iter = ITERATIONS / pow( 10, i - 1 );
iter = ITERATIONS / pow( 10, i-1 );

int64_t shape[] = { 4 };

// Specify the array strides:
int64_t strides[] = { 2 * STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
int64_t strides[] = { 2 * STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };
int64_t strides[] = { 2*STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };

* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
* Copyright (c) 2026 The Stdlib Authors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) 2026 The Stdlib Authors.
* Copyright (c) 2025 The Stdlib Authors.

// MAIN //

/**
* Compute the minimum value of a sorted one-dimensional single-precision floating-point ndarray.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Compute the minimum value of a sorted one-dimensional single-precision floating-point ndarray.
* Computes the minimum value of a sorted one-dimensional single-precision floating-point ndarray.

* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
* Copyright (c) 2026 The Stdlib Authors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) 2026 The Stdlib Authors.
* Copyright (c) 2025 The Stdlib Authors.

@license Apache-2.0

Copyright (c) 2025 The Stdlib Authors.
Copyright (c) 2026 The Stdlib Authors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Copyright (c) 2026 The Stdlib Authors.
Copyright (c) 2025 The Stdlib Authors.

int64_t shape[] = { 4 };

// Specify the array strides:
int64_t strides[] = { 2 * STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
int64_t strides[] = { 2 * STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };
int64_t strides[] = { 2*STDLIB_NDARRAY_FLOAT32_BYTES_PER_ELEMENT };

@ujjwalv01

Copy link
Copy Markdown
Member

@AryanSharma48 , I think you made some changes in commit : 1373193 which are not correct, suggested a few changes;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Issue involves or relates to C. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants