@@ -179,7 +179,7 @@ for (t1, t2) in ((:UnitUpperTriangular, :UpperTriangular),
179179 (:UnitLowerTriangular , :LowerTriangular ))
180180 @eval begin
181181 function (+ )(UL:: $t1 , J:: UniformScaling )
182- ULnew = copymutable_oftype (UL. data, Base. _return_type (+ , Tuple{ eltype (UL), typeof (J)} ))
182+ ULnew = copymutable_oftype (UL. data, Base. promote_op (+ , eltype (UL), typeof (J)))
183183 for i in axes (ULnew, 1 )
184184 ULnew[i,i] = one (ULnew[i,i]) + J
185185 end
193193# However, to preserve type stability, we do not special-case a
194194# UniformScaling{<:Complex} that happens to be real.
195195function (+ )(A:: Hermitian , J:: UniformScaling{<:Complex} )
196- TS = Base. _return_type (+ , Tuple{ eltype (A), typeof (J)} )
196+ TS = Base. promote_op (+ , eltype (A), typeof (J))
197197 B = copytri! (copymutable_oftype (parent (A), TS), A. uplo, true )
198198 for i in diagind (B)
199199 B[i] = A[i] + J
@@ -202,7 +202,7 @@ function (+)(A::Hermitian, J::UniformScaling{<:Complex})
202202end
203203
204204function (- )(J:: UniformScaling{<:Complex} , A:: Hermitian )
205- TS = Base. _return_type (+ , Tuple{ eltype (A), typeof (J)} )
205+ TS = Base. promote_op (+ , eltype (A), typeof (J))
206206 B = copytri! (copymutable_oftype (parent (A), TS), A. uplo, true )
207207 B .= .- B
208208 for i in diagind (B)
213213
214214function (+ )(A:: AbstractMatrix , J:: UniformScaling )
215215 checksquare (A)
216- B = copymutable_oftype (A, Base. _return_type (+ , Tuple{ eltype (A), typeof (J)} ))
216+ B = copymutable_oftype (A, Base. promote_op (+ , eltype (A), typeof (J)))
217217 for i in intersect (axes (A,1 ), axes (A,2 ))
218218 @inbounds B[i,i] += J
219219 end
222222
223223function (- )(J:: UniformScaling , A:: AbstractMatrix )
224224 checksquare (A)
225- B = convert (AbstractMatrix{Base. _return_type (+ , Tuple{ eltype (A), typeof (J)} )}, - A)
225+ B = convert (AbstractMatrix{Base. promote_op (+ , eltype (A), typeof (J))}, - A)
226226 for i in intersect (axes (A,1 ), axes (A,2 ))
227227 @inbounds B[i,i] += J
228228 end
0 commit comments