Created by Codex.
Remove the stabilizer gauge directions introduced by a lifted Shonan variable.
Mathematical idea¶
Only the first columns of affect the lifted rotation. Right actions in the remaining dimensions therefore form an stabilizer with
unobservable tangent directions. ShonanGaugeFactor constrains exactly this linearized null space without adding a nonlinear residual.
import gtsam
import numpy as np
from gtsam import symbol_shorthand
C = symbol_shorthand.C
K = symbol_shorthand.K
P = symbol_shorthand.P
S = symbol_shorthand.S
X = symbol_shorthand.XPurpose and availability¶
An SO(p) relaxation contains SO(p-d) directions that do not alter its projected Stiefel frame. ShonanGaugeFactor contributes a constant Jacobian on precisely those tangent directions. Its nonlinear error is always zero; its role appears during linearization.
This implementation class is currently C++-only. ShonanAveraging adds it internally when configured with gauge weight.
C++ example¶
#include <gtsam/sfm/ShonanGaugeFactor.h>
using namespace gtsam;
const Key key = Symbol('Q', 0);
const size_t p = 6;
const size_t d = 3;
ShonanGaugeFactor factor(key, p, d, 1e3); // optional precision gamma
Values values;
values.insert(key, SOn::FromMatrix(Matrix::Identity(p, p)));
const auto linear = factor.linearize(values);The constructor requires p >= d. For p-d < 2, the stabilizer has zero dimension and the factor contributes no rows.