-
-
Notifications
You must be signed in to change notification settings - Fork 839
feat: add lapack/base/dlacn2
#7438
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: passed - 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: 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: 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: na - 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: 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 ---
--- 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: 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 ---
--- 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: 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 ---
--- 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: 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 ---
--- 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: 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 ---
--- 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: 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 ---
--- 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: 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: 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: 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: 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: passed - task: lint_package_json status: na - 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: 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 ---
|
||
#### dlacn2( N, V, X, ISGN, EST, KASE, ISAVE ) | ||
|
||
Estimates the one-norm of a square matrix `A`, using alternative indexing semantics and reverse communication for evaluating matrix-vector products. |
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.
Estimates the one-norm of a square matrix `A`, using alternative indexing semantics and reverse communication for evaluating matrix-vector products. | |
Estimates the one-norm of a square matrix `A`, using reverse communication for evaluating matrix-vector products. |
- **V**: workspace [`Float64Array`][mdn-float64array] having `N` indexed elements, used internally to store intermediate vectors. | ||
- **X**: input/output [`Float64Array`][mdn-float64array] having `N` indexed elements, contains the current or next matrix-vector product. | ||
- **ISGN**: [`Int32Array`][mdn-int32array] having `N` indexed elements, stores the sign of each element in `X` during iterations. | ||
- **EST**: single-element [`Float64Array`][mdn-float64array], on output, contains the estimated one-norm of the matrix `A`. | ||
- **KASE**: single-element [`Int32Array`][mdn-int32array] that controls the reverse communication. | ||
- **ISAVE**: [`Int32Array`][mdn-int32array] having 3 indexed elements, used internally to maintain state across multiple calls. |
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.
- **V**: workspace [`Float64Array`][mdn-float64array] having `N` indexed elements, used internally to store intermediate vectors. | |
- **X**: input/output [`Float64Array`][mdn-float64array] having `N` indexed elements, contains the current or next matrix-vector product. | |
- **ISGN**: [`Int32Array`][mdn-int32array] having `N` indexed elements, stores the sign of each element in `X` during iterations. | |
- **EST**: single-element [`Float64Array`][mdn-float64array], on output, contains the estimated one-norm of the matrix `A`. | |
- **KASE**: single-element [`Int32Array`][mdn-int32array] that controls the reverse communication. | |
- **ISAVE**: [`Int32Array`][mdn-int32array] having 3 indexed elements, used internally to maintain state across multiple calls. | |
- **V**: workspace [`Float64Array`][mdn-float64array] having `N` indexed elements. This workspace is used internally to store intermediate vectors. | |
- **X**: input/output [`Float64Array`][mdn-float64array] having `N` indexed elements. This array contains the current or next matrix-vector product. | |
- **ISGN**: [`Int32Array`][mdn-int32array] having `N` indexed elements. This array stores the sign of each element in `X` during iterations. | |
- **EST**: single-element [`Float64Array`][mdn-float64array], on output. This array contains the estimated one-norm of the matrix `A`. | |
- **KASE**: single-element [`Int32Array`][mdn-int32array] that controls the reverse communication. | |
- **ISAVE**: [`Int32Array`][mdn-int32array] having 3 indexed elements. This array is used internally to maintain state across multiple calls. |
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.
Here and below.
- **KASE**: single-element [`Int32Array`][mdn-int32array] that controls the reverse communication. | ||
- **ISAVE**: [`Int32Array`][mdn-int32array] having 3 indexed elements, used internally to maintain state across multiple calls. | ||
|
||
The reverse communication takes place using `KASE`, it may have any of these values: |
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.
The reverse communication takes place using `KASE`, it may have any of these values: | |
The reverse communication takes place using `KASE`. The single-element in `KASE` may have the following values: |
* | ||
* ## Notes | ||
* | ||
* the reverse communication takes place using `KASE`, it may have any of these values: |
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.
* the reverse communication takes place using `KASE`, it may have any of these values: | |
* The reverse communication takes place using `KASE`, it may have any of these values: |
* | ||
* ## Notes | ||
* | ||
* the reverse communication takes place using `KASE`, it may have any of these values: |
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.
* the reverse communication takes place using `KASE`, it may have any of these values: | |
* The reverse communication takes place using `KASE`. The single-element in `KASE` may have the following values: |
* var out = nint( 4.5 ); | ||
* // returns 4.0 | ||
*/ | ||
function nint( X ) { |
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.
TODO: replace once Karan's PR for round-nearest-even
gets merged.
var nint = require( './nint.js' ); | ||
|
||
|
||
// MAIN // |
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.
// MAIN // | |
// FUNCTIONS // |
And then add // MAIN //
below for the main export.
|
||
jlast = ISAVE[ offsetISAVE + strideISAVE ]; | ||
ISAVE[ offsetISAVE + strideISAVE ] = idamax( N, 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.
I suggest making your expressions a bit tighter using temporary variables here for indices.
var ii1 = offsetISAVE + strideISAVE;
var ii2 = ii1 + strideISAVE;
// ...
ISAVE[ ii1 ] && ISAVE[ ii2 ]
// ...
vi = ISAVE[ ii1 ];
// ...
X[ offsetX + ( vi * strideX ) ]
ISAVE[ offsetISAVE + ( 2 * strideISAVE ) ] = 2; | ||
|
||
ix = offsetX; | ||
for ( i = 0; i < N; i++ ) { |
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 could be replaced with blas/ext/base/dfill
.
} | ||
else if ( KASE[ 0 ] === 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.
} | |
else if ( KASE[ 0 ] === 1 ) { | |
} else if ( KASE[ 0 ] === 1 ) { |
} | ||
} | ||
|
||
expectedEST = new Float64Array( [ 25.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.
expectedEST = new Float64Array( [ 25.0 ] ); | |
// Expected values determined via the reference Fortran routines in LAPACK: | |
expectedEST = new Float64Array( [ 25.0 ] ); |
} | ||
else if ( KASE[ 0 ] === 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.
} | |
else if ( KASE[ 0 ] === 1 ) { | |
} else if ( KASE[ 0 ] === 1 ) { |
} | ||
else if ( KASE[ 0 ] === 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.
} | |
else if ( KASE[ 0 ] === 1 ) { | |
} else if ( KASE[ 0 ] === 1 ) { |
break; | ||
} | ||
else if ( KASE[ 1 ] === 1 ) { | ||
dgemv( 'no-transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 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.
dgemv( 'no-transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 1 ); | |
// A*x: | |
dgemv( 'no-transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 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.
Is work
strictly necessary here? Can we write directly to X
with dgemv
?
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.
After looking at dgemv
, agree with the choice to use a work
array. Adding a comment still stands.
dgemv( 'no-transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 1 ); | ||
dcopy( 4, work, 1, 1, X, 1, 1 ); | ||
} else if ( KASE[ 1 ] === 2 ) { | ||
dgemv( 'transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 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.
dgemv( 'transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 1 ); | |
// A^T * x: | |
dgemv( 'transpose', 4, 4, 1.0, A, 4, 1, 0, X, 1, 1, 0, work, 1, 1 ); |
|
||
work = new Float64Array( 1 ); | ||
|
||
while ( true ) { |
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.
May be good to add a comment before the while
loop explaining, conceptually, what you are doing here.
Description
This pull request:
lapack/base/dlacn2
Related Issues
No.
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers