@@ -90,7 +90,37 @@ function Base.:(*)(A::LinearMap, x::AbstractVector)
90
90
end
91
91
92
92
"""
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
94
124
95
125
Combined inplace multiply-add ``A B α + C β``. The result is stored in `C` by overwriting it.
96
126
Note that `C` must not be aliased with either `A` or `B`.
@@ -118,11 +148,6 @@ julia> C
118
148
730.0 740.0
119
149
```
120
150
"""
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
-
126
151
function mul! (y:: AbstractVecOrMat , A:: LinearMap , x:: AbstractVector , α:: Number , β:: Number )
127
152
check_dim_mul (y, A, x)
128
153
return _unsafe_mul! (y, A, x, α, β)
@@ -155,29 +180,6 @@ function _generic_mapvec_mul!(y, A, x, α, β)
155
180
end
156
181
157
182
# 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
- """
181
183
function mul! (Y:: AbstractMatrix , A:: LinearMap , X:: AbstractMatrix )
182
184
check_dim_mul (Y, A, X)
183
185
return _generic_mapmat_mul! (Y, A, X)
0 commit comments