Exact and approximate system equality should not look at the type parameters
schillic opened this issue · comments
Christian Schilling commented
I would argue that the following two systems should be exactly and approximately equal.
julia> A = [1.0 1; 1 -1]
2×2 Matrix{Float64}:
1.0 1.0
1.0 -1.0
julia> B = [1 1; 1 -1]
2×2 Matrix{Int64}:
1 1
1 -1
julia> sA = LinearDiscreteSystem(A)
LinearDiscreteSystem{Float64, Matrix{Float64}}([1.0 1.0; 1.0 -1.0])
julia> sB = LinearDiscreteSystem(B)
LinearDiscreteSystem{Int64, Matrix{Int64}}([1 1; 1 -1])
julia> sA ≈ sB
false
julia> sA == sB
false
The reason for the false
is that we first compare the types, which include all type parameters, and LinearDiscreteSystem{Float64, Matrix{Float64}} != LinearDiscreteSystem{Int64, Matrix{Int64}}
because Float64 != Int
:
MathematicalSystems.jl/src/utilities.jl
Lines 17 to 20 in 5d93f07
I would thus suggest to replace this check with the (probably intended) check of the ground type.