feat: add C implementation for stats/base/ndarray/smediansorted#10252
feat: add C implementation for stats/base/ndarray/smediansorted#10252LoayAhmed304 wants to merge 22 commits intostdlib-js:developfrom
stats/base/ndarray/smediansorted#10252Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
stats/base/ndarray/smediansortedstats/base/ndarray/smediansorted
Planeshifter
left a comment
There was a problem hiding this comment.
Thanks for your PR! Left an initial round of comments.
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/lib/native.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/test/test.main.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/src/main.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/src/addon.c
Outdated
Show resolved
Hide resolved
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
| for ( i = 0; i < len; i++ ) { | ||
| data[ i ] = ( rand_float() * 20000.0f ) - 10000.0f; | ||
| } |
There was a problem hiding this comment.
| for ( i = 0; i < len; i++ ) { | |
| data[ i ] = ( rand_float() * 20000.0f ) - 10000.0f; | |
| } | |
| for ( i = 0; i < len; i++ ) { | |
| data[ i ] = (float)i; | |
| } |
This implementation does not generate sorted data. Since values are assigned using a random generator, the resulting array is not guaranteed to be sorted. This PR is meant to benchmark or handle sorted input.
There was a problem hiding this comment.
I've implemented the suggested ndarray generation and hence removed the time.h header and the rand_double() function since we don't deal with random values anymore (check 2c9fb40 ). However, should we really implement this as you suggested or mimic benchmark.js which creates a linear space of ordered values for a given interval? I haven't found a reference C length benchmark of a sorted-input package.
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/benchmark/c/benchmark.length.c
Outdated
Show resolved
Hide resolved
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
lib/node_modules/@stdlib/stats/base/ndarray/smediansorted/lib/native.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
Update copyright year in test file. Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
|
I've adjusted the requested changes and responded with comments with my questions. Thank you for the review 🙏 @Sachinn-64 @Planeshifter |
Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com>
Resolves #{{TODO: add issue number}}.
Description
This pull request:
stats/base/ndarray/smediansortedpackage.Related Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers