You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original problem in #2169 is not fixed yet (now we get an error, though).
using LazySets, Polyhedra
# dimensions of X and Y
n =2
m =4
A =rand(m, n)
B =transpose(A) # dummy matrix with n rows / m columns (currently required but ignored)
X =rand(BallInf, dim=n)
Y =linear_map(A, X)
julia> Z =linear_map(B, Y, inverse=A)
ERROR: AssertionError: the constraints must have the same normal direction
Stacktrace:
[1] macro expansion at .julia/dev/LazySets/src/Assertions/Assertions.jl:23 [inlined]
[2] is_tighter_same_dir_2D(::LazySets.HalfSpace{Float64,Array{Float64,1}}, ::LazySets.HalfSpace{Float64,Array{Float64,1}}; strict::Bool) at .julia/dev/LazySets/src/Sets/HalfSpace.jl:437
[3] isredundant(::LazySets.HalfSpace{Float64,Array{Float64,1}}, ::LazySets.HalfSpace{Float64,Array{Float64,1}}, ::LazySets.HalfSpace{Float64,Array{Float64,1}}) at .julia/dev/LazySets/src/Interfaces/AbstractHPolygon.jl:312
[4] addconstraint!(::Array{LazySets.HalfSpace{Float64,Array{Float64,1}},1}, ::LazySets.HalfSpace{Float64,Array{Float64,1}}; linear_search::Bool, prune::Bool) at .julia/dev/LazySets/src/Interfaces/AbstractHPolygon.jl:476
[5] HPolygon(::Array{LazySets.HalfSpace{Float64,Array{Float64,1}},1}; sort_constraints::Bool, check_boundedness::Bool, prune::Bool) at .julia/dev/LazySets/src/Sets/HPolygon.jl:56
[6] HPolygon(::Array{LazySets.HalfSpace{Float64,Array{Float64,1}},1}) at .julia/dev/LazySets/src/Sets/HPolygon.jl:52
[7] _linear_map_hrep_helper(::LinearAlgebra.Transpose{Float64,Array{Float64,2}}, ::Zonotope{Float64,Array{Float64,1},Array{Float64,2}}, ::LazySets.LinearMapInverse{Float64,Array{Float64,2}}) at .julia/dev/LazySets/src/Interfaces/AbstractPolytope.jl:155
[8] linear_map(::LinearAlgebra.Transpose{Float64,Array{Float64,2}}, ::Zonotope{Float64,Array{Float64,1},Array{Float64,2}}; algorithm::Nothing, check_invertibility::Bool, cond_tol::Float64, inverse::Array{Float64,2}, backend::Nothing, elimination_method::Nothing) at .julia/dev/LazySets/src/Interfaces/AbstractPolyhedron_functions.jl:608
[9] top-level scope at REPL[23]:1
[10] eval(::Module, ::Any) at ./boot.jl:331
[11] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
[12] run_backend(::REPL.REPLBackend) at .julia/packages/Revise/tV8FE/src/Revise.jl:1165
[13] top-level scope at none:0
The text was updated successfully, but these errors were encountered:
If the map is rectangular with m > n, it can't be invertible (unless you are considering a generalized inverse such a Moore-Penrose pseudoinverse, but that hasn't been considered in linear_map). For these cases one can use the lift algorithm, such as Y = linear_map(A, X, algorithm="lift") in your example. Recall that the fallback just passes X to a zonotope and computes the concrete linear map, btw.
The behavior is like this because if the inverse matrix is given, the "inverse" is applied,
If an inverse matrix is passed in inverse, the given algorithm is applied, and if none is given, either "inverse" or "inverse_right" is applied (in that order of preference)
It is not checked that the matrix is square.. maybe we should make this check and send an error message otherwise.
The original problem in #2169 is not fixed yet (now we get an error, though).
The text was updated successfully, but these errors were encountered: