-
-
Notifications
You must be signed in to change notification settings - Fork 867
feat: add lapack/base/dlartg
#7596
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: na - 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: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
--- 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: na - 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: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
--- 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: na - 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: na - task: lint_javascript_benchmarks status: na - 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 ---
--- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
--- 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: na - task: lint_package_json status: passed - 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: na - 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 ---
--- 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: na - 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: 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: na - task: lint_typescript_tests status: na - 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: passed - 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: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_license_headers status: passed ---
--- 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: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
`dlartg` constructs a Givens rotation for a two-dimensional vector such that the following equation is satisfied: | ||
|
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.
`dlartg` constructs a Givens rotation for a two-dimensional vector such that the following equation is satisfied: | |
This routine constructs a Givens rotation for a two-dimensional vector such that the following equation is satisfied: |
|
||
# dlartg | ||
|
||
> LAPACK routine to construct a Givens rotation of a two-dimensional vector that zeros out the second component. |
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.
@aayush0325 I'm a little confused. What is meant by a "two-dimensional" vector? Vectors are, by definition, one dimensional. Are you meaning a column matrix?
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.
Or maybe you are intending a two-element vector?
- **F**: single element array representing the first component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. | ||
- **G**: single element array representing the second component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. | ||
- **C**: single element array overwritten by the cosine of the rotation as a [`Float64Array`][mdn-float64array]. | ||
- **S**: single element array overwritten by the sine of the rotation as a [`Float64Array`][mdn-float64array]. | ||
- **R**: single element array overwritten by the length of the rotated vector as a [`Float64Array`][mdn-float64array]. |
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.
- **F**: single element array representing the first component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. | |
- **G**: single element array representing the second component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. | |
- **C**: single element array overwritten by the cosine of the rotation as a [`Float64Array`][mdn-float64array]. | |
- **S**: single element array overwritten by the sine of the rotation as a [`Float64Array`][mdn-float64array]. | |
- **R**: single element array overwritten by the length of the rotated vector as a [`Float64Array`][mdn-float64array]. | |
- **F**: [`Float64Array`][mdn-float64array] containing a single element representing the first component of the vector to be rotated. | |
- **G**: [`Float64Array`][mdn-float64array] containing a single element representing the second component of the vector to be rotated | |
- **C**: [`Float64Array`][mdn-float64array] containing a single element which is overwritten by the cosine of the rotation. | |
- **S**: [`Float64Array`][mdn-float64array] containing a single element which is overwritten by the sine of the rotation. | |
- **R**: [`Float64Array`][mdn-float64array] containing a single element which is overwritten by the length of the rotated vector. |
|
||
The function has the following parameters: | ||
|
||
- **F**: single element array representing the first component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. |
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.
Same comments as above.
The function has the following parameters: | ||
|
||
- **F**: single element array representing the first component of the vector to be rotated as a [`Float64Array`][mdn-float64array]. | ||
- **offsetF**: starting index for `F`. |
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.
- **offsetF**: starting index for `F`. | |
- **offsetF**: index of the element in `F`. |
It is somewhat awkward to say "starting index" when we are talking about only a single element. We can be more precise, IMO.
Applies here and below and likely elsewhere throughout this PR.
* ``` | ||
* | ||
* @private | ||
* @param {Float64Array} F - single element array representing the first component of the vector to be rotated |
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.
For the descriptions, all the same comments.
var dlamch = require( '@stdlib/lapack/base/dlamch' ); | ||
var sqrt = require( '@stdlib/math/base/special/sqrt' ); | ||
var abs = require( '@stdlib/math/base/special/fast/abs' ); | ||
var sign = require( '@stdlib/math/base/special/copysign' ); |
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.
Prefer the alias copysign
. sign
means something else in other contexts.
R[ offsetR ] = sign( d, F[ offsetF ] ); | ||
S[ offsetS ] = G[ offsetG ] / R[ offsetR ]; | ||
} else { | ||
u = min( safmax, max( safmin, f1, g1 ) ); |
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.
Prefer two calls to fast max
, rather than using maxn
; e.g., max( max( safmin, f1 ), g1 )
. Variadic functions are likely to end up in de-optimization hell. Here, we want to encourage compiler inlining.
u = min( safmax, max( safmin, f1, g1 ) ); | ||
fs = F[ offsetF ] / u; | ||
gs = G[ offsetG ] / u; | ||
d = sqrt( (fs*fs) + (gs*gs) ); |
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.
This looks like hypot
. Prefer that to avoid unnecessary underflow/overflow. I am surprised that LAPACK does not use hypot
and/or the LAPACK equivalent routine.
S[ offsetS ] = sign( 1.0, G[ offsetG ] ); | ||
R[ offsetR ] = g1; | ||
} else if ( f1 > rtmin && f1 < rtmax && g1 > rtmin && g1 < rtmax ) { | ||
d = sqrt( (F[ offsetF ]*F[ offsetF ]) + (G[ offsetG ]*G[ offsetG ]) ); |
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.
Same thing. This is hypot
.
Description
This pull request:
lapack/base/dlartg
Related Issues
No.
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers