@@ -1486,14 +1486,34 @@ function _isbanded_impl(A, kl, ku)
14861486 beyond ku, where the elements should all be zero. The reason we separate this from the
14871487 third group is that we may loop over all the rows using A[:, col] instead of A[rowrange, col],
14881488 which is usually faster.
1489+
1490+ E.g., in the following 6x10 matrix with (kl,ku) = (-1,1):
1491+ 1 1 0 0 0 0 0 0 0 0
1492+ 1 2 2 0 0 0 0 0 0 0
1493+ 0 2 3 3 0 0 0 0 0 0
1494+ 0 0 3 4 4 0 0 0 0 0
1495+ 0 0 0 4 5 5 0 0 0 0
1496+ 0 0 0 0 5 6 6 0 0 0
1497+
1498+ last_col_nonzeroblocks: 7, as every column beyond this is entirely zero
1499+ last_col_emptytoprows: 2, as there are zeros above the stored bands beyond this column
1500+ last_col_nonemptybottomrows: 4, as there are no zeros below the stored bands beyond this column
1501+ colrange_onlybottomrows: 1:2, as these columns only have zeros below the stored bands
1502+ colrange_topbottomrows: 3:4, as these columns have zeros both above and below the stored bands
1503+ colrange_onlytoprows_nonzero: 5:7, as these columns only have zeros above the stored bands
1504+ colrange_zero_block: 8:10, as every column in this range is filled with zeros
1505+
1506+ These are used to determine which rows to check for zeros in each column.
14891507 =#
14901508
14911509 last_col_nonzeroblocks = size (A,1 ) + ku # fully zero rectangular block beyond this column
14921510 last_col_emptytoprows = ku + 1 # empty top rows before this column
14931511 last_col_nonemptybottomrows = size (A,1 ) + kl - 1 # empty bottom rows after this column
14941512
14951513 colrange_onlybottomrows = firstindex (A,2 ): min (last_col_nonemptybottomrows, last_col_emptytoprows)
1496- colrange_topbottomrows = max (last_col_emptytoprows, last (colrange_onlybottomrows))+ 1 : last_col_nonzeroblocks
1514+ col_topbotrows_start = max (last_col_emptytoprows, last (colrange_onlybottomrows))+ 1
1515+ col_topbotrows_end = min (last_col_nonemptybottomrows, last_col_nonzeroblocks)
1516+ colrange_topbottomrows = col_topbotrows_start: col_topbotrows_end
14971517 colrange_onlytoprows_nonzero = last (colrange_topbottomrows)+ 1 : last_col_nonzeroblocks
14981518 colrange_zero_block = last_col_nonzeroblocks+ 1 : lastindex (A,2 )
14991519
0 commit comments