Skip to content

Commit 011b89a

Browse files
committed
Doc fix, close #16
1 parent 0013a2a commit 011b89a

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/Kalman.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DynamicIterators: evolve, dyniterate, @returnnothing
88
import Base: iterate, IteratorSize, IteratorEltype, eltype, length
99

1010
import Random.rand
11+
import GaussianDistributions:
1112

1213
meancov(G) = mean(G), cov(G)
1314
meancov(G::Tuple) = G

src/evolution.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11

22
"""
3-
LinearEvolution(Φ, b, Q)
3+
LinearEvolution(Φ, b, Q) <: Evolution
44
5-
Evolution of the law of `x -> Φ x + w` where ``w ~ N(0, Q)``
5+
Evolution of the law of `x -> Φ x + w` where ``w \\sim N(0, Q)``.
6+
7+
# Examples
8+
```
9+
evolve(LinearEvolution(Φ, b, Q), 0 => Gaussian(x, P))
10+
```
611
"""
712
struct LinearEvolution{TΦ,TQ} <: Evolution
813
Φ::TΦ # dxd
@@ -17,12 +22,8 @@ end
1722
evolve(M::LinearEvolution, u::Pair) = timelift_evolve(M, u)
1823
evolve(M::LinearEvolution, u::Pair, c) = timelift_evolve(M, u, c)
1924

20-
function evolve(M::LinearEvolution, G::Gaussian)
21-
Gaussian(M.Φ*mean(G) + mean(M.Q), M.Φ*cov(G)*M.Φ' + cov(M.Q))
22-
end
23-
24-
function evolve(M::LinearEvolution, x)
25-
Gaussian(M.Φ*x + mean(M.Q), cov(M.Q))
25+
function evolve(M::LinearEvolution, G)
26+
M.Φ*G M.Q
2627
end
2728

2829

src/observation.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ end
66
struct GenericLinearObservationModel <: Observation
77
end
88

9+
"""
10+
LinearObservationModel(H, R)
911
12+
Observe `y = Hx + v` where ``v \\sim N(0, R)``.
13+
"""
1014
struct LinearObservationModel{TH, TR} <: Observation
1115
H::TH # dxd
1216
R::TR # d
@@ -16,9 +20,15 @@ end
1620
(O::LinearObservationModel)((x, P)::Gaussian) = Gaussian(O.H*x, O.H*P*O.H' + O.R)
1721

1822
"""
19-
LinearObservationModel(H, R)
23+
LinearObservation(P, H, R)
24+
25+
Observe the LinearEvolution `P` using `y = Hx + v`
26+
where ``v \\sim N(0, R)``.
2027
21-
Observe `y = Hx + v` where ``v ~ N(0, R)``
28+
# Examples
29+
```
30+
O = LinearObservation(LinearEvolution(Φ, Gaussian(b, Q)), H, R)
31+
```
2232
"""
2333
struct LinearObservation{T, TH, TR} <: Observation
2434
P::T

src/statespacemodel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ LinearStateSpaceModel(sys, obs)
2424
Combines a linear system `sys` and an observations model `obs` and
2525
to a linear statespace model in a modular way.
2626
27-
Evolves StateObs objects.
27+
Evolves `StateObs` objects.
2828
"""
2929
struct LinearStateSpaceModel{Tsys,Tobs} <: StateSpaceModel
3030
sys::Tsys

0 commit comments

Comments
 (0)