Skip to content

Commit 494a7e7

Browse files
docs: add docstrings for linearization
1 parent f9c328f commit 494a7e7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/linearization.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ function SymbolicIndexingInterface.parameter_values(f::LinearizationFunction)
148148
end
149149
SymbolicIndexingInterface.current_time(f::LinearizationFunction) = current_time(f.prob)
150150

151+
"""
152+
$(TYPEDSIGNATURES)
153+
154+
Linearize the wrapped system at the point given by `(u, p, t)`.
155+
"""
151156
function (linfun::LinearizationFunction)(u, p, t)
152157
if eltype(p) <: Pair
153158
p = todict(p)
@@ -241,11 +246,33 @@ SymbolicIndexingInterface.parameter_values(integ::MockIntegrator) = integ.p
241246
SymbolicIndexingInterface.current_time(integ::MockIntegrator) = integ.t
242247
SciMLBase.get_tmp_cache(integ::MockIntegrator) = integ.cache
243248

249+
"""
250+
$(TYPEDEF)
251+
252+
A struct representing a linearization operation to be performed. Can be symbolically
253+
indexed to efficiently update the operating point for multiple linearizations in a loop.
254+
The value of the independent variable can be set by mutating the `.t` field of this struct.
255+
"""
244256
mutable struct LinearizationProblem{F <: LinearizationFunction, T}
257+
"""
258+
The wrapped `LinearizationFunction`
259+
"""
245260
const f::F
246261
t::T
247262
end
248263

264+
"""
265+
$(TYPEDSIGNATURES)
266+
267+
Construct a `LinearizationProblem` for linearizing the system `sys` with the given
268+
`inputs` and `outputs`.
269+
270+
# Keyword arguments
271+
272+
- `t`: The value of the independent variable
273+
274+
All other keyword arguments are forwarded to `linearization_function`.
275+
"""
249276
function LinearizationProblem(sys::AbstractSystem, inputs, outputs; t = 0.0, kwargs...)
250277
linfun, _ = linearization_function(sys, inputs, outputs; kwargs...)
251278
return LinearizationProblem(linfun, t)

0 commit comments

Comments
 (0)