Skip to content

Commit 793dbc1

Browse files
committed
basic stump files for new Lie group/algebra types
1 parent 7b52753 commit 793dbc1

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// @file
2+
/// @copyright Copyright (C) 2025 INRIA
3+
#pragma once
4+
5+
#include "aligator/fwd.hpp"
6+
7+
namespace aligator {
8+
9+
template <typename Derived> struct LieAlgebraTraits;
10+
11+
/// @brief Base CRTP for Lie algebras.
12+
template <typename Derived> struct LieAlgebraBase {
13+
using Traits = LieAlgebraTraits<Derived>;
14+
};
15+
16+
} // namespace aligator
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// @file
2+
/// @copyright Copyright (C) 2025 INRIA
3+
#pragma once
4+
5+
#include "aligator/fwd.hpp"
6+
7+
namespace aligator {
8+
9+
/// @brief Type traits for a Lie group. Usually required are the Lie group
10+
/// dimension, corresponding Lie Algebra, etc.
11+
template <typename Derived> struct LieGroupTraits {
12+
using Scalar = typename Derived::Scalar;
13+
static constexpr int Dim = Derived::Dim;
14+
};
15+
16+
#define ALIGATOR_LIEGROUP_TRAITS_DEFINE(Traits) \
17+
using Scalar = typename Traits::Derived; \
18+
static constexpr int Dim = Traits::Dim; \
19+
using LieAlgebraType = typename Traits::LieAlgebraType; \
20+
using DualLieAlgebraType = typename Traits::DualLieAlgebraType
21+
22+
template <typename Derived> struct LieGroupBase {
23+
using Traits = LieGroupTraits<Derived>;
24+
ALIGATOR_LIEGROUP_TRAITS_DEFINE(Traits);
25+
26+
Derived &derived() { return static_cast<Derived &>(*this); }
27+
28+
const Derived &derived() const { return static_cast<const Derived &>(*this); }
29+
30+
Derived &const_cast_derived() const {
31+
return const_cast<Derived &>(derived());
32+
}
33+
};
34+
35+
} // namespace aligator

0 commit comments

Comments
 (0)