@@ -137,6 +137,12 @@ function Base.show(io::IO, ::MIME"text/plain", x::TransposeFactorization)
137
137
show (io, MIME " text/plain" (), parent (x))
138
138
end
139
139
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))
140
146
# With a real lhs and complex rhs with the same precision, we can reinterpret
141
147
# the complex rhs as a real rhs with twice the number of columns or rows
142
148
function (\ )(F:: Factorization{T} , B:: VecOrMat{Complex{T}} ) where {T<: BlasReal }
151
157
(\ )(F:: AdjointFactorization{T} , B:: VecOrMat{Complex{T}} ) where {T<: BlasReal } =
152
158
@invoke \ (F:: typeof (F), B:: VecOrMat )
153
159
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
-
180
160
function ldiv! (Y:: AbstractVector , A:: Factorization , B:: AbstractVector )
181
161
require_one_based_indexing (Y, B)
182
162
m, n = size (A)
@@ -200,3 +180,27 @@ function ldiv!(Y::AbstractMatrix, A::Factorization, B::AbstractMatrix)
200
180
return ldiv! (A, Y)
201
181
end
202
182
end
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