Skip to content

Commit

Permalink
change .* to * in fallback 3-arg * methods (#41545)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott authored Jul 12, 2021
1 parent 516af1b commit e3a06c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib/LinearAlgebra/src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ end

# Fast path for two arrays * one scalar is opt-in, via mat_vec_scalar and mat_mat_scalar.

mat_vec_scalar(A, x, γ) = A * (x .* γ) # fallback
mat_vec_scalar(A, x, γ) = A * (x * γ) # fallback
mat_vec_scalar(A::StridedMaybeAdjOrTransMat, x::StridedVector, γ) = _mat_vec_scalar(A, x, γ)
mat_vec_scalar(A::AdjOrTransAbsVec, x::StridedVector, γ) = (A * x) * γ

Expand All @@ -1098,7 +1098,7 @@ function _mat_vec_scalar(A, x, γ)
mul!(C, A, x, γ, false)
end

mat_mat_scalar(A, B, γ) = (A*B) .* γ # fallback
mat_mat_scalar(A, B, γ) = (A*B) * γ # fallback
mat_mat_scalar(A::StridedMaybeAdjOrTransMat, B::StridedMaybeAdjOrTransMat, γ) =
_mat_mat_scalar(A, B, γ)

Expand All @@ -1108,11 +1108,11 @@ function _mat_mat_scalar(A, B, γ)
mul!(C, A, B, γ, false)
end

mat_mat_scalar(A::AdjointAbsVec, B, γ) =' .* (A * B)')' # preserving order, adjoint reverses
mat_mat_scalar(A::AdjointAbsVec, B, γ) =' * (A * B)')' # preserving order, adjoint reverses
mat_mat_scalar(A::AdjointAbsVec{<:RealOrComplex}, B::StridedMaybeAdjOrTransMat{<:RealOrComplex}, γ::RealOrComplex) =
mat_vec_scalar(B', A', γ')'

mat_mat_scalar(A::TransposeAbsVec, B, γ) = transpose.* transpose(A * B))
mat_mat_scalar(A::TransposeAbsVec, B, γ) = transpose* transpose(A * B))
mat_mat_scalar(A::TransposeAbsVec{<:RealOrComplex}, B::StridedMaybeAdjOrTransMat{<:RealOrComplex}, γ::RealOrComplex) =
transpose(mat_vec_scalar(transpose(B), transpose(A), γ))

Expand Down

0 comments on commit e3a06c4

Please sign in to comment.