From 06ee33c78b79ae4e0c567bd3c1eee2a0619cf57f Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 12 Jul 2026 19:09:54 +0530 Subject: [PATCH 1/2] fix: indexing issue, make the representation of lastv consistent with lapack --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../@stdlib/lapack/base/dlarf1f/lib/base.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js index 5ab4295edda4..574c1f2943dd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js @@ -108,16 +108,19 @@ function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, o i = offsetV + ( ( lastv-1 ) * strideV ); // Move `i` to the last non-zero element in `V`, where we assume that V[0] = 1, and it is not stored, so we shouldn't access it... - while ( lastv > 0 && V[ i ] === 0.0 ) { + + // This means that `lastv` should be greater than 1 as it represents the last 1 based index with a zero value + while ( lastv > 1 && V[ i ] === 0.0 ) { lastv -= 1; i -= strideV; } + if ( isLeftSide( side ) ) { // Scan for the last non-zero column in `C`: - lastc = iladlc( lastv + 1, N, C, strideC1, strideC2, offsetC ) + 1; // adjust by `+1` to account for the difference between zero-based and one-based indexing + lastc = iladlc( lastv, N, C, strideC1, strideC2, offsetC ) + 1; // adjust by `+1` to account for the difference between zero-based and one-based indexing } else { // Scan for the last non-zero row in `C`: - lastc = iladlr( M, lastv + 1, C, strideC1, strideC2, offsetC ) + 1; // // adjust by `+1` to account for the difference between zero-based and one-based indexing + lastc = iladlr( M, lastv, C, strideC1, strideC2, offsetC ) + 1; // // adjust by `+1` to account for the difference between zero-based and one-based indexing } // Return `C` unchanged if all elements in `C` are zero... if ( lastc === 0 ) { @@ -127,7 +130,7 @@ function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, o // Form: H*C // If `lastv = 1`, this means `V = 1`, so we just need to compute `C = H*C = (1-tau)*C`... - if ( lastv === 0 ) { + if ( lastv === 1 ) { // C[0,0:lastc] = (1-tau)*C[0,0:lastc] dscal( lastc, 1.0-tau, C, strideC2, offsetC ); // scale the first row } else { @@ -154,7 +157,7 @@ function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, o // Form: C*H // If `N = 1`, then `V = 1`, so we just need to compute `C = CH = C*(1-tau)`... - if ( lastv === 0 ) { + if ( lastv === 1 ) { // C[0:lastc,0] = ( 1-tau ) * C[0:lastc,0] dscal( lastc, 1.0-tau, C, strideC1, offsetC ); // scale the first column return C; From 1afb1434f3f7c2b49b5c109f79af86fa054d3adf Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 12 Jul 2026 11:18:34 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js index 574c1f2943dd..08c8cd0e9540 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js @@ -108,9 +108,7 @@ function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, o i = offsetV + ( ( lastv-1 ) * strideV ); // Move `i` to the last non-zero element in `V`, where we assume that V[0] = 1, and it is not stored, so we shouldn't access it... - - // This means that `lastv` should be greater than 1 as it represents the last 1 based index with a zero value - while ( lastv > 1 && V[ i ] === 0.0 ) { + while ( lastv > 1 && V[ i ] === 0.0 ) { // `lastv` should be greater than 1 as it represents the last one-based index with a zero value lastv -= 1; i -= strideV; }