Skip to content

Commit

Permalink
avoid simplifying Inv * Lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Jul 20, 2023
1 parent 9960f3d commit 5d10bd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/LazyBandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,11 @@ copy(M::Mul{<:BroadcastLayouts,ApplyLayout{typeof(*)}}) = simplify(M)
copy(M::Mul{<:AbstractInvLayout{<:BandedLazyLayouts},<:StructuredLazyLayouts}) = ArrayLayouts.ldiv(pinv(M.A), M.B)
copy(M::Mul{<:StructuredApplyLayouts{typeof(*)},<:AbstractInvLayout{<:BandedLazyLayouts}}) = simplify(M)
copy(M::Mul{ApplyLayout{typeof(*)},<:AbstractInvLayout{<:BandedLazyLayouts}}) = simplify(M)

Check warning on line 937 in src/LazyBandedMatrices.jl

View check run for this annotation

Codecov / codecov/patch

src/LazyBandedMatrices.jl#L937

Added line #L937 was not covered by tests

copy(M::Mul{<:AbstractInvLayout{<:BandedLazyLayouts},<:StructuredApplyLayouts{typeof(*)}}) = simplify(M)
copy(M::Mul{<:AbstractInvLayout, <:StructuredApplyLayouts{typeof(*)}}) = simplify(M)
simplifiable(::Mul{<:AbstractInvLayout, <:StructuredLazyLayouts}) = Val(false)
copy(M::Mul{<:AbstractInvLayout, <:StructuredLazyLayouts}) = simplify(M)

Check warning on line 942 in src/LazyBandedMatrices.jl

View check run for this annotation

Codecov / codecov/patch

src/LazyBandedMatrices.jl#L942

Added line #L942 was not covered by tests


copy(L::Ldiv{<:StructuredLazyLayouts, <:StructuredLazyLayouts}) = lazymaterialize(\, L.A, L.B)
Expand Down
3 changes: 2 additions & 1 deletion test/test_banded.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using LazyBandedMatrices, LazyArrays, Test
using BandedMatrices: _BandedMatrix

struct PseudoBandedMatrix{T} <: AbstractMatrix{T}
data::Array{T}
Expand Down Expand Up @@ -710,7 +711,7 @@ LinearAlgebra.lmul!(β::Number, A::PseudoBandedMatrix) = (lmul!(β, A.data); A)
M = ApplyArray(*,L,L)
@test Bi * M inv(B) * L *L
@test M* Bi L *L * inv(B)
@test Li * M M * Li L
@test Li * M M * Li L

x = Vcat([1,2], Zeros(8))
@test Li * x L \ x
Expand Down

0 comments on commit 5d10bd9

Please sign in to comment.