Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit deeac4e

Browse files
committedNov 11, 2019
make * check size, but then multiply inbounds
1 parent 72c3d1b commit deeac4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/LinearMaps.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ convert_to_lmaps(A) = (convert_to_lmaps_(A),)
5151
@inline convert_to_lmaps(A, B, Cs...) =
5252
(convert_to_lmaps_(A), convert_to_lmaps_(B), convert_to_lmaps(Cs...)...)
5353

54-
Base.:(*)(A::LinearMap, x::AbstractVector) = @inbounds mul!(similar(x, promote_type(eltype(A), eltype(x)), size(A, 1)), A, x)
54+
function Base.:(*)(A::LinearMap, x::AbstractVector)
55+
size(A, 2) == length(x) || throw(DimensionMismatch("mul!"))
56+
return @inbounds mul!(similar(x, promote_type(eltype(A), eltype(x)), size(A, 1)), A, x)
57+
end
5558
function LinearAlgebra.mul!(y::AbstractVector, A::LinearMap, x::AbstractVector, α::Number=true, β::Number=false)
5659
@boundscheck check_dim_mul(y, A, x)
5760
if isone(α)

0 commit comments

Comments
 (0)
Please sign in to comment.