@@ -209,6 +209,8 @@ for N in @tN([Float64, Float32, Rational{Int}])
209209 # affine_map (part 1)
210210 @test_throws DimensionMismatch affine_map (ones (N, 2 , 3 ), U, N[1 , 1 ])
211211 @test_throws DimensionMismatch affine_map (ones (N, 2 , 2 ), U, N[1 ])
212+ U2 = affine_map (N[1 0 ; 0 1 ], U, N[1 , 1 ])
213+ @test isidentical (U2, U)
212214
213215 # distance (between point and set)
214216 @test_throws DimensionMismatch distance (U, N[0 ])
@@ -241,6 +243,8 @@ for N in @tN([Float64, Float32, Rational{Int}])
241243
242244 # linear_map (part 1)
243245 @test_throws DimensionMismatch linear_map (ones (N, 2 , 1 ), U)
246+ U2 = linear_map (N[1 0 ; 0 1 ], U)
247+ @test isidentical (U2, U)
244248
245249 # linear_map_inverse
246250 U2 = LazySets. linear_map_inverse (ones (N, 2 , 3 ), U)
@@ -459,34 +463,25 @@ for N in @tN([Float64, Float32])
459463 @test_throws MethodError rationalize (U2)
460464
461465 # affine_map (part 2)
462- @static if isdefined (@__MODULE__ , :Polyhedra ) && isdefined (@__MODULE__ , :CDDLib )
463- @static if VERSION < v " 1.12"
464- # TODO this should work with older versions, see below
465- @test_broken affine_map (N[1 0 ; 0 1 ; 0 0 ], U, N[1 , 1 , 3 ])
466- else
467- X = affine_map (N[1 0 ; 0 1 ; 0 0 ], U, N[1 , 1 , 3 ])
468- @test X isa LazySet{N}
469- @test isequivalent (X, Hyperplane (N[0 , 0 , 1 ], N (3 )))
470- end
466+ @static if VERSION < v " 1.12"
467+ # TODO this should work with older versions, see below
468+ @test_broken affine_map (N[1 0 ; 0 1 ; 0 0 ], U, N[1 , 1 , 3 ])
469+ else
470+ X = affine_map (N[1 0 ; 0 1 ; 0 0 ], U, N[1 , 1 , 3 ])
471+ @test X isa HPolyhedron{N} && isequivalent (X, Hyperplane (N[0 , 0 , 1 ], N (3 )))
471472 end
472473
473474 # exponential_map
474475 U2 = exponential_map (ones (N, 2 , 2 ), U)
475- @test_broken isidentical (U2, U) # TODO this should change
476+ @test isidentical (U2, U)
476477
477478 # linear_map (part 2)
478- @static if isdefined (@__MODULE__ , :Polyhedra ) && isdefined (@__MODULE__ , :CDDLib )
479- U2 = linear_map (N[1 0 ; 0 1 ], U)
480- @test U2 isa HPolyhedron{N} # TODO this should change (HPolyhedron has no dimension)
481- @test_broken isequivalent (U2, U)
482- @static if VERSION < v " 1.12"
483- # TODO this should work with older versions, see below
484- @test_broken linear_map (N[1 0 ; 0 1 ; 0 0 ], U)
485- else
486- X = linear_map (N[1 0 ; 0 1 ; 0 0 ], U)
487- @test X isa HPolyhedron{N}
488- @test isequivalent (X, Hyperplane (N[0 , 0 , 1 ], N (0 )))
489- end
479+ @static if VERSION < v " 1.12"
480+ # TODO this should work with older versions, see below
481+ @test_broken linear_map (N[1 0 ; 0 1 ; 0 0 ], U)
482+ else
483+ X = linear_map (N[1 0 ; 0 1 ; 0 0 ], U)
484+ @test X isa HPolyhedron{N} && isequivalent (X, Hyperplane (N[0 , 0 , 1 ], N (0 )))
490485 end
491486end
492487
@@ -496,32 +491,34 @@ for N in [Float64]
496491 # affine_map (part 3)
497492 @static if isdefined (@__MODULE__ , :Polyhedra ) && isdefined (@__MODULE__ , :CDDLib )
498493 @static if VERSION < v " 1.12"
499- # TODO this should work, even without Polyhedra
494+ # TODO these should work with older versions, see below
495+ @test_broken affine_map (N[1 2 ; 0 0 ], U, N[1 , 1 ])
500496 @test_broken affine_map (ones (N, 2 , 2 ), U, N[2 , 0 ])
501497 @test_broken affine_map (zeros (N, 2 , 2 ), U, N[2 , 0 ])
502498 else
499+ X = affine_map (N[1 2 ; 0 0 ], U, N[1 , 1 ]) # projection to axis
500+ @test X isa HPolyhedron{N} && isequivalent (X, Hyperplane (N[0 , 1 ], N (1 )))
503501 X = affine_map (ones (N, 2 , 2 ), U, N[2 , 0 ]) # projection to line
504- @test X isa HPolyhedron{N}
505- @test isequivalent (X, Line2D (N[1 , - 1 ], N (2 )))
502+ @test X isa HPolyhedron{N} && isequivalent (X, Line2D (N[1 , - 1 ], N (2 )))
506503 X = affine_map (zeros (N, 2 , 2 ), U, N[2 , 0 ]) # zero map
507- @test X isa HPolyhedron{N}
508- @test isequivalent (X, Singleton (N[2 , 0 ]))
504+ @test X isa HPolyhedron{N} && isequivalent (X, Singleton (N[2 , 0 ]))
509505 end
510506 end
511507
512508 # linear_map (part 3)
513509 @static if isdefined (@__MODULE__ , :Polyhedra ) && isdefined (@__MODULE__ , :CDDLib )
514510 @static if VERSION < v " 1.12"
515511 # TODO these should work with older versions, see below
512+ @test_broken linear_map (N[1 2 ; 0 0 ], U)
516513 @test_broken linear_map (ones (N, 2 , 2 ), U)
517514 @test_broken linear_map (zeros (N, 2 , 2 ), U)
518515 else
516+ X = linear_map (N[1 2 ; 0 0 ], U) # projection to axis
517+ @test X isa HPolyhedron{N} && isequivalent (X, Hyperplane (N[0 , 1 ], N (0 )))
519518 X = linear_map (ones (N, 2 , 2 ), U) # projection to line
520- @test X isa HPolyhedron{N}
521- @test isequivalent (X, Line2D (N[1 , - 1 ], N (0 )))
519+ @test X isa HPolyhedron{N} && isequivalent (X, Line2D (N[1 , - 1 ], N (0 )))
522520 X = linear_map (zeros (N, 2 , 2 ), U) # zero map
523- @test X isa HPolyhedron{N}
524- @test isequivalent (X, ZeroSet {N} (2 ))
521+ @test X isa HPolyhedron{N} && isequivalent (X, ZeroSet {N} (2 ))
525522 end
526523 end
527524end
0 commit comments