Skip to content

Commit 80c3357

Browse files
committed
add mixed zono/polyzono 'linear_combination'
1 parent bfe2669 commit 80c3357

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ConcreteOperations/linear_combination.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ function linear_combination(P1::AbstractPolynomialZonotope,
3636
SSPZ2 = convert(SimpleSparsePolynomialZonotope, P2)
3737
return linear_combination(SSPZ1, SSPZ2)
3838
end
39+
40+
@commutative function linear_combination(Z::AbstractZonotope, P::AbstractPolynomialZonotope)
41+
return linear_combination(convert(SparsePolynomialZonotope, Z), P)
42+
end

test/Sets/SparsePolynomialZonotope.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ for N in [Float64, Float32, Rational{Int}]
153153
# no reasonable tests available here
154154
@test PZ_ch isa SimpleSparsePolynomialZonotope{N}
155155
@test center(PZ_ch) == N[-1, 3//2]
156+
# mixed linear_combination
157+
PZ_lc = linear_combination(PZ1, ZeroSet{N}(2))
158+
@test PZ_lc isa SimpleSparsePolynomialZonotope{N}
156159
end
157160

158161
for N in [Float64]

0 commit comments

Comments
 (0)