Public API
LDR Factorization
StableLinearAlgebra.LDR — TypeLDR{T<:Number, E<:Real} <: Factorization{T}Represents the matrix factorization $A = L D R$ for a square matrix $A$, where $L$ is a unitary matrix, $D$ is a diagonal matrix of strictly positive real numbers, and $R$ is defined such that $|\det R| = 1$.
This factorization is based on a column-pivoted QR decomposition $A P = Q R',$ such that
\[\begin{align*} L &:= Q \\ D &:= \vert \textrm{diag}(R') \vert \\ R &:= \vert \textrm{diag}(R') \vert^{-1} R' P^T\\ \end{align*}\]
Fields
StableLinearAlgebra.LDRWorkspace — TypeLDRWorkspace{T<:Number}A workspace to avoid dyanmic memory allocations when performing computations with a LDR factorization.
Fields
qr_ws::QRWorkspace{T,E}:QRWorkspacefor calculating column pivoted QR factorization without dynamic memory allocations.lu_ws::LUWorkspace{T}:LUWorkspacefor calculating LU factorization without dynamic memory allocations.M::Matrix{T}: Temporary storage matrix for avoiding dynamic memory allocations. This matrix is used/modified when aLDRfactorization is calculated.M′::Matrix{T}: Temporary storage matrix for avoiding dynamic memory allocations.M″::Matrix{T}: Temporary storage matrix for avoiding dynamic memory allocations.v::Vector{T}: Temporary storage vector for avoiding dynamic memory allocations.
StableLinearAlgebra.ldr — Functionldr(A::AbstractMatrix{T}) where {T}Allocate an LDR factorization based on A, but does not calculate its LDR factorization, instead initializing the factorization to the identity matrix.
ldr(A::AbstractMatrix{T}, ws::LDRWorkspace{T}) where {T}Return the LDR factorization of the matrix A.
ldr(F::LDR{T}, ignore...) where {T}Return a copy of the LDR factorization F.
StableLinearAlgebra.ldr! — Functionldr!(F::LDR{T}, A::AbstractMatrix{T}, ws::LDRWorkspace{T}) where {T}Calculate the LDR factorization F for the matrix A.
ldr!(F::LDR{T}, I::UniformScaling, ignore...) where {T}Set the LDR factorization equal to the identity matrix.
ldr!(Fout::LDR{T}, Fin::LDR{T}, ignore...) where {T}Copy the LDR factorization Fin to Fout.
ldr!(F::LDR, ws::LDRWorkspace{T}) where {T}Calculate the LDR factorization for the matrix F.L.
StableLinearAlgebra.ldrs — Functionldrs(A::AbstractMatrix{T}, N::Int) where {T}Return a vector of LDR factorizations of length N, where each one represents the identity matrix of the same size as $A$.
ldrs(A::AbstractMatrix{T}, N::Int, ws::LDRWorkspace{T,E}) where {T,E}Return a vector of LDR factorizations of length N, where each one represents the matrix A.
ldrs(A::AbstractArray{T,3}, ws::LDRWorkspace{T,E}) where {T,E}Return a vector of LDR factorizations of length size(A, 3), where there is an LDR factorization for each matrix A[:,:,i].
StableLinearAlgebra.ldrs! — Functionldrs!(Fs::AbstractVector{LDR{T,E}}, A::AbstractArray{T,3}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the LDR factorization Fs[i] for the matrix A[:,:,i].
StableLinearAlgebra.ldr_workspace — Functionldr_workspace(A::AbstractMatrix)
ldr_workspace(F::LDR)Return a LDRWorkspace that can be used to avoid dynamic memory allocations.
Overloaded Functions
Base.eltype — Functioneltype(LDR{T}) where {T}Return the matrix element type T of the LDR factorization F.
Base.size — Functionsize(F::LDR, dim...)Return the size of the LDR factorization F.
Base.copyto! — Functioncopyto!(ldrws_out::LDRWorkspace{T,E}, ldrws_in::LDRWorkspace{T,E}) where {T,E}Copy the contents of ldrws_in into ldrws_out.
copyto!(U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Copy the matrix represented by the LDR factorization V into the matrix U.
copyto!(U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E} = ldr!(U,V,ws)
copyto!(U::LDR, I::UniformScaling, ignore...) = ldr!(U,I)Copy the matrix V to the LDR factorization U, calculating the LDR factorization to represent V.
copyto!(U::LDR{T,E}, V::LDR{T,E}, ignore...) where {T,E}Copy the LDR factorization V to U.
LinearAlgebra.adjoint! — Functionadjoint!(Aᵀ::AbstractMatrix{T}, A::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Given an LDR factorization $A$, construct the matrix representing its adjoint $A^{\dagger}.$
LinearAlgebra.lmul! — Functionlmul!(U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate $V := U V$ where $U$ is a LDR factorization and $V$ is a matrix.
lmul!(U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $V := U V,$ where $U$ is a matrix and $V$ is an LDR factorization.
Algorithm
Calculate $V := U V$ using the procedure
\[\begin{align*} V:= & UV\\ = & \overset{L_{0}D_{0}R_{0}}{\overbrace{U[L_{v}D_{v}}}R_{v}]\\ = & \overset{L_{1}}{\overbrace{L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}R_{v}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
lmul!(U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $V := U V,$ where $U$ and $V$ are both LDR factorizations.
Algorithm
Calculate $V := U V$ using the procedure
\[\begin{align*} V:= & UV\\ = & [L_{u}D_{u}\overset{M}{\overbrace{R_{u}][L_{v}}}D_{v}R_{v}]\\ = & L_{u}\overset{L_{0}D_{0}R_{0}}{\overbrace{D_{u}MD_{v}}}R_{v}\\ = & \overset{L_{1}}{\overbrace{L_{u}L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}R_{v}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
LinearAlgebra.rmul! — Functionrmul!(U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate $U := U V$ where $U$ is a matrix and $V$ is a LDR factorization.
rmul!(U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $U := U V,$ where $U$ is a LDR factorization and $V$ is a matrix.
Algorithm
Calculate $U := U V$ using the procedure
\[\begin{align*} U:= & UV\\ = & [L_{u}\overset{L_{0}D_{0}R_{0}}{\overbrace{D_{u}R_{u}]V}}\\ = & \overset{L_{1}}{\overbrace{L_{u}L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
rmul!(U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $U := U V,$ where both $U$ and $V$ are LDR factorizations.
Algorithm
Calculate $U := U V$ using the procedure
\[\begin{align*} U:= & UV\\ = & [L_{u}D_{u}\overset{M}{\overbrace{R_{u}][L_{v}}}D_{v}R_{v}]\\ = & L_{u}\overset{L_{0}D_{0}R_{0}}{\overbrace{D_{u}MD_{v}}}R_{v}\\ = & \overset{L_{1}}{\overbrace{L_{u}L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}R_{v}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
LinearAlgebra.mul! — Functionmul!(H::AbstractMatrix{T}, U::LDR{T,E}, V::AbstractMatrix{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the matrix product $H := U V$, where $H$ and $V$ are matrices and $U$ is a LDR factorization.
mul!(H::AbstractMatrix{T}, U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the matrix product $H := U V$, where $H$ and $U$ are matrices and $V$ is a LDR factorization.
mul!(H::LDR{T,E}, U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U V$, where $U$ is matrix, and $H$ and $V$ are both LDR factorization. For the algorithm refer to documentation for lmul!.
mul!(H::LDR{T,E}, U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U V$, where $V$ is matrix, and $H$ and $U$ are both LDR factorizations. For the algorithm refer to the documentation for rmul!.
mul!(H::LDR{T,E}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable matrix product $H := U V,$ where $H,$ $U$ and $V$ are all LDR factorizations. For the algorithm refer to the documentation for lmul!.
LinearAlgebra.ldiv! — Functionldiv!(U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate $V := U^{-1} V,$ where $V$ is a matrix, and $U$ is an LDR factorization.
ldiv!(H::AbstractMatrix{T}, U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate $H := U^{-1} V,$ where $H$ and $V$ are matrices, and $U$ is an LDR factorization.
ldiv!(U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $V := U^{-1}V$ where both $U$ and $V$ are LDR factorizations. Note that an intermediate LU factorization is required to calucate the matrix inverse $R_u^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
Algorithm
Calculate $V := U^{-1}V$ using the procedure
\[\begin{align*} V:= & U^{-1}V\\ = & [L_{u}D_{u}R_{u}]^{-1}[L_{v}D_{v}R_{v}]\\ = & R_{u}^{-1}D_{u}^{-1}\overset{M}{\overbrace{L_{u}^{\dagger}L_{v}}}D_{v}R_{v}\\ = & \overset{L_{0}D_{0}R_{0}}{\overbrace{R_{u}^{-1}D_{u}^{-1}MD_{v}}}R_{v}\\ = & \overset{L_{1}}{\overbrace{L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}^{\phantom{1}}}}\,\overset{R_{1}}{\overbrace{R_{0}R_{v}^{\phantom{1}}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
ldiv!(H::LDR{T,E}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U^{-1} V,$ where $H,$ $U$ and $V$ are all LDR factorizations. Note that an intermediate LU factorization is required to calucate the matrix inverse $R_u^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
ldiv!(U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $V := U^{-1} V,$ where $U$ is a matrix and $V$ is a LDR factorization. Note that an intermediate LU factorization is required as well to calucate the matrix inverse $U^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
Algorithm
The numerically stable procdure used to evaluate $V := U^{-1} V$ is
\[\begin{align*} V:= & U^{-1}V\\ = & \overset{L_{0}D_{0}R_{0}}{\overbrace{U^{-1}[L_{v}D_{v}}}R_{v}]\\ = & \overset{L_{1}}{\overbrace{L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}R_{v}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
ldiv!(H::LDR{T,E}, U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U^{-1} V,$ where $H$ and $V$ are LDR factorizations and $U$ is a matrix. Note that an intermediate LU factorization is required to calculate $U^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
LinearAlgebra.rdiv! — Functionrdiv!(U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the matrix product $U := U V^{-1},$ where $V$ is an LDR factorization and $U$ is a matrix. Note that this requires two intermediate LU factorizations to calculate $L_v^{-1}$ and $R_v^{-1}$.
rdiv!(H::AbstractMatrix{T}, U::AbstractMatrix{T}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the matrix product $H := U V^{-1},$ where $H$ and $U$ are matrices and $V$ is a LDR factorization. Note that this requires two intermediate LU factorizations to calculate $L_v^{-1}$ and $R_v^{-1}$.
rdiv!(U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $U := U V^{-1}$ where both $U$ and $V$ are LDR factorizations. Note that an intermediate LU factorization is required to calucate the matrix inverse $L_v^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
Algorithm
Calculate $U := UV^{-1}$ using the procedure
\[\begin{align*} U:= & UV^{-1}\\ = & [L_{u}D_{u}R_{u}][L_{v}D_{v}R_{v}]^{-1}\\ = & L_{u}D_{u}\overset{M}{\overbrace{R_{u}R_{v}^{-1}}}D_{v}^{-1}L_{v}^{\dagger}\\ = & L_{u}\overset{L_{0}D_{0}R_{0}}{\overbrace{D_{u}MD_{v}^{-1}}}L_{v}^{\dagger}\\ = & \overset{L_{1}}{\overbrace{L_{u}L_{0}^{\phantom{1}}}}\,\overset{D_{1}}{\overbrace{D_{0}^{\phantom{1}}}}\,\overset{R_{1}}{\overbrace{R_{0}L_{v}^{\dagger}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
rdiv!(H::LDR{T,E}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U V^{-1}$ where $H,$ $U$ and $V$ are all LDR factorizations. Note that an intermediate LU factorization is required to calucate the matrix inverse $L_v^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
rdiv!(U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $U := U V^{-1},$ where $V$ is a matrix and $U$ is an LDR factorization. Note that an intermediate LU factorization is required as well to calucate the matrix inverse $V^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
Algorithm
The numerically stable procdure used to evaluate $U := U V^{-1}$ is
\[\begin{align*} U:= & UV^{-1}\\ = & [L_{u}\overset{L_{0}D_{0}R_{0}}{\overbrace{D_{u}R_{u}]V^{-1}}}\\ = & \overset{L_{1}}{\overbrace{L_{u}L_{0}}}\,\overset{D_{1}}{\overbrace{D_{0}}}\,\overset{R_{1}}{\overbrace{R_{0}}}\\ = & L_{1}D_{1}R_{1}. \end{align*}\]
rdiv!(H::LDR{T,E}, U::LDR{T,E}, V::AbstractMatrix{T}, ws::LDRWorkspace{T,E}) where {T,E}Calculate the numerically stable product $H := U V^{-1},$ where $V$ is a matrix and $H$ and $U$ is an LDR factorization. Note that an intermediate LU factorization is required as well to calucate the matrix inverse $V^{-1},$ in addition to the intermediate LDR factorization that needs to occur.
LinearAlgebra.logabsdet — Functionlogabsdet(A::LDR{T}, ws::LDRWorkspace{T}) where {T}Calculate $\log(\vert \det A \vert)$ and $\textrm{sign}(\det A)$ for the LDR factorization $A.$
Exported Function
StableLinearAlgebra.inv_IpA! — Functioninv_IpA!(G::AbstractMatrix{T}, A::LDR{T,E}, ws::LDRWorkspace{T,E})::Tuple{E,T} where {T,E}Calculate the numerically stable inverse $G := [I + A]^{-1},$ where $G$ is a matrix, and $A$ is represented by a LDR factorization. This method also returns $\log( \vert \det G\vert )$ and $\textrm{sign}(\det G).$
Algorithm
The numerically stable inverse $G := [I + A]^{-1}$ is calculated using the procedure
\[\begin{align*} G:= & [I+A]^{-1}\\ = & [I+L_{a}D_{a}R_{a}]^{-1}\\ = & [I+L_{a}D_{a,\min}D_{a,\max}R_{a}]^{-1}\\ = & [(R_{a}^{-1}D_{a,\max}^{-1}+L_{a}D_{a,\min})D_{a,\max}R_{a}]^{-1}\\ = & R_{a}^{-1}D_{a,\max}^{-1}[\overset{M}{\overbrace{R_{a}^{-1}D_{a,\max}^{-1}+L_{a}D_{a,\min}}}]^{-1}\\ = & R_{a}^{-1}D_{a,\max}^{-1}M^{-1}, \end{align*}\]
where $D_{a,\min} = \min(D_a, 1)$ and $D_{a,\max} = \max(D_a, 1).$ Intermediate matrix inversions and relevant determinant calculations are performed via LU factorizations with partial pivoting.
StableLinearAlgebra.inv_IpUV! — Functioninv_IpUV!(G::AbstractMatrix{T}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E})::Tuple{E,T} where {T,E}Calculate the numerically stable inverse $G := [I + UV]^{-1},$ where $G$ is a matrix and $U$ and $V$ are represented by LDR factorizations. This method also returns $\log( \vert \det G\vert )$ and $\textrm{sign}(\det G).$
Algorithm
The numerically stable inverse $G := [I + UV]^{-1}$ is calculated using the procedure
\[\begin{align*} G:= & [I+UV]^{-1}\\ = & [I+L_{u}D_{u}R_{u}L_{v}D_{v}R_{v}]^{-1}\\ = & [I+L_{u}D_{u,\max}D_{u,\min}R_{u}L_{v}D_{v,\min}D_{v,\max}R_{v}]^{-1}\\ = & [L_{u}D_{u,\max}(D_{u,\max}^{-1}L_{u}^{\dagger}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\min}R_{u}L_{v}D_{v,\min})D_{v,\max}R_{v}]^{-1}\\ = & R_{v}^{-1}D_{v,\max}^{-1}[\overset{M}{\overbrace{D_{u,\max}^{-1}L_{u}^{\dagger}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\min}R_{u}L_{v}D_{v,\min}}}]^{-1}D_{u,\max}^{-1}L_{u}^{\dagger}\\ = & R_{v}^{-1}D_{v,\max}^{-1}M^{-1}D_{u,\max}^{-1}L_{u}^{\dagger} \end{align*}\]
Intermediate matrix inversions and relevant determinant calculations are performed via LU factorizations with partial pivoting.
StableLinearAlgebra.inv_UpV! — Functioninv_UpV!(G::AbstractMatrix{T}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E})::Tuple{E,T} where {T,E}Calculate the numerically stable inverse $G := [U+V]^{-1},$ where $G$ is a matrix and $U$ and $V$ are represented by LDR factorizations. This method also returns $\log( \vert \det G\vert )$ and $\textrm{sign}(\det G).$
Algorithm
The numerically stable inverse $G := [U+V]^{-1}$ is calculated using the procedure
\[\begin{align*} G:= & [U+V]^{-1}\\ = & [\overset{D_{u,\max}D_{u,\min}}{L_{u}\overbrace{D_{u}}R_{u}}+\overset{D_{v,\min}D_{v,\max}}{L_{v}\overbrace{D_{v}}R_{v}}]^{-1}\\ = & [L_{u}D_{u,\max}D_{u,\min}R_{u}+L_{v}D_{v,\min}D_{v,\max}R_{v}]^{-1}\\ = & [L_{u}D_{u,\max}(D_{u,\min}R_{u}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\max}^{-1}L_{u}^{\dagger}L_{v}D_{v,\min})D_{v,\max}R_{v}]^{-1}\\ = & R_{v}^{-1}D_{v,\max}^{-1}[\overset{M}{\overbrace{D_{u,\min}R_{u}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\max}^{-1}L_{u}^{\dagger}L_{v}D_{v,\min}}}]^{-1}D_{u,\max}^{-1}L_{u}^{\dagger}\\ = & R_{v}^{-1}D_{v,\max}^{-1}M^{-1}D_{u,\max}^{-1}L_{u}^{\dagger}, \end{align*}\]
where
\[\begin{align*} D_{u,\min} = & \min(D_u,1)\\ D_{u,\max} = & \max(D_u,1)\\ D_{v,\min} = & \min(D_v,1)\\ D_{v,\max} = & \max(D_v,1), \end{align*}\]
and all intermediate matrix inversions and determinant calculations are performed via LU factorizations with partial pivoting.
StableLinearAlgebra.inv_invUpV! — Functioninv_invUpV!(G::AbstractMatrix{T}, U::LDR{T,E}, V::LDR{T,E}, ws::LDRWorkspace{T,E})::Tuple{E,T} where {T,E}Calculate the numerically stable inverse $G := [U^{-1}+V]^{-1},$ where $G$ is a matrix and $U$ and $V$ are represented by LDR factorizations. This method also returns $\log( \vert \det G\vert )$ and $\textrm{sign}(\det G).$
Algorithm
The numerically stable inverse $G := [U^{-1}+V]^{-1}$ is calculated using the procedure
\[\begin{align*} G:= & [U^{-1}+V]^{-1}\\ = & [\overset{D_{u,\max}D_{u,\min}}{(L_{u}\overbrace{D_{u}}R_{u})^{-1}}+\overset{D_{v,\min}D_{v,\max}}{L_{v}\overbrace{D_{v}}R_{v}}]^{-1}\\ = & [(L_{u}D_{u,\max}D_{u,\min}R_{u})^{-1}+L_{v}D_{v,\min}D_{v,\max}R_{v}]^{-1}\\ = & [R_{u}^{-1}D_{u,\min}^{-1}D_{u,\max}^{-1}L_{u}^{\dagger}+L_{v}D_{v,\min}D_{v,\max}R_{v}]^{-1}\\ = & [R_{u}^{-1}D_{u,\min}^{-1}(D_{u,\max}^{-1}L_{u}^{\dagger}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\min}R_{u}L_{v}D_{v,\min})D_{v,\max}R_{v}]^{-1}\\ = & R_{v}^{-1}D_{v,\max}^{-1}[\overset{M}{\overbrace{D_{u,\max}^{-1}L_{u}^{\dagger}R_{v}^{-1}D_{v,\max}^{-1}+D_{u,\min}R_{u}L_{v}D_{v,\min}}}]^{-1}D_{u,\min}R_{u}\\ = & R_{v}^{-1}D_{v,\max}^{-1}M^{-1}D_{u,\min}R_{u} \end{align*}\]
where
\[\begin{align*} D_{u,\min} = & \min(D_u,1)\\ D_{u,\max} = & \max(D_u,1)\\ D_{v,\min} = & \min(D_v,1)\\ D_{v,\max} = & \max(D_v,1), \end{align*}\]
and all intermediate matrix inversions and determinant calculations are performed via LU factorizations with partial pivoting.