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..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,16 +108,17 @@ 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 ) { + 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; } + 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 +128,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 +155,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;