@@ -137,6 +137,12 @@ function Base.show(io::IO, ::MIME"text/plain", x::TransposeFactorization)
137137 show (io, MIME " text/plain" (), parent (x))
138138end
139139
140+ function (\ )(F:: Factorization , B:: AbstractVecOrMat )
141+ require_one_based_indexing (B)
142+ TFB = typeof (oneunit (eltype (F)) \ oneunit (eltype (B)))
143+ ldiv! (F, copy_similar (B, TFB))
144+ end
145+ (\ )(F:: TransposeFactorization , B:: AbstractVecOrMat ) = conj! (adjoint (F. parent) \ conj .(B))
140146# With a real lhs and complex rhs with the same precision, we can reinterpret
141147# the complex rhs as a real rhs with twice the number of columns or rows
142148function (\ )(F:: Factorization{T} , B:: VecOrMat{Complex{T}} ) where {T<: BlasReal }
151157(\ )(F:: AdjointFactorization{T} , B:: VecOrMat{Complex{T}} ) where {T<: BlasReal } =
152158 @invoke \ (F:: typeof (F), B:: VecOrMat )
153159
154- function (/ )(B:: VecOrMat{Complex{T}} , F:: Factorization{T} ) where {T<: BlasReal }
155- require_one_based_indexing (B)
156- x = rdiv! (copy (reinterpret (T, B)), F)
157- return copy (reinterpret (Complex{T}, x))
158- end
159- # don't do the reinterpretation for [Adjoint/Transpose]Factorization
160- (/ )(B:: VecOrMat{Complex{T}} , F:: TransposeFactorization{T} ) where {T<: BlasReal } =
161- conj! (adjoint (parent (F)) \ conj .(B))
162- (/ )(B:: VecOrMat{Complex{T}} , F:: AdjointFactorization{T} ) where {T<: BlasReal } =
163- @invoke / (B:: VecOrMat{Complex{T}} , F:: Factorization{T} )
164-
165- function (\ )(F:: Factorization , B:: AbstractVecOrMat )
166- require_one_based_indexing (B)
167- TFB = typeof (oneunit (eltype (F)) \ oneunit (eltype (B)))
168- ldiv! (F, copy_similar (B, TFB))
169- end
170- (\ )(F:: TransposeFactorization , B:: AbstractVecOrMat ) = conj! (adjoint (F. parent) \ conj .(B))
171-
172- function (/ )(B:: AbstractMatrix , F:: Factorization )
173- require_one_based_indexing (B)
174- TFB = typeof (oneunit (eltype (B)) / oneunit (eltype (F)))
175- rdiv! (copy_similar (B, TFB), F)
176- end
177- (/ )(A:: AbstractMatrix , F:: AdjointFactorization ) = adjoint (adjoint (F) \ adjoint (A))
178- (/ )(A:: AbstractMatrix , F:: TransposeFactorization ) = transpose (transpose (F) \ transpose (A))
179-
180160function ldiv! (Y:: AbstractVector , A:: Factorization , B:: AbstractVector )
181161 require_one_based_indexing (Y, B)
182162 m, n = size (A)
@@ -200,3 +180,27 @@ function ldiv!(Y::AbstractMatrix, A::Factorization, B::AbstractMatrix)
200180 return ldiv! (A, Y)
201181 end
202182end
183+
184+ function (/ )(B:: AbstractMatrix , F:: Factorization )
185+ require_one_based_indexing (B)
186+ TFB = typeof (oneunit (eltype (B)) / oneunit (eltype (F)))
187+ rdiv! (copy_similar (B, TFB), F)
188+ end
189+ # reinterpretation trick for complex lhs and real factorization
190+ function (/ )(B:: Union {Matrix{Complex{T}},AdjOrTrans{Complex{T},Vector{Complex{T}}}}, F:: Factorization{T} ) where {T<: BlasReal }
191+ require_one_based_indexing (B)
192+ x = rdiv! (copy (reinterpret (T, B)), F)
193+ return copy (reinterpret (Complex{T}, x))
194+ end
195+ # don't do the reinterpretation for [Adjoint/Transpose]Factorization
196+ (/ )(B:: Union {Matrix{Complex{T}},AdjOrTrans{Complex{T},Vector{Complex{T}}}}, F:: TransposeFactorization{T} ) where {T<: BlasReal } =
197+ @invoke / (B:: AbstractMatrix , F:: Factorization )
198+ (/ )(B:: Matrix{Complex{T}} , F:: AdjointFactorization{T} ) where {T<: BlasReal } =
199+ @invoke / (B:: AbstractMatrix , F:: Factorization )
200+ (/ )(B:: Adjoint{Complex{T},Vector{Complex{T}}} , F:: AdjointFactorization{T} ) where {T<: BlasReal } =
201+ (F' \ B' )'
202+ (/ )(B:: Transpose{Complex{T},Vector{Complex{T}}} , F:: TransposeFactorization{T} ) where {T<: BlasReal } =
203+ transpose (transpose (F) \ transpose (B))
204+
205+ rdiv! (B:: AbstractMatrix , A:: TransposeFactorization ) = transpose (ldiv! (A. parent, transpose (B)))
206+ rdiv! (B:: AbstractMatrix , A:: AdjointFactorization ) = adjoint (ldiv! (A. parent, adjoint (B)))
0 commit comments