Skip to content

Commit

Permalink
change default implementation of 'scale'
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Dec 30, 2024
1 parent bb66e35 commit 9166286
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Interfaces/LazySet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1503,12 +1503,25 @@ function linear_map(a::Number, X::LazySet; kwargs...)
return scale(a, X; kwargs...)
end

function linear_map(αI::UniformScaling, X::LazySet)
M = Diagonal(fill(αI.λ, dim(X)))
return linear_map(M, X)
end

"""
# Extended help
scale(α::Real, X::LazySet)
### Algorithm
The default implementation calls `scale!` on a copy of `X`.
The default implementation computes `linear_map` with the diagonal matrix ``α*I``.
"""
function scale::Real, X::LazySet)
return linear_map*I, X)
end

function _scale_copy_inplace::Real, X::LazySet)
Y = copy(X)
scale!(α, Y)
return Y
Expand Down

0 comments on commit 9166286

Please sign in to comment.