From d092fa9c45651a36c9d6f165c2c612930a6e093b Mon Sep 17 00:00:00 2001 From: Divit Date: Tue, 10 Mar 2026 12:46:35 +0000 Subject: [PATCH] fix: bounds and indexing updated in main.js --- 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 --- --- .../array/base/banded/to-compact/lib/main.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/banded/to-compact/lib/main.js b/lib/node_modules/@stdlib/array/base/banded/to-compact/lib/main.js index ff000660199a..6939a1347091 100644 --- a/lib/node_modules/@stdlib/array/base/banded/to-compact/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/banded/to-compact/lib/main.js @@ -44,7 +44,7 @@ var zeros2d = require( '@stdlib/array/base/zeros2d' ); * ]; * * var out = toCompact( M, 1, 1, false ); -* // returns [ [ 0, 2, 4 ], [ 11, 12, 13 ], [ 3, 5, 0 ] ] +* // returns [ [ 0, 11, 2 ], [ 3, 12, 4 ], [ 5, 13, 0 ] ] * * @example * var M = [ @@ -54,7 +54,7 @@ var zeros2d = require( '@stdlib/array/base/zeros2d' ); * ]; * * var out = toCompact( M, 1, 1, true ); -* // returns [ [ 0, 11, 3 ], [ 2, 12, 5 ], [ 4, 13, 0 ] ] +* // returns [ [ 0, 2, 4 ], [ 11, 12, 13 ], [ 3, 5, 0 ] ] */ function toCompact( arr, ku, kl, colexicographic ) { var out; @@ -70,22 +70,22 @@ function toCompact( arr, ku, kl, colexicographic ) { // Check whether to store diagonals along the columns... if ( colexicographic ) { - out = zeros2d( [ N, ku+kl+1 ] ); + out = zeros2d( [ ku+kl+1, N ] ); for ( j = 0; j < N; j++ ) { - to = out[ j ]; k = ku - j; for ( i = max( 0, j-ku ); i < min( M, j+kl+1 ); i++ ) { - to[ k+i ] = arr[ i ][ j ]; + to = out[ k+i ]; + to[ j ] = arr[ i ][ j ]; } } return out; } // Store diagonals along the rows... - out = zeros2d( [ ku+kl+1, N ] ); - for ( j = 0; j < N; j++ ) { - k = ku - j; - for ( i = max( 0, j-ku ); i < min( M, j+kl+1 ); i++ ) { - out[ k+i ][ j ] = arr[ i ][ j ]; + out = zeros2d( [ M, ku+kl+1 ] ); + for ( j = 0; j < M; j++ ) { + k = kl - j; + for ( i = max( 0, j-kl ); i < min( N, j+ku+1 ); i++ ) { + out[ j ][ i+k ] = arr[ j ][ i ]; } } return out;