Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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 {
Expand All @@ -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;
Expand Down