@@ -1511,14 +1511,34 @@ function _isbanded_impl(A, kl, ku)
1511
1511
beyond ku, where the elements should all be zero. The reason we separate this from the
1512
1512
third group is that we may loop over all the rows using A[:, col] instead of A[rowrange, col],
1513
1513
which is usually faster.
1514
+
1515
+ E.g., in the following 6x10 matrix with (kl,ku) = (-1,1):
1516
+ 1 1 0 0 0 0 0 0 0 0
1517
+ 1 2 2 0 0 0 0 0 0 0
1518
+ 0 2 3 3 0 0 0 0 0 0
1519
+ 0 0 3 4 4 0 0 0 0 0
1520
+ 0 0 0 4 5 5 0 0 0 0
1521
+ 0 0 0 0 5 6 6 0 0 0
1522
+
1523
+ last_col_nonzeroblocks: 7, as every column beyond this is entirely zero
1524
+ last_col_emptytoprows: 2, as there are zeros above the stored bands beyond this column
1525
+ last_col_nonemptybottomrows: 4, as there are no zeros below the stored bands beyond this column
1526
+ colrange_onlybottomrows: 1:2, as these columns only have zeros below the stored bands
1527
+ colrange_topbottomrows: 3:4, as these columns have zeros both above and below the stored bands
1528
+ colrange_onlytoprows_nonzero: 5:7, as these columns only have zeros above the stored bands
1529
+ colrange_zero_block: 8:10, as every column in this range is filled with zeros
1530
+
1531
+ These are used to determine which rows to check for zeros in each column.
1514
1532
=#
1515
1533
1516
1534
last_col_nonzeroblocks = size (A,1 ) + ku # fully zero rectangular block beyond this column
1517
1535
last_col_emptytoprows = ku + 1 # empty top rows before this column
1518
1536
last_col_nonemptybottomrows = size (A,1 ) + kl - 1 # empty bottom rows after this column
1519
1537
1520
1538
colrange_onlybottomrows = firstindex (A,2 ): min (last_col_nonemptybottomrows, last_col_emptytoprows)
1521
- colrange_topbottomrows = max (last_col_emptytoprows, last (colrange_onlybottomrows))+ 1 : last_col_nonzeroblocks
1539
+ col_topbotrows_start = max (last_col_emptytoprows, last (colrange_onlybottomrows))+ 1
1540
+ col_topbotrows_end = min (last_col_nonemptybottomrows, last_col_nonzeroblocks)
1541
+ colrange_topbottomrows = col_topbotrows_start: col_topbotrows_end
1522
1542
colrange_onlytoprows_nonzero = last (colrange_topbottomrows)+ 1 : last_col_nonzeroblocks
1523
1543
colrange_zero_block = last_col_nonzeroblocks+ 1 : lastindex (A,2 )
1524
1544
0 commit comments