Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all system getters to IVP #306

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/src/lib/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ outputmap
islinear(::AbstractSystem)
islinear(::AbstractMap)
isaffine(::AbstractSystem)
ispolynomial(::AbstractSystem)
isaffine(::AbstractMap)
ispolynomial(::AbstractSystem)
isblackbox(::AbstractSystem)
isnoisy(::AbstractSystem)
iscontrolled(::AbstractSystem)
Expand All @@ -59,6 +59,7 @@ state_matrix(::AbstractSystem)
input_matrix(::AbstractSystem)
noise_matrix(::AbstractSystem)
affine_term(::AbstractSystem)
mapping(::AbstractSystem)
```

## Maps
Expand Down
1 change: 1 addition & 0 deletions src/MathematicalSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export statedim,
input_matrix,
noise_matrix,
affine_term,
mapping,
mass_matrix,
viscosity_matrix,
stiffness_matrix
Expand Down
27 changes: 17 additions & 10 deletions src/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function noiseset(::AbstractSystem) end
"""
state_matrix(s::AbstractSystem)

Return the state matrix of an affine system.
Returns the state matrix of an affine system.

### Notes

Expand All @@ -62,7 +62,7 @@ function state_matrix(::AbstractSystem) end
"""
input_matrix(s::AbstractSystem)

Return the input matrix of a system with linear input.
Returns the input matrix of a system with linear input.

### Notes

Expand All @@ -74,7 +74,7 @@ function input_matrix(::AbstractSystem) end
"""
noise_matrix(s::AbstractSystem)

Return the noise matrix of a system with linear noise.
Returns the noise matrix of a system with linear noise.

### Notes

Expand All @@ -86,14 +86,21 @@ function noise_matrix(::AbstractSystem) end
"""
affine_term(s::AbstractSystem)

Return the affine term in an affine system.
Returns the affine term in an affine system.

### Notes

The affine term is e.g. the vector ``c`` in the affine system ``x' = Ax + c``.
"""
function affine_term(::AbstractSystem) end

"""
mapping(s::AbstractSystem)

Returns the mapping of a black-box system.
"""
function mapping(::AbstractSystem) end

"""
outputmap(s::AbstractSystem)

Expand All @@ -118,7 +125,7 @@ abstract type AbstractContinuousSystem <: AbstractSystem end
"""
islinear(s::AbstractSystem)

Specifies if the dynamics of system `s` is specified by linear equations.
Determines whether the dynamics of system `s` is specified by linear equations.

### Notes

Expand All @@ -141,7 +148,7 @@ function islinear(::AbstractSystem) end
"""
isaffine(s::AbstractSystem)

Specifies if the dynamics of system `s` is specified by affine equations.
Determines whether the dynamics of system `s` is specified by affine equations.

### Notes

Expand All @@ -159,7 +166,7 @@ function isaffine(::AbstractSystem) end
"""
ispolynomial(s::AbstractSystem)

Specifies if the dynamics of system `s` is specified by polynomial equations.
Determines whether the dynamics of system `s` is specified by polynomial equations.

The result of this function only depends on the system type, not the value, and
can also be applied to `typeof(s)`. Hence, e.g. a `LinearContinuousSystem` is not
Expand All @@ -170,7 +177,7 @@ function ispolynomial(::AbstractSystem) end
"""
isblackbox(s::AbstractSystem)

Specifies if no specific structure is assumed for the dynamics of system `s`.
Determines whether no specific structure is assumed for the dynamics of system `s`.

The result of this function only depends on the system type, not the value, and
can also be applied to `typeof(s)`.
Expand Down Expand Up @@ -225,7 +232,7 @@ function outputdim(::AbstractMap) end
"""
islinear(m::AbstractMap)

Specifies if the map `m` is linear or not.
Determines whether the map `m` is linear or not.

### Notes

Expand All @@ -237,7 +244,7 @@ function islinear(::AbstractMap) end
"""
isaffine(m::AbstractMap)

Specifies if the map `m` is affine or not.
Determines whether the map `m` is affine or not.

### Notes

Expand Down
5 changes: 5 additions & 0 deletions src/ivp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ noiseset(ivp::InitialValueProblem) = noiseset(ivp.s)
islinear(ivp::InitialValueProblem) = islinear(ivp.s)
isaffine(ivp::InitialValueProblem) = isaffine(ivp.s)
ispolynomial(ivp::InitialValueProblem) = ispolynomial(ivp.s)
isblackbox(ivp::InitialValueProblem) = isblackbox(ivp.s)
isnoisy(ivp::InitialValueProblem) = isnoisy(ivp.s)
iscontrolled(ivp::InitialValueProblem) = iscontrolled(ivp.s)
isconstrained(ivp::InitialValueProblem) = isconstrained(ivp.s)
state_matrix(ivp::InitialValueProblem) = state_matrix(ivp.s)
input_matrix(ivp::InitialValueProblem) = input_matrix(ivp.s)
noise_matrix(ivp::InitialValueProblem) = noise_matrix(ivp.s)
affine_term(ivp::InitialValueProblem) = affine_term(ivp.s)
mapping(ivp::InitialValueProblem) = mapping(ivp.s)

"""
initial_state(ivp::InitialValueProblem)
Expand Down
1 change: 1 addition & 0 deletions test/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using MathematicalSystems: AbstractDiscretizationAlgorithm,
@test isnothing(input_matrix(s))
@test isnothing(noise_matrix(s))
@test isnothing(affine_term(s))
@test isnothing(mapping(s))
@test isnothing(outputmap(s))
end

Expand Down
8 changes: 8 additions & 0 deletions test/ivp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@
@test !islinear(P)
@test isaffine(P)
@test !ispolynomial(P)
@test !isblackbox(P)
@test isnoisy(P)
@test iscontrolled(P)
@test isconstrained(P)
@test affine_term(P) == c

f() = 1
P = BlackBoxDiscreteSystem(f, 1)
@test mapping(P) == f
end
Loading