-
-
Notifications
You must be signed in to change notification settings - Fork 835
feat: add blas/ext/base/sindex-of
#7318
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
base: develop
Are you sure you want to change the base?
Conversation
--- 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 ---
Coverage Report
The above coverage report was generated for the changes in this PR. |
--- 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: 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 ---
blas/ext/base/sindexof
blas/ext/base/sindex-of
var sindexOf = require( '@stdlib/blas/ext/base/sindex-of' ); | ||
``` | ||
|
||
#### sindexOf( N, searchElement, x, strideX\[, offsetX ] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@headlessNode This is not correct. Our practice is to always have separate APIs. One for providing an offset and another in which the offset is computed. This follows BLAS conventions. I am not sure why you decided to make the API variadic.
- **searchElement**: element to search the index of. | ||
- **x**: input [`Float32Array`][@stdlib/array/float32]. | ||
- **strideX**: index increment. | ||
- **offsetX**: starting index (_optional_). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect. Please follow existing practice.
@@ -0,0 +1,40 @@ | |||
|
|||
{{alias}}( N, searchElement, x, strideX[, offsetX ] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect.
* var idx = sindexOf( x.length, 2.0, x, 1 ); | ||
* // returns 1 | ||
*/ | ||
declare function sindexOf( N: number, searchElement: number, x: Float32Array, strideX: number, offsetX?: number ): number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In correct.
* ## Notes | ||
* | ||
* - If unable to find an element which equals a provided search element, the function returns `-1`. | ||
* - If `offsetX` is less than zero, the starting index is resolved relative to the last array element, with the last array element corresponding to `offsetX = -1`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offsets are never negative. Why are you designing the API this way? Please show me what BLAS package supports this behavior.
* @param {Number} searchElement - number to search index of | ||
* @param {Float32Array} x - input array | ||
* @param {integer} strideX - index increment | ||
* @param {NonNegativeInteger} [offsetX] - starting index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NonNegativeInteger
directly contradicts what you stated in the index.d.ts
file.
return -1; | ||
} | ||
|
||
if ( offsetX === void 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect.
|
||
if ( offsetX === void 0 ) { | ||
if ( strideX < 0 ) { | ||
ix = x.length - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should NOT be assuming or inquiring anything about x
length. Plus, this doesn't make sense at all. N
and stride
completely specify the array view defining what values are indexed.
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Progresses #2656 .
Description
This pull request:
blas/ext/base/sindexof
Related Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers