Skip to content

Commit a4de9ad

Browse files
committed
increase cov
1 parent 6c090ff commit a4de9ad

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/lmul.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,17 @@ end
157157

158158
# TODO: uncomment out. commented for now due to ambiguities
159159
# LinearAlgebra.lmul!(Q::AbstractQ, v::LayoutVecOrMats) = lmul!(Q, v)
160+
# LinearAlgebra.rmul!(A::LayoutMatrices, Q::AbstractQ) = rmul!(A, Q)
160161

161162
for Typ in (:QRCompactWYQ, :QRPackedQ)
162163
@eval begin
163164
LinearAlgebra.lmul!(Q::$Typ{<:Any,<:LayoutMatrix}, v::LayoutVecOrMats) = lmul!(Q, v)
164165
LinearAlgebra.lmul!(Q::$Typ{<:Any,<:LayoutMatrix}, v::AbstractVecOrMat) = lmul!(Q, v)
165166
LinearAlgebra.lmul!(Q::AdjointQ{<:Any,<:$Typ{<:Any,<:LayoutMatrix}}, v::LayoutVecOrMats) = lmul!(Q, v)
166167
LinearAlgebra.lmul!(Q::AdjointQ{<:Any,<:$Typ{<:Any,<:LayoutMatrix}}, v::AbstractVecOrMat) = lmul!(Q, v)
168+
LinearAlgebra.rmul!(V::LayoutMatrices, Q::$Typ{<:Any,<:LayoutMatrix}) = rmul!(V, Q)
169+
LinearAlgebra.rmul!(V::AbstractMatrix, Q::$Typ{<:Any,<:LayoutMatrix}) = rmul!(V, Q)
170+
LinearAlgebra.rmul!(V::LayoutMatrices, Q::AdjointQ{<:Any,<:$Typ{<:Any,<:LayoutMatrix}}) = rmul!(V, Q)
171+
LinearAlgebra.rmul!(V::AbstractMatrix, Q::AdjointQ{<:Any,<:$Typ{<:Any,<:LayoutMatrix}}) = rmul!(V, Q)
167172
end
168173
end
169-
170-
LinearAlgebra.rmul!(A::LayoutMatrices, Q::AbstractQ) = rmul!(A, Q)

test/test_layoutarray.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,23 @@ Base.copy(A::MyVector) = MyVector(copy(A.A))
602602
@test mul!(copy(B), D, A, 2.0, 3.0) mul!(copy(B), D, V, 2.0, 3.0) 2D * A + 3B
603603
@test mul!(copy(B), A, D, 2.0, 3.0) mul!(copy(B), V, D, 2.0, 3.0) 2A * D + 3B
604604
end
605+
606+
@testset "QR" begin
607+
A = randn(10,5)
608+
= qr(A).Q
609+
Q = LinearAlgebra.QRCompactWYQ(MyMatrix(Q̃.factors), Q̃.T)
610+
b = randn(10)
611+
B = randn(10,3)
612+
@test Q*b *b lmul!(Q, copy(b)) lmul!(Q, MyVector(copy(b)))
613+
@test Q'b 'b lmul!(Q', copy(b)) lmul!(Q', MyVector(copy(b)))
614+
@test Q*B *B lmul!(Q, copy(B)) lmul!(Q, MyMatrix(copy(B)))
615+
@test Q'B 'B lmul!(Q', copy(B)) lmul!(Q', MyMatrix(copy(B)))
616+
617+
@test B'Q B' rmul!(copy(B'),Q) rmul!(MyMatrix(copy(B')), Q)
618+
@test B'Q' B'' rmul!(copy(B'),Q') rmul!(MyMatrix(copy(B')), Q')
619+
620+
@test_broken Q*b lmul!(Q̃, MyVector(copy(b))) # broken due to commented out code for ambiguity with MatrixFactorizations.jl
621+
end
605622
end
606623

607624
struct MyUpperTriangular{T} <: AbstractMatrix{T}

0 commit comments

Comments
 (0)