|
11 | 11 | import LinearAlgebra: AdjointAbsVec, TransposeAbsVec
|
12 | 12 |
|
13 | 13 | # x = y'*A ⇐⇒ x' = (A'*y)
|
14 |
| -Base.:(*)(y::AdjointAbsVec, A::LinearMap) = adjoint(*(A', y')) |
| 14 | +Base.:(*)(y::AdjointAbsVec, A::LinearMap) = adjoint(A' * y') |
15 | 15 | Base.:(*)(y::TransposeAbsVec, A::LinearMap) = transpose(transpose(A) * transpose(y))
|
16 | 16 |
|
17 |
| -# mul!(x, y', A) |
18 |
| -Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::AdjointAbsVec, A::LinearMap) |
19 |
| - @boundscheck check_dim_mul(x, y, A) |
20 |
| - @inbounds mul!(adjoint(x), A', y') |
21 |
| - return adjoint(x) |
22 |
| -end |
23 |
| - |
24 |
| -Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::AdjointAbsVec, |
25 |
| - A::LinearMap, α::Number, β::Number) |
26 |
| - @boundscheck check_dim_mul(x, y, A) |
27 |
| - @inbounds mul!(adjoint(x), A', y', α, β) |
28 |
| - return adjoint(x) |
29 |
| -end |
| 17 | +# multiplication with vector/matrix |
| 18 | +for Atype in (AdjointAbsVec, Adjoint{<:Any,<:AbstractMatrix}) |
| 19 | + @eval Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::$Atype, A::LinearMap) |
| 20 | + @boundscheck check_dim_mul(x, y, A) |
| 21 | + @inbounds mul!(adjoint(x), A', y') |
| 22 | + return x |
| 23 | + end |
30 | 24 |
|
31 |
| -Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::TransposeAbsVec, A::LinearMap) |
32 |
| - @boundscheck check_dim_mul(x, y, A) |
33 |
| - @inbounds mul!(transpose(x), transpose(A), transpose(y)) |
34 |
| - return transpose(x) |
| 25 | + @eval Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::$Atype, A::LinearMap, |
| 26 | + α::Number, β::Number) |
| 27 | + @boundscheck check_dim_mul(x, y, A) |
| 28 | + @inbounds mul!(adjoint(x), A', y', conj(α), conj(β)) |
| 29 | + return x |
| 30 | + end |
35 | 31 | end
|
| 32 | +for Atype in (TransposeAbsVec, Transpose{<:Any,<:AbstractMatrix}) |
| 33 | + @eval Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::$Atype, A::LinearMap) |
| 34 | + @boundscheck check_dim_mul(x, y, A) |
| 35 | + @inbounds mul!(transpose(x), transpose(A), transpose(y)) |
| 36 | + return x |
| 37 | + end |
36 | 38 |
|
37 |
| -Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::TransposeAbsVec, |
38 |
| - A::LinearMap, α::Number, β::Number) |
39 |
| - @boundscheck check_dim_mul(x, y, A) |
40 |
| - @inbounds mul!(transpose(x), transpose(A), transpose(y), α, β) |
41 |
| - return transpose(x) |
| 39 | + @eval Base.@propagate_inbounds function LinearAlgebra.mul!(x::AbstractMatrix, y::$Atype, A::LinearMap, |
| 40 | + α::Number, β::Number) |
| 41 | + @boundscheck check_dim_mul(x, y, A) |
| 42 | + @inbounds mul!(transpose(x), transpose(A), transpose(y), α, β) |
| 43 | + return x |
| 44 | + end |
42 | 45 | end
|
0 commit comments