Skip to content

Commit 030391e

Browse files
authored
Update for new BlockArrays
1 parent cceb14c commit 030391e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/ArrayInterface.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,20 +427,20 @@ function __init__()
427427
@require BlockBandedMatrices="ffab5731-97b5-5995-9138-79e8c1846df0" begin
428428
function findstructralnz(x::BlockBandedMatrices.BlockBandedMatrix)
429429
l,u=BlockBandedMatrices.blockbandwidths(x)
430-
nrowblock=BlockBandedMatrices.nblocks(x,1)
431-
ncolblock=BlockBandedMatrices.nblocks(x,2)
432-
rowsizes=[BlockBandedMatrices.blocksize(x,(i,1))[1] for i in 1:nrowblock]
433-
colsizes=[BlockBandedMatrices.blocksize(x,(1,i))[2] for i in 1:ncolblock]
430+
nrowblock=BlockBandedMatrices.blocksize(x,1)
431+
ncolblock=BlockBandedMatrices.blocksize(x,2)
432+
rowsizes=BlockBandedMatrices.blocklengths(axes(x,1))
433+
colsizes=BlockBandedMatrices.blocklengths(axes(x,2))
434434
BlockBandedMatrixIndex(nrowblock,ncolblock,rowsizes,colsizes,l,u)
435435
end
436436

437437
function findstructralnz(x::BlockBandedMatrices.BandedBlockBandedMatrix)
438438
l,u=BlockBandedMatrices.blockbandwidths(x)
439439
lambda,mu=BlockBandedMatrices.subblockbandwidths(x)
440-
nrowblock=BlockBandedMatrices.nblocks(x,1)
441-
ncolblock=BlockBandedMatrices.nblocks(x,2)
442-
rowsizes=[BlockBandedMatrices.blocksize(x,(i,1))[1] for i in 1:nrowblock]
443-
colsizes=[BlockBandedMatrices.blocksize(x,(1,i))[2] for i in 1:ncolblock]
440+
nrowblock=BlockBandedMatrices.blocksize(x,1)
441+
ncolblock=BlockBandedMatrices.blocksize(x,2)
442+
rowsizes=BlockBandedMatrices.blocklengths(axes(x,1))
443+
colsizes=BlockBandedMatrices.blocklengths(axes(x,2))
444444
BandedBlockBandedMatrixIndex(nrowblock,ncolblock,rowsizes,colsizes,l,u,lambda,mu)
445445
end
446446

@@ -454,8 +454,8 @@ function __init__()
454454
function matrix_colors(A::BlockBandedMatrices.BlockBandedMatrix)
455455
l,u=BlockBandedMatrices.blockbandwidths(A)
456456
blockwidth=l+u+1
457-
nblock=BlockBandedMatrices.nblocks(A,2)
458-
cols=[BlockBandedMatrices.blocksize(A,(1,i))[2] for i in 1:nblock]
457+
nblock=BlockBandedMatrices.blocksize(A,2)
458+
cols=blocklengths(axes(A,2))
459459
blockcolors=_cycle(1:blockwidth,nblock)
460460
#the reserved number of colors of a block is the maximum length of columns of blocks with the same block color
461461
ncolors=[maximum(cols[i:blockwidth:nblock]) for i in 1:blockwidth]
@@ -470,8 +470,8 @@ function __init__()
470470
lambda,mu=BlockBandedMatrices.subblockbandwidths(A)
471471
blockwidth=l+u+1
472472
subblockwidth=lambda+mu+1
473-
nblock=BlockBandedMatrices.nblocks(A,2)
474-
cols=[BlockBandedMatrices.blocksize(A,(1,i))[2] for i in 1:nblock]
473+
nblock=BlockBandedMatrices.blocksize(A,2)
474+
cols=blocklengths(axes(A,2))
475475
blockcolors=_cycle(1:blockwidth,nblock)
476476
#the reserved number of colors of a block is the min of subblockwidth and the largest length of columns of blocks with the same block color
477477
ncolors=[min(subblockwidth,maximum(cols[i:blockwidth:nblock])) for i in 1:min(blockwidth,nblock)]

0 commit comments

Comments
 (0)