Skip to content

Commit

Permalink
simplify scalar multiplication of composites
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch committed Aug 30, 2019
1 parent 099e01e commit a569922
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/composition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Base.:(*)(α::Number, A::CompositeMap)
T = promote_type(typeof(α), eltype(A))
Alast = last(A.maps)
if Alast isa UniformScalingMap
return CompositeMap{T}(tuple(Base.front(A.maps)..., UniformScalingMap(α * Alast.λ, size(Alast, 1))))
return CompositeMap{T}(tuple(Base.front(A.maps)..., α * Alast))
else
return CompositeMap{T}(tuple(A.maps..., UniformScalingMap(α, size(A, 1))))
end
Expand All @@ -60,7 +60,7 @@ function Base.:(*)(A::CompositeMap, α::Number)
T = promote_type(typeof(α), eltype(A))
Afirst = first(A.maps)
if Afirst isa UniformScalingMap
return CompositeMap{T}(tuple(UniformScalingMap(Afirst.λ * α, size(Afirst, 1)), Base.tail(A.maps)...))
return CompositeMap{T}(tuple(Afirst * α, Base.tail(A.maps)...))
else
return CompositeMap{T}(tuple(UniformScalingMap(α, size(A, 2)), A.maps...))
end
Expand Down

0 comments on commit a569922

Please sign in to comment.