From 7395f0c3a61240426d9c59ce88401ae9b2049c61 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 13 Sep 2024 14:01:17 +0200 Subject: [PATCH 1/3] Fix dispatch for `rdiv!` with `LU` --- stdlib/LinearAlgebra/src/lu.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/stdlib/LinearAlgebra/src/lu.jl b/stdlib/LinearAlgebra/src/lu.jl index d2e82af5d6409..e65aaf4cc2e6f 100644 --- a/stdlib/LinearAlgebra/src/lu.jl +++ b/stdlib/LinearAlgebra/src/lu.jl @@ -786,8 +786,6 @@ function ldiv!(adjA::AdjointFactorization{<:Any,<:LU{T,Tridiagonal{T,V}}}, B::Ab return B end -rdiv!(B::AbstractMatrix, A::LU) = transpose(ldiv!(transpose(A), transpose(B))) - # Conversions AbstractMatrix(F::LU) = (F.L * F.U)[invperm(F.p),:] AbstractArray(F::LU) = AbstractMatrix(F) From a77a966db02482e1e9a80e2ea1500f193db652ea Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 13 Sep 2024 14:53:41 +0200 Subject: [PATCH 2/3] avoid double tri-wrapper --- stdlib/LinearAlgebra/src/triangular.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stdlib/LinearAlgebra/src/triangular.jl b/stdlib/LinearAlgebra/src/triangular.jl index df0d0d4fd0d8b..9dd2cf0d30ce4 100644 --- a/stdlib/LinearAlgebra/src/triangular.jl +++ b/stdlib/LinearAlgebra/src/triangular.jl @@ -997,16 +997,16 @@ _trimul!(C::AbstractMatrix, A::AbstractTriangular, B::UpperOrLowerTriangular) = function lmul!(A::AbstractTriangular, B::AbstractVecOrMat) if istriu(A) - _trimul!(B, UpperTriangular(A), B) + _trimul!(B, uppertriangular(A), B) else - _trimul!(B, LowerTriangular(A), B) + _trimul!(B, lowertriangular(A), B) end end function rmul!(A::AbstractMatrix, B::AbstractTriangular) if istriu(B) - _trimul!(A, A, UpperTriangular(B)) + _trimul!(A, A, uppertriangular(B)) else - _trimul!(A, A, LowerTriangular(B)) + _trimul!(A, A, lowertriangular(B)) end end @@ -1046,16 +1046,16 @@ _rdiv!(C::AbstractMatrix, A::AbstractMatrix, B::UpperOrLowerTriangular) = function ldiv!(A::AbstractTriangular, B::AbstractVecOrMat) if istriu(A) - _ldiv!(B, UpperTriangular(A), B) + _ldiv!(B, uppertriangular(A), B) else - _ldiv!(B, LowerTriangular(A), B) + _ldiv!(B, lowertriangular(A), B) end end function rdiv!(A::AbstractMatrix, B::AbstractTriangular) if istriu(B) - _rdiv!(A, A, UpperTriangular(B)) + _rdiv!(A, A, uppertriangular(B)) else - _rdiv!(A, A, LowerTriangular(B)) + _rdiv!(A, A, lowertriangular(B)) end end From b89aeb654cc9c2363d5b79ce088ec6aa14fa494f Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Sat, 26 Oct 2024 23:55:16 +0200 Subject: [PATCH 3/3] bring back rdiv! method, but restrict to Tridiagonal --- stdlib/LinearAlgebra/src/lu.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/LinearAlgebra/src/lu.jl b/stdlib/LinearAlgebra/src/lu.jl index e65aaf4cc2e6f..0837ac08e74ea 100644 --- a/stdlib/LinearAlgebra/src/lu.jl +++ b/stdlib/LinearAlgebra/src/lu.jl @@ -786,6 +786,8 @@ function ldiv!(adjA::AdjointFactorization{<:Any,<:LU{T,Tridiagonal{T,V}}}, B::Ab return B end +rdiv!(B::AbstractMatrix, A::LU{T,Tridiagonal{T,V}}) where {T,V} = transpose(ldiv!(transpose(A), transpose(B))) + # Conversions AbstractMatrix(F::LU) = (F.L * F.U)[invperm(F.p),:] AbstractArray(F::LU) = AbstractMatrix(F)