Skip to content

Commit 172d7db

Browse files
committed
tests pass!
1 parent c69c1ae commit 172d7db

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/InfiniteLinearAlgebra.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import FillArrays: AbstractFill
1111
import BandedMatrices: BandedMatrix, _BandedMatrix, bandeddata, bandwidths
1212
import LinearAlgebra: lmul!, ldiv!, matprod, qr, AbstractTriangular, AbstractQ, adjoint, transpose
1313
import LazyArrays: CachedArray, DenseColumnMajor, FillLayout, ApplyMatrix, check_mul_axes, ApplyStyle, LazyArrayApplyStyle, LazyArrayStyle,
14-
CachedMatrix, CachedArray, resizedata!, MemoryLayout, mulapplystyle
14+
CachedMatrix, CachedArray, resizedata!, MemoryLayout, mulapplystyle, LmulStyle, RmulStyle
1515
import MatrixFactorizations: ql, ql!, QLPackedQ, getL, getR, reflector!, reflectorApply!, QL, QR, QRPackedQ
1616

1717
import BlockArrays: BlockSizes, cumulsizes, _find_block, AbstractBlockVecOrMat, sizes_from_blocks
@@ -60,8 +60,18 @@ include("infqr.jl")
6060
###
6161

6262
# Fix ∞ BandedMatrix
63-
ApplyStyle(::typeof(*), ::Type{<:BandedMatrix{<:Any,<:AbstractFill,<:OneToInf}}...) =
63+
ApplyStyle(::typeof(*), ::Type{<:Diagonal}, ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}) =
64+
LmulStyle()
65+
ApplyStyle(::typeof(*), ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}, ::Type{<:Diagonal}) =
66+
RmulStyle()
67+
ApplyStyle(::typeof(*), ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}, ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}) =
68+
LazyArrayApplyStyle()
69+
ApplyStyle(::typeof(*), ::Type{<:AbstractArray}, ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}) =
70+
LazyArrayApplyStyle()
71+
ApplyStyle(::typeof(*), ::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}, ::Type{<:AbstractArray}) =
72+
LazyArrayApplyStyle()
73+
ApplyStyle(::typeof(*), ::Type{<:Adjoint{<:Any,<:BandedMatrix{<:Any,<:Any,<:OneToInf}}}, ::Type{<:AbstractArray}) =
74+
LazyArrayApplyStyle()
75+
ApplyStyle(::typeof(*), ::Type{<:Transpose{<:Any,<:BandedMatrix{<:Any,<:Any,<:OneToInf}}}, ::Type{<:AbstractArray}) =
6476
LazyArrayApplyStyle()
65-
66-
6777
end # module

test/runtests.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import BlockArrays: _BlockArray
66
import BlockBandedMatrices: isblockbanded, _BlockBandedMatrix
77
import MatrixFactorizations: QLPackedQ
88
import BandedMatrices: bandeddata, _BandedMatrix
9-
import LazyArrays: colsupport
9+
import LazyArrays: colsupport, ApplyStyle, MemoryLayout
1010

1111
@testset "Algebra" begin
1212
@testset "BlockTridiagonal" begin
@@ -26,6 +26,7 @@ import LazyArrays: colsupport
2626
@test (I + A)[1:100,1:100] == I+A[1:100,1:100]
2727
@test (I - A)[1:100,1:100] == I-A[1:100,1:100]
2828
end
29+
2930
@testset "BandedMatrix" begin
3031
A = BandedMatrix(-3 => Fill(7/10,∞), -2 => Fill(1,∞), 1 => Fill(2im,∞))
3132
Ac = BandedMatrix(A')
@@ -74,11 +75,19 @@ import LazyArrays: colsupport
7475
@test A * Eye(∞) isa BandedMatrix
7576
b = 1:
7677
@test bandwidths(b .* A) == (0,1)
78+
79+
@test colsupport(b.*A, 1) == 1:1
7780
@test Base.replace_in_print_matrix(b.*A, 2,1,"0.0") == ""
7881
@test bandwidths(A .* b) == (0,1)
7982
@test A .* b' isa BroadcastArray
8083
@test bandwidths(A .* b') == bandwidths(A .* b')
8184
@test colsupport(A .* b', 3) == 2:3
85+
86+
A = _BandedMatrix(Ones{Int}(1,∞),∞,0,0)'
87+
B = _BandedMatrix((-2:-2:-∞)', ∞,-1,1)
88+
C = Diagonal( 2 ./ (1:2:∞))
89+
@test A*(B*C) isa MulMatrix
90+
@test bandwidths(A*(B*C)) == (-1,1)
8291
end
8392

8493
@testset "Triangle OP recurrences" begin

0 commit comments

Comments
 (0)