Skip to content

Commit 43a34b3

Browse files
authored
More ∞ Toep mul support (#50)
* More ∞ Toep mul support * update tests
1 parent f134f66 commit 43a34b3

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "InfiniteLinearAlgebra"
22
uuid = "cde9dba0-b1de-11e9-2c62-0bab9446c55c"
3-
version = "0.4.3"
3+
version = "0.4.4"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/banded/infbanded.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ similar(M::MulAdd{<:AbstractBandedLayout,<:AbstractBandedLayout}, ::Type{T}, axe
401401
# BandedFill * BandedFill
402402
###
403403

404-
copy(M::MulAdd{BandedColumns{FillLayout},BandedColumns{FillLayout},ZerosLayout}) =
404+
copy(M::MulAdd{<:BandedColumns{<:AbstractFillLayout},<:BandedColumns{<:AbstractFillLayout},ZerosLayout}) =
405405
_bandedfill_mul(M, axes(M.A), axes(M.B))
406406

407407
_bandedfill_mul(M, _, _) = copyto!(similar(M), M)
@@ -417,6 +417,13 @@ function _bandedfill_mul(M::MulAdd, ::Tuple{InfAxes,InfAxes}, ::Tuple{InfAxes,In
417417
ret
418418
end
419419

420+
_bandedfill_mul(M::MulAdd, ::Tuple{InfAxes,Any}, ::Tuple{Any,Any}) = ApplyArray(*, M.A, M.B)
421+
_bandedfill_mul(M::MulAdd, ::Tuple{InfAxes,Any}, ::Tuple{Any,InfAxes}) = ApplyArray(*, M.A, M.B)
422+
_bandedfill_mul(M::MulAdd, ::Tuple{Any,Any}, ::Tuple{Any,InfAxes}) = ApplyArray(*, M.A, M.B)
423+
_bandedfill_mul(M::MulAdd, ::Tuple{Any,InfAxes}, ::Tuple{InfAxes,InfAxes}) = ApplyArray(*, M.A, M.B)
424+
_bandedfill_mul(M::MulAdd, ::Tuple{InfAxes,InfAxes}, ::Tuple{InfAxes,Any}) = ApplyArray(*, M.A, M.B)
425+
_bandedfill_mul(M::MulAdd, ::Tuple{Any,InfAxes}, ::Tuple{InfAxes,Any}) = ApplyArray(*, M.A, M.B)
426+
420427
mulreduce(M::Mul{<:BandedColumns{<:AbstractFillLayout}, <:PertToeplitzLayout}) = ApplyArray(M)
421428
mulreduce(M::Mul{<:PertToeplitzLayout, <:BandedColumns{<:AbstractFillLayout}}) = ApplyArray(M)
422429
mulreduce(M::Mul{<:BandedColumns{<:AbstractFillLayout}, <:BandedToeplitzLayout}) = ApplyArray(M)

test/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@ end
161161
@test A .* 2.0 isa BandedMatrix{Float64,<:Fill}
162162
@test Eye(∞)*A isa BandedMatrix{Float64,<:Ones}
163163
@test A*Eye(∞) isa BandedMatrix{Float64,<:Ones}
164+
165+
@test A*A isa BandedMatrix
166+
@test (A*A)[1:10,1:10] == BandedMatrix(2 => Ones(8))
167+
168+
= _BandedMatrix(Fill(1,1,∞), ∞, -1,1)
169+
@test A*isa BandedMatrix
170+
@test*A isa BandedMatrix
171+
@test*isa BandedMatrix
172+
173+
B = _BandedMatrix(Ones(1,10),∞,-1,1)
174+
C = _BandedMatrix(Ones(1,10),10,-1,1)
175+
D = _BandedMatrix(Ones(1,∞),10,-1,1)
176+
177+
@test (A*B)[1:10,1:10] == (B*C)[1:10,1:10] == (D*A)[1:10,1:10] == D*B == (C*D)[1:10,1:10] == BandedMatrix(2 => Ones(8))
164178
end
165179

166180
@testset "Banded Broadcast" begin

0 commit comments

Comments
 (0)