Skip to content

Commit

Permalink
Use A isa (Adjoint|Transpose)AbsVec instead of method
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 26, 2019
1 parent c1e2760 commit 138aeb4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stdlib/LinearAlgebra/src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ end
return generic_matvecmul!(y, 'C', A, x, MulAddMul(alpha, beta))
end

# Vector-Matrix multiplication
(*)(x::AdjointAbsVec, A::AbstractMatrix) = (A'*x')'
(*)(x::TransposeAbsVec, A::AbstractMatrix) = transpose(transpose(A)*transpose(x))

# Matrix-matrix multiplication

"""
Expand All @@ -149,6 +145,11 @@ julia> [1 1; 0 1] * [1 0; 1 1]
```
"""
function (*)(A::AbstractMatrix, B::AbstractMatrix)
if A isa AdjointAbsVec
return (A'*x')'
elseif A isa TransposeAbsVec
return transpose(transpose(A)*transpose(x))
end
TS = promote_op(matprod, eltype(A), eltype(B))
mul!(similar(B, TS, (size(A,1), size(B,2))), A, B)
end
Expand Down

0 comments on commit 138aeb4

Please sign in to comment.