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.

LinearContainerFactor

This API walkthrough introduces the wrapped classes LinearContainerFactor declared by LinearContainerFactor.h and demonstrates their principal Python operations.

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

Overview

The LinearContainerFactor class in GTSAM is a specialized factor that encapsulates a linear factor within a nonlinear factor graph. This is used extensively when marginalizing out variables.

Key Features

  • Encapsulation of Linear Factors: The primary function of the LinearContainerFactor is to store a linear factor and its associated values, enabling it to be used within a nonlinear context.

  • Error Calculation: It provides mechanisms to compute the error of the factor given a set of values.

  • Jacobian Computation: The class can compute the Jacobian matrix, which is essential for optimization processes.

Key Methods

  • LinearContainerFactor: This constructor initializes the LinearContainerFactor with a linear factor and optionally with values. It serves as the entry point for creating an instance of this class.

Python wrapper walkthrough

The following cell exercises the wrapped API directly.

def public_api(qualified_name):
    value = gtsam
    for component in qualified_name.split('.'):
        value = getattr(value, component, None)
        if value is None:
            return []
    return [name for name in dir(value) if not name.startswith('_')]

print('\nLinearContainerFactor')
print(public_api('LinearContainerFactor'))