Skip to content

Commit 0eefe97

Browse files
authored
Merge pull request #2419 from borglab/copilot/sub-pr-2418
Address PR #2418 review feedback: SWIG Jacobians, trait-based dim, AdjointMap perf note
2 parents 152d65d + 5515f78 commit 0eefe97

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

gtsam/base/MatrixLieGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ namespace gtsam {
245245
private:
246246
static Eigen::Index tangentDim(const Class* m, const TangentVector* xi) {
247247
if constexpr (D == Eigen::Dynamic) {
248-
return m ? static_cast<Eigen::Index>(m->dim())
248+
return m ? static_cast<Eigen::Index>(traits<Class>::GetDimension(*m))
249249
: static_cast<Eigen::Index>(xi->size());
250250
} else {
251251
(void)m;

gtsam/base/doc/MatrixLieGroup.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ By inheriting from `gtsam::MatrixLieGroup`, you get:
3333
* **Default Lie algebra methods**: `adjointMap(xi)`, `adjoint(xi, y)`, and `adjointTranspose(xi, y)` are provided generically, including Jacobians for the latter two.
3434
* **A `vec()` method**: This vectorizes the `N x N` matrix representation of your group element into an `(N*N) x 1` vector.
3535

36+
**Performance Note:** The generic implementation of `AdjointMap()` is correct but may be slower because it is derived via the `Hat`/`Vee` mappings. If a closed-form expression for `AdjointMap()` is available for your group, consider overriding the default implementation for better performance.
37+
3638
### 4. Traits and Concept Checking
3739

3840
Finally, the traits specialization in your header file must be updated to reflect that your class is now a `MatrixLieGroup`.

gtsam/geometry/geometry.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,11 @@ class Pose3 {
660660
// Matrix Lie Group
661661
gtsam::Matrix AdjointMap() const;
662662
gtsam::Vector Adjoint(gtsam::Vector xi_b) const;
663+
gtsam::Vector Adjoint(gtsam::Vector xi_b, Eigen::Ref<Eigen::MatrixXd> H_this,
664+
Eigen::Ref<Eigen::MatrixXd> H_xib) const;
663665
gtsam::Vector AdjointTranspose(gtsam::Vector x) const;
666+
gtsam::Vector AdjointTranspose(gtsam::Vector x, Eigen::Ref<Eigen::MatrixXd> H_this,
667+
Eigen::Ref<Eigen::MatrixXd> H_x) const;
664668
static gtsam::Matrix adjointMap(gtsam::Vector xi);
665669
static gtsam::Vector adjoint(gtsam::Vector xi, gtsam::Vector y);
666670
static gtsam::Vector adjointTranspose(gtsam::Vector xi, gtsam::Vector y);

0 commit comments

Comments
 (0)