Skip to content

Commit 3366806

Browse files
authored
Update for new LazyArrays (#43)
* Update for new LazyArrays * Support BlockArrays 0.10 * BandedMatrices v0.11 * v0.5
1 parent c74637a commit 3366806

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
lines changed

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockBandedMatrices"
22
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
3-
version = "0.4.6"
3+
version = "0.5"
44

55
[deps]
66
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
@@ -19,9 +19,9 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1919
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2020

2121
[compat]
22-
BandedMatrices = "0.10"
23-
BlockArrays = "0.9.1"
24-
FillArrays = "0.6.4, 0.7"
25-
LazyArrays = "0.10"
22+
BandedMatrices = "0.11"
23+
BlockArrays = "0.10"
24+
FillArrays = "0.7"
25+
LazyArrays = "0.11"
2626
MatrixFactorizations = "0.1"
2727
julia = "1"

src/BlockBandedMatrices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import LazyArrays: AbstractStridedLayout, ColumnMajor, @lazymul, MatMulMatAdd, M
2626
triangularlayout, UpperTriangularLayout, TriangularLayout, MatLdivVec,
2727
triangulardata, subarraylayout, @lazyldiv, @lazylmul,
2828
AbstractColumnMajor, DenseColumnMajor, ColumnMajor,
29-
DiagonalLayout, apply!, materialize!, AbstractMulAddStyle, mulapplystyle
29+
DiagonalLayout, apply!, materialize!, MulAdd
3030

3131
import BlockArrays: BlockSizes, nblocks, blocksize, blockcheckbounds, global2blockindex,
3232
Block, BlockSlice, getblock, unblock, setblock!, globalrange,

src/interfaceimpl.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ BroadcastStyle(::Type{<:SubArray{<:Any,2,<:PseudoBlockMatrix{<:Any,<:Diagonal},
1818
NTuple{2,BlockSlice1}}}) = BandedStyle()
1919

2020

21-
isblockbanded(K::Kron{<:Any,2}) = isbanded(first(K.arrays))
22-
isbandedblockbanded(K::Kron{<:Any,2}) = all(isbanded, K.arrays)
23-
blockbandwidths(K::Kron{<:Any,2}) = bandwidths(first(K.arrays))
24-
subblockbandwidths(K::Kron{<:Any,2}) = bandwidths(last(K.arrays))
21+
isblockbanded(K::Kron{<:Any,2}) = isbanded(first(K.args))
22+
isbandedblockbanded(K::Kron{<:Any,2}) = all(isbanded, K.args)
23+
blockbandwidths(K::Kron{<:Any,2}) = bandwidths(first(K.args))
24+
subblockbandwidths(K::Kron{<:Any,2}) = bandwidths(last(K.args))
2525
function blocksizes(K::Kron{<:Any,2})
26-
A,B = K.arrays
26+
A,B = K.args
2727
BlockSizes(Fill(size(B,1), size(A,1)), Fill(size(B,2), size(A,2)))
2828
end
2929

src/linalg.jl

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,8 @@ function add_bandwidths(A::BlockBandedMatrix,B::BlockBandedMatrix)
118118
Fill(l,nblocks(B,2)), Fill(u,nblocks(B,2))
119119
end
120120

121-
struct BlockBandedMulAddStyle <: AbstractMulAddStyle end
122-
struct BandedBlockBandedMulAddStyle <: AbstractMulAddStyle end
123-
124-
mulapplystyle(A::AbstractBlockBandedLayout, B::AbstractBlockBandedLayout) = BlockBandedMulAddStyle()
125-
mulapplystyle(A::AbstractBlockBandedLayout, B::DiagonalLayout) = mulapplystyle(A,A)
126-
mulapplystyle(A::DiagonalLayout, B::AbstractBlockBandedLayout) = mulapplystyle(B,B)
127-
mulapplystyle(A::BandedBlockBandedColumnMajor, B::BandedBlockBandedColumnMajor) = BandedBlockBandedMulAddStyle()
128-
129-
function similar(M::Mul{BlockBandedMulAddStyle}, ::Type{T}) where T
130-
A,B = M.args
131-
A isa Diagonal && return similar(B,T)
132-
B isa Diagonal && return similar(A,T)
121+
function similar(M::MulAdd{<:AbstractBlockBandedLayout,<:AbstractBlockBandedLayout}, ::Type{T}) where T
122+
A,B = M.A, M.B
133123

134124
Arows, Acols = A.block_sizes.block_sizes.cumul_sizes
135125
Brows, Bcols = B.block_sizes.block_sizes.cumul_sizes
@@ -149,10 +139,8 @@ function similar(M::Mul{BlockBandedMulAddStyle}, ::Type{T}) where T
149139
BlockSkylineMatrix{T}(undef, BlockSkylineSizes(BlockSizes((Arows,Bcols)), l, u))
150140
end
151141

152-
function similar(M::Mul{BandedBlockBandedMulAddStyle}, ::Type{T}) where T
153-
A,B = M.args
154-
A isa Diagonal && return similar(B,T)
155-
B isa Diagonal && return similar(A,T)
142+
function similar(M::MulAdd{BandedBlockBandedColumnMajor,BandedBlockBandedColumnMajor}, ::Type{T}) where T
143+
A,B = M.A, M.B
156144

157145
Arows, Acols = A.block_sizes.block_sizes.cumul_sizes
158146
Brows, Bcols = B.block_sizes.block_sizes.cumul_sizes
@@ -174,6 +162,10 @@ function similar(M::Mul{BandedBlockBandedMulAddStyle}, ::Type{T}) where T
174162
BandedBlockBandedMatrix{T}(undef, bs)
175163
end
176164

165+
similar(M::MulAdd{<:DiagonalLayout,<:AbstractBlockBandedLayout}, ::Type{T}) where T = similar(M.B,T)
166+
similar(M::MulAdd{<:AbstractBlockBandedLayout,<:DiagonalLayout}, ::Type{T}) where T = similar(M.A,T)
167+
168+
177169

178170

179171

0 commit comments

Comments
 (0)