tree_update: tree_update

Description Usage Arguments Details Value Examples

View source: R/trees.R

Description

This function updates a tree given new particles and ancestors. This is achieved by pruning the tree first, then inserting the new particles according to their respective ancestors.

Usage

1
tree_update(tree, X_t, a_t)

Arguments

tree

is a list encoding a tree genereated via the function tree_init or previously updated via the function tree_update

X_t

is a dimX by N matrix representing a set of N new dimX-dimensional particles.

a_t

is a vector of length N containing the indices of the new particles' ancestors.

Details

See documentation of tree_init for a description of the tree's fields. See also Path storage in the particle filter, by Jacob, Murray, Rubenthaler (2015) [https://link.springer.com/article/10.1007/s11222-013-9445-x]

Value

This function outputs the tree with updated fields (see details).

Examples

1
2
3
4
5
6
7
N = 5
dimX = 2
X_0 = matrix(rnorm(N*dimX), nrow = dimX, ncol = N)
X_1 = matrix(rnorm(N*dimX), nrow = dimX, ncol = N)
a_1 = sample(1:N, size = N, replace = TRUE)
tree = tree_init(X_0)
tree = tree_update(tree, X_1, a_1)

pierrejacob/PET documentation built on May 25, 2019, 11:35 p.m.