-
Notifications
You must be signed in to change notification settings - Fork 7
Description
The addition of parametric subtypes in PR #332 introduces some ambiguities and seems to require further refactoring. I’ve noticed at least two problems so far:
1. Ambiguous categorization of systems with parametric matrices
A system of the form
where A is an interval matrix can naturally be categorized as a parametric system.
However, in MathematicalSystems it is also possible to construct a LinearContinuousSystem with an IntervalMatrix, since IntervalMatrix is a subtype of AbstractMatrix.
This creates an ambiguity
2. _corresponding_type does not distinguish parametric vs. non-parametric
The internal function
MathematicalSystems.jl/src/macros.jl
Lines 151 to 161 in 0655e43
| function _corresponding_type(AT::Type{<:AbstractSystem}, fields::Tuple) | |
| TYPES = types_table(AT) | |
| FIELDS = fields_table(AT) | |
| idx = findall(x -> issetequal(fields, x), FIELDS) | |
| if isempty(idx) | |
| throw(ArgumentError("the entry $(fields) does not match a " * | |
| "`MathematicalSystems.jl` structure")) | |
| end | |
| @assert length(idx) == 1 "found more than one compatible system type" | |
| return TYPES[idx][1] | |
| end |
only considers field names for classification, not the types of the fields.
As a result, a LinearContinuousSystem and a LinearParametricContinuousSystem (which share the same field names) are indistinguishable here.