Skip to content

Commit

Permalink
refactor: base implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranavchiku committed Sep 2, 2024
1 parent 45f9026 commit 00b131a
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions lib/node_modules/@stdlib/lapack/base/iladlr/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,30 @@ var max = require( '@stdlib/math/base/special/fast/max' );
*/
function iladlr( M, N, A, strideA1, strideA2, offsetA ) {
var out;
var sa0;
var sa1;
var i;
var j;

if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
sa0 = strideA1;
sa1 = strideA2;
} else {
sa0 = strideA2;
sa1 = strideA1;
}

if ( M === 0 ) {
return 0;
}
if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
if ( A[ offsetA + ( ( M - 1 ) * strideA1 ) ] !== 0.0 || A[ offsetA + ( ( M - 1 ) * strideA1 ) + ( ( N - 1 ) * strideA2 ) ] ) {
return M - 1;
}
// Scan up each column tracking the last zero row seen.
out = -1;
for ( j = 0; j < N; j++ ) {
i = M - 1;
while ( i >= 0 && A[ offsetA + ( i * strideA1 ) + ( j * strideA2 ) ] === 0.0 ) {
i -= 1;
}
out = max( out, i );
}
return out;
}
// column-major
if ( A[ offsetA + ( ( M - 1 ) * strideA2 ) ] !== 0.0 || A[ offsetA + ( ( M - 1 ) * strideA2 ) + ( ( N - 1 ) * strideA1 ) ] ) {
if ( A[ offsetA + ( ( M - 1 ) * sa0 ) ] !== 0.0 || A[ offsetA + ( ( M - 1 ) * sa0 ) + ( ( N - 1 ) * sa1 ) ] ) {

Check warning on line 68 in lib/node_modules/@stdlib/lapack/base/iladlr/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

This line has a length of 115. Maximum allowed is 80
return M - 1;
}
// Scan up each column tracking the last zero row seen.
out = -1;
for ( j = 0; j < N; j++ ) {
i = M - 1;
while ( i >= 0 && A[ offsetA + ( i * strideA2 ) + ( j * strideA1 ) ] === 0.0 ) {
while ( i >= 0 && A[ offsetA + ( i * sa0 ) + ( j * sa1 ) ] === 0.0 ) {
i -= 1;
}
out = max( out, i );
Expand Down

0 comments on commit 00b131a

Please sign in to comment.