Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ISAM2Clique

ISAM2Clique is the clique type inside iSAM2’s Gaussian Bayes tree. It stores a conditional, cached separator information, and the local gradient contribution used during incremental updates.

Open In Colab
import gtsam
import numpy as np
from gtsam.symbol_shorthand import L, V, X

How cliques are created

Applications do not normally construct populated cliques. ISAM2.update() creates and replaces them as variables are re-eliminated. The wrapped default constructor produces only an uninitialized placeholder, so calling gradientContribution() on it is not meaningful.

params = gtsam.ISAM2Params()
isam = gtsam.ISAM2(params)

graph = gtsam.NonlinearFactorGraph()
model = gtsam.noiseModel.Diagonal.Sigmas(np.array([0.1, 0.1, 0.05]))
graph.add(gtsam.PriorFactorPose2(X(0), gtsam.Pose2(), model))
values = gtsam.Values()
values.insert(X(0), gtsam.Pose2(0.1, -0.1, 0.02))

result = isam.update(graph, values)
print("cliques created:", result.getCliques())

Inspecting clique-level behavior

The wrapper exposes gradientContribution() and print() on a valid clique, but it does not currently expose an accessor that returns an ISAM2Clique from ISAM2. For Python diagnostics, use ISAM2.dot(), printStats(), treeNnz(), and the clique counts in ISAM2Result.

dot = isam.dot()
print("Bayes-tree DOT begins with:", dot.splitlines()[0])
print("tree nonzeros:", isam.treeNnz())

Source

ISAM2Clique.h

AI assistance caveat

AI was used to help draft this documentation, and inaccuracies could be present.