@@ -624,11 +624,11 @@ This estimator is allocation-free if `model` simulations do not allocate.
624624 disturbances at measured outputs ``\m athbf{Q_{int_{ym}}}`` (composed of integrators).
625625- `σPint_ym_0=fill(1,sum(nint_ym))` or *`sigmaPint_ym_0`* : same than `σP_0` but for the unmeasured
626626 disturbances at measured outputs ``\m athbf{P_{int_{ym}}}(0)`` (composed of integrators).
627- - `direct=true`: construct with a direct transmission from ``\m athbf{y^m}`` (a.k.a. current
628- estimator, in opposition to the delayed/predictor form).
629627- `α=1e-3` or *`alpha`* : alpha parameter, spread of the state distribution ``(0 < α ≤ 1)``.
630628- `β=2` or *`beta`* : beta parameter, skewness and kurtosis of the states distribution ``(β ≥ 0)``.
631629- `κ=0` or *`kappa`* : kappa parameter, another spread parameter ``(0 ≤ κ ≤ 3)``.
630+ - `direct=true`: construct with a direct transmission from ``\m athbf{y^m}`` (a.k.a. current
631+ estimator, in opposition to the delayed/predictor form).
632632
633633# Examples
634634```jldoctest
@@ -960,12 +960,41 @@ Both [`LinModel`](@ref) and [`NonLinModel`](@ref) are supported. The process mod
960960keyword arguments are identical to [`UnscentedKalmanFilter`](@ref), except for `α`, `β` and
961961`κ` which do not apply to the extended Kalman Filter. The Jacobians of the augmented model
962962``\m athbf{f̂, ĥ}`` are computed with [`ForwardDiff`](@extref ForwardDiff) automatic
963- differentiation. This estimator allocates memory for the Jacobians.
964-
963+ differentiation. This estimator is allocation-free if `model` simulations do not allocate.
965964!!! warning
966965 See the Extended Help of [`linearize`](@ref) function if you get an error like:
967966 `MethodError: no method matching (::var"##")(::Vector{ForwardDiff.Dual})`.
968967
968+ # Arguments
969+ !!! info
970+ Keyword arguments with *`emphasis`* are non-Unicode alternatives.
971+
972+ - `model::SimModel` : (deterministic) model for the estimations.
973+ - `i_ym=1:model.ny` : `model` output indices that are measured ``\m athbf{y^m}``, the rest
974+ are unmeasured ``\m athbf{y^u}``.
975+ - `σP_0=fill(1/model.nx,model.nx)` or *`sigmaP_0`* : main diagonal of the initial estimate
976+ covariance ``\m athbf{P}(0)``, specified as a standard deviation vector.
977+ - `σQ=fill(1/model.nx,model.nx)` or *`sigmaQ`* : main diagonal of the process noise
978+ covariance ``\m athbf{Q}`` of `model`, specified as a standard deviation vector.
979+ - `σR=fill(1,length(i_ym))` or *`sigmaR`* : main diagonal of the sensor noise covariance
980+ ``\m athbf{R}`` of `model` measured outputs, specified as a standard deviation vector.
981+ - `nint_u=0`: integrator quantity for the stochastic model of the unmeasured disturbances at
982+ the manipulated inputs (vector), use `nint_u=0` for no integrator (see Extended Help).
983+ - `nint_ym=default_nint(model,i_ym,nint_u)` : same than `nint_u` but for the unmeasured
984+ disturbances at the measured outputs, use `nint_ym=0` for no integrator (see Extended Help).
985+ - `σQint_u=fill(1,sum(nint_u))` or *`sigmaQint_u`* : same than `σQ` but for the unmeasured
986+ disturbances at manipulated inputs ``\m athbf{Q_{int_u}}`` (composed of integrators).
987+ - `σPint_u_0=fill(1,sum(nint_u))` or *`sigmaPint_u_0`* : same than `σP_0` but for the unmeasured
988+ disturbances at manipulated inputs ``\m athbf{P_{int_u}}(0)`` (composed of integrators).
989+ - `σQint_ym=fill(1,sum(nint_ym))` or *`sigmaQint_u`* : same than `σQ` for the unmeasured
990+ disturbances at measured outputs ``\m athbf{Q_{int_{ym}}}`` (composed of integrators).
991+ - `σPint_ym_0=fill(1,sum(nint_ym))` or *`sigmaPint_ym_0`* : same than `σP_0` but for the unmeasured
992+ disturbances at measured outputs ``\m athbf{P_{int_{ym}}}(0)`` (composed of integrators).
993+ - `jacobian=AutoForwardDiff()`: an `AbstractADType` backend for the Jacobians of the augmented
994+ model, see [`DifferentiationInterface` doc](@extref DifferentiationInterface List).
995+ - `direct=true`: construct with a direct transmission from ``\m athbf{y^m}`` (a.k.a. current
996+ estimator, in opposition to the delayed/predictor form).
997+
969998# Examples
970999```jldoctest
9711000julia> model = NonLinModel((x,u,_,_)->0.2x+u, (x,_,_)->-3x, 5.0, 1, 1, 1, solver=nothing);
@@ -1035,11 +1064,15 @@ end
10351064
10361065Return the `linfunc!` function that computes the Jacobians of the augmented model.
10371066
1038- The function has the following signature :
1067+ The function has the two following methods :
10391068```
1040- linfunc!(x̂0next, ŷ0, F̂, Ĥ, backend, x̂0, cst_u0, cst_d0) -> nothing
1069+ linfunc!(x̂0next , ::Nothing, F̂ , ::Nothing, backend, x̂0, cst_u0, cst_d0) -> nothing
1070+ linfunc!(::Nothing, ŷ0 , ::Nothing, Ĥ , backend, x̂0, _ , cst_d0) -> nothing
10411071```
1042- #TODO: continue here
1072+ To respectively compute only `F̂` or `Ĥ` Jacobian. The methods mutate all the arguments
1073+ before `backend` argument. The `backend` argument is an `AbstractADType` object from
1074+ `DifferentiationInterface`. The `cst_u0` and `cst_d0` are `DifferentiationInterface.Constant`
1075+ objects with the linearization points.
10431076"""
10441077function get_ekf_linfunc (NT, model, i_ym, nint_u, nint_ym, jacobian)
10451078 As, Cs_u, Cs_y = init_estimstoch (model, i_ym, nint_u, nint_ym)
@@ -1056,13 +1089,6 @@ function get_ekf_linfunc(NT, model, i_ym, nint_u, nint_ym, jacobian)
10561089 cst_d0 = Constant (zeros (NT, nd))
10571090 F̂_prep = prepare_jacobian (f̂_ekf!, x̂0next, jacobian, x̂0, tmp_û0, cst_u0, cst_d0; strict)
10581091 Ĥ_prep = prepare_jacobian (ĥ_ekf!, ŷ0, jacobian, x̂0, cst_d0; strict)
1059- # main method to compute both Jacobians, it mutates all args before `backend`:
1060- function linfunc! (x̂0next, ŷ0, F̂, Ĥ, backend, x̂0, cst_u0, cst_d0)
1061- jacobian! (f̂_ekf!, x̂0next, F̂, F̂_prep, backend, x̂0, tmp_û0, cst_u0, cst_d0)
1062- jacobian! (ĥ_ekf!, ŷ0, Ĥ, Ĥ_prep, backend, x̂0, cst_d0)
1063- return nothing
1064- end
1065- # two additional methods to only compute one of the two Jacobians at a time:
10661092 function linfunc! (x̂0next, ŷ0:: Nothing , F̂, Ĥ:: Nothing , backend, x̂0, cst_u0, cst_d0)
10671093 return jacobian! (f̂_ekf!, x̂0next, F̂, F̂_prep, backend, x̂0, tmp_û0, cst_u0, cst_d0)
10681094 end
@@ -1102,8 +1128,8 @@ augmented process model:
11021128\e nd{aligned}
11031129```
11041130The matrix ``\m athbf{Ĥ^m}`` is the rows of ``\m athbf{Ĥ}`` that are measured outputs. The
1105- Jacobians are computed with [`ForwardDiff`](@extref ForwardDiff). The correction and
1106- prediction step equations are provided below. The correction step is skipped if
1131+ Jacobians are computed with [`ForwardDiff`](@extref ForwardDiff) bu default . The correction
1132+ and prediction step equations are provided below. The correction step is skipped if
11071133`estim.direct == true` since it's already done by the user.
11081134
11091135# Correction Step
0 commit comments