# Gain estimation

`GainEquation`

Abstract type for a container representing a gain (vector field).

`GainEstimationMethod`

Abstract type for a method used to solve an equation of `GainEquation`

type.

`FeedbackParticleFilters.solve!`

— Function.`solve!(eq::GainEquation, method::GainEstimationMethod) --> eq`

Solves the gain equation `eq`

using method `method`

.

`FeedbackParticleFilters.update!`

— Function.`update!(filter_state, filter_algo, obs, dt) --> filter_state`

Updates the filter state by performing one forward step of the model and then assimilating the observation.

`update!(eq::GainEquation)`

Updates the gain equation `eq`

such that all information contained in it is self-consistent.

`update!(eq::GainEquation, ens::ParticleRepresentation)`

Updates the gain equation `eq`

by incorporating new information from the ensemble `ens`

.

## Poisson equation

`PoissonEquation(h, ensemble) ::GainEquation`

Returns a Poisson equation struct representing the equation $\nabla\cdot(p\nabla \phi) = - \tilde h$, where $p$ is a probability density and $\tilde h = h-\int h p dx$. The container contains the following fields

`:h':`

`h`

` itself`:positions': an i.i.d. sample from`

`p`

`, represented as a matrix`:H': the evaluation of`

`h`

` at the sample points`:mean_H': the sample average of`

H'`:potential': the evaluation of`

`\phi`

` at the sample points`:gain': the evaluation of`

`K=\nabla \phi`

` at the sample pointssolve!(eq::PoissonEquation, method::GainEstimationMethod)

Fills the field `:gain' with appropriate values. The fields`

:H', `:mean_H', and`

:potential' are stored to be re-used.

`update!(eq::PoissonEquation, ensemble)`

Fills the fields `:positions',`

:H', and `:mean_H' according to the new samples from`

ensemble'.

`update!(eq::PoissonEquation)`

Updates fields `:H', and`

:mean_H' to be consistent with `:positions'.

## Gain estimation methods

`ConstantGainApproximation()`

Represents an approximation of the gain by a constant (in the Euclidean sense) vector field, given by the covariance of the observation function and x under the particle distribution.

`SemigroupMethod(epsilon, delta, max_iter)`

Semigroup method from Algorithm 1 in [1].

[1] Taghvaei, A., & Mehta, P. G. (2016). Gain function approximation in the feedback particle filter. In 2016 IEEE 55th Conference on Decision and Control (CDC) (pp. 5446–5452). IEEE. https://doi.org/10.1109/CDC.2016.7799105

`SemigroupMethod(epsilon, delta, max_iter, lambda)`

Semigroup method with regularization parameter `lambda`

.

`DifferentialRKHSMethod(epsilon, lambda)`

Differential loss reproducing kernel Hilbert space (RKHS) method from [1], Section III.

**Parameters**

`epsilon`

: variance of the Gaussian kernel, Eq. 17 in [1]`lambda`

: regularization parameter, Eq. 20 in [1]

**Reference**

[1] Radhakrishnan, A. & and Meyn, S. (2018). Feedback particle filter design using a differential-loss reproducing kernel Hilbert space. 2018 Annual American Control Conference (ACC). IEEE. https://doi.org/10.23919/ACC.2018.8431689