linear

Utilities for Linear Inference

This code is used in the gtsam_examples book.

Easy Creation of VectorValues


source

vv

 vv (keys_vectors:Dict[int,numpy.ndarray])

Create a VectorValues from a dict

x = {k:gtsam.symbol('x',k) for k in [1,2,3]}
vv66 = vv({x[1]: [66]})
assert isinstance(vv66, gtsam.VectorValues)
test_eq(vv66.size(),1)
test_eq(vv66.at(x[1]),66)
vv34 = vv({x[1]:[3],x[2]:[4]})
assert isinstance(vv34, gtsam.VectorValues)
test_eq(vv34.size(),2)
test_eq(vv34.at(x[1]),[3])
test_eq(vv34.at(x[2]),[4])

An Image Denoising Gaussian MRF

This example is used in gtsam-examples to show of loopy belief propagation.


source

denoising_MRF

 denoising_MRF (M:int, N:int, sigma=0.5, smoothness_sigma=0.5)

Create MxN MRF @returns graph and symbols used for rows.

graph, row_symbols = denoising_MRF(3, 4)
position_hints = {c:float(1-i) for i,c in enumerate(row_symbols)}
show(graph, binary_edges=True, hints=position_hints)

A 2D Points Gaussian MRF

We create a grid of 2D points, connected in a 4-neighborhood, to show off clustered loopy belief propagation.