Skip to content

Ambiguities introduced by parametric subtypes  #333

@alecarraro

Description

@alecarraro

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

$$x' = A x$$

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions