@@ -90,7 +90,37 @@ function Base.:(*)(A::LinearMap, x::AbstractVector)
9090end
9191
9292"""
93- mul!(C, A::LinearMap, B, α, β) -> C
93+ mul!(Y::AbstractVecOrMat, A::LinearMap, B::AbstractVector) -> Y
94+ mul!(Y::AbstractMatrix, A::LinearMap, B::AbstractMatrix) -> Y
95+
96+ Calculates the action of the linear map `A` on the vector or matrix `B` and stores the result in `Y`,
97+ overwriting the existing value of `Y`. Note that `Y` must not be aliased with either `A` or `B`.
98+
99+ ## Examples
100+ ```jldoctest; setup=(using LinearAlgebra, LinearMaps)
101+ julia> A=LinearMap([1.0 2.0; 3.0 4.0]); B=[1.0, 1.0]; Y = similar(B); mul!(Y, A, B);
102+
103+ julia> Y
104+ 2-element Array{Float64,1}:
105+ 3.0
106+ 7.0
107+
108+ julia> A=LinearMap([1.0 2.0; 3.0 4.0]); B=[1.0 1.0; 1.0 1.0]; Y = similar(B); mul!(Y, A, B);
109+
110+ julia> Y
111+ 2×2 Array{Float64,2}:
112+ 3.0 3.0
113+ 7.0 7.0
114+ ```
115+ """
116+ function mul! (y:: AbstractVecOrMat , A:: LinearMap , x:: AbstractVector )
117+ check_dim_mul (y, A, x)
118+ return _unsafe_mul! (y, A, x)
119+ end
120+
121+ """
122+ mul!(C::AbstractVecOrMat, A::LinearMap, B::AbstractVector, α, β) -> C
123+ mul!(C::AbstractMatrix, A::LinearMap, B::AbstractMatrix, α, β) -> C
94124
95125Combined inplace multiply-add ``A B α + C β``. The result is stored in `C` by overwriting it.
96126Note that `C` must not be aliased with either `A` or `B`.
@@ -118,11 +148,6 @@ julia> C
118148 730.0 740.0
119149```
120150"""
121- function mul! (y:: AbstractVecOrMat , A:: LinearMap , x:: AbstractVector )
122- check_dim_mul (y, A, x)
123- return _unsafe_mul! (y, A, x)
124- end
125-
126151function mul! (y:: AbstractVecOrMat , A:: LinearMap , x:: AbstractVector , α:: Number , β:: Number )
127152 check_dim_mul (y, A, x)
128153 return _unsafe_mul! (y, A, x, α, β)
@@ -155,29 +180,6 @@ function _generic_mapvec_mul!(y, A, x, α, β)
155180end
156181
157182# the following is of interest in, e.g., subspace-iteration methods
158- """
159- mul!(Y, A::LinearMap, B) -> Y
160-
161- Calculates the action of the linear map `A` on the vector or matrix `B` and stores the result in `Y`,
162- overwriting the existing value of `Y`. Note that `Y` must not be aliased with either `A` or `B`.
163-
164- ## Examples
165- ```jldoctest; setup=(using LinearAlgebra, LinearMaps)
166- julia> A=LinearMap([1.0 2.0; 3.0 4.0]); B=[1.0, 1.0]; Y = similar(B); mul!(Y, A, B);
167-
168- julia> Y
169- 2-element Array{Float64,1}:
170- 3.0
171- 7.0
172-
173- julia> A=LinearMap([1.0 2.0; 3.0 4.0]); B=[1.0 1.0; 1.0 1.0]; Y = similar(B); mul!(Y, A, B);
174-
175- julia> Y
176- 2×2 Array{Float64,2}:
177- 3.0 3.0
178- 7.0 7.0
179- ```
180- """
181183function mul! (Y:: AbstractMatrix , A:: LinearMap , X:: AbstractMatrix )
182184 check_dim_mul (Y, A, X)
183185 return _generic_mapmat_mul! (Y, A, X)
0 commit comments