Skip to content

Commit

Permalink
Merge pull request #3428 from JuliaReach/schillic/3364_fix
Browse files Browse the repository at this point in the history
Fix linear_map of AbstractZonotope for 1D output
  • Loading branch information
schillic authored Jan 19, 2024
2 parents 83f6705 + 95181a5 commit ea9e0a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Interfaces/AbstractZonotope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@ function _linear_map_zonotope_1D(M::AbstractMatrix, Z::LazySet)
c = M * center(Z)
gi = zero(N)
@inbounds for g in generators(Z)
for i in eachindex(g)
gi += M[1, i] * g[i]
end
gi += abs(sum(M[1, i] * g[i] for i in eachindex(g)))
end
return Zonotope(c, hcat(gi))
end
Expand Down
2 changes: 1 addition & 1 deletion test/Sets/Zonotope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ for N in [Float64, Rational{Int}, Float32]
@test Z5.center == N[0, 1]
@test Z5.generators == N[1//2 1//2 1//2 0; -1//2 1//2 0 1//2]
# 1D simplifies to 1 generator
M = N[1 1;]
M = N[-1 1;]
Z6 = linear_map(M, Z3)
@test ngens(Z6) == 1 && genmat(Z6) == hcat(N[4])

Expand Down

0 comments on commit ea9e0a2

Please sign in to comment.