Created by Codex.
Implement the common staircase relaxation and optimality-certificate machinery for Shonan rotation averaging.
Mathematical idea¶
Rotation averaging seeks absolute rotations whose relative rotations agree with measurements:
is the special orthogonal group. Shonan averaging lifts the problem from to successively larger manifolds, searches for a certifiable optimum, and rounds the lifted solution back to dimension .
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¶
ShonanAveraging<d> is the templated C++ implementation shared by the concrete ShonanAveraging2 and ShonanAveraging3 interfaces. It builds and optimizes problems on increasing SO(p) levels, checks the minimum eigenvalue certificate, descends through a negative-curvature direction when needed, and rounds a lifted solution back to rotations.
Use the concrete classes in application code. The base template itself is not directly exposed in Python.
C++ sketch¶
#include <gtsam/sfm/ShonanAveraging.h>
using namespace gtsam;
ShonanAveragingParameters<3> parameters;
ShonanAveraging<3>::Measurements measurements = /* relative Rot3 edges */;
ShonanAveraging<3> shonan(measurements, parameters);
auto [rotations, certificate] = shonan.run(/* minP = */ 3,
/* maxP = */ 10);In ordinary code prefer ShonanAveraging3, which provides the same main API and stable explicit template instantiation.