28template<
typename G,
typename H>
32 typedef std::pair<G, H> Base;
50 typedef multiplicative_group_tag group_flavor;
55 traits<H>::Compose(this->second,other.second));
58 return ProductLieGroup(traits<G>::Inverse(this->first), traits<H>::Inverse(this->second));
64 return this->inverse() * g;
70 enum {dimension = dimension1 + dimension2};
71 inline static size_t Dim() {
return dimension;}
72 inline size_t dim()
const {
return dimension;}
74 typedef Eigen::Matrix<double, dimension, 1> TangentVector;
75 typedef OptionalJacobian<dimension, dimension> ChartJacobian;
78 ChartJacobian H1 = boost::none, ChartJacobian H2 = boost::none)
const {
79 if (H1||H2)
throw std::runtime_error(
"ProductLieGroup::retract derivatives not implemented yet");
80 G g = traits<G>::Retract(this->first, v.template head<dimension1>());
81 H h = traits<H>::Retract(this->second, v.template tail<dimension2>());
85 ChartJacobian H1 = boost::none, ChartJacobian H2 = boost::none)
const {
86 if (H1||H2)
throw std::runtime_error(
"ProductLieGroup::localCoordinates derivatives not implemented yet");
87 typename traits<G>::TangentVector v1 = traits<G>::Local(this->first, g.first);
88 typename traits<H>::TangentVector v2 = traits<H>::Local(this->second, g.second);
98 typedef Eigen::Matrix<double, dimension, dimension> Jacobian;
99 typedef Eigen::Matrix<double, dimension1, dimension1> Jacobian1;
100 typedef Eigen::Matrix<double, dimension2, dimension2> Jacobian2;
104 ChartJacobian H2 = boost::none)
const {
105 Jacobian1 D_g_first; Jacobian2 D_h_second;
106 G g = traits<G>::Compose(this->first,other.first, H1 ? &D_g_first : 0);
107 H h = traits<H>::Compose(this->second,other.second, H1 ? &D_h_second : 0);
110 H1->template topLeftCorner<dimension1,dimension1>() = D_g_first;
111 H1->template bottomRightCorner<dimension2,dimension2>() = D_h_second;
113 if (H2) *H2 = Jacobian::Identity();
117 ChartJacobian H2 = boost::none)
const {
118 Jacobian1 D_g_first; Jacobian2 D_h_second;
119 G g = traits<G>::Between(this->first,other.first, H1 ? &D_g_first : 0);
120 H h = traits<H>::Between(this->second,other.second, H1 ? &D_h_second : 0);
123 H1->template topLeftCorner<dimension1,dimension1>() = D_g_first;
124 H1->template bottomRightCorner<dimension2,dimension2>() = D_h_second;
126 if (H2) *H2 = Jacobian::Identity();
130 Jacobian1 D_g_first; Jacobian2 D_h_second;
131 G g = traits<G>::Inverse(this->first, D ? &D_g_first : 0);
132 H h = traits<H>::Inverse(this->second, D ? &D_h_second : 0);
135 D->template topLeftCorner<dimension1,dimension1>() = D_g_first;
136 D->template bottomRightCorner<dimension2,dimension2>() = D_h_second;
140 static ProductLieGroup Expmap(
const TangentVector& v, ChartJacobian Hv = boost::none) {
141 Jacobian1 D_g_first; Jacobian2 D_h_second;
142 G g = traits<G>::Expmap(v.template head<dimension1>(), Hv ? &D_g_first : 0);
143 H h = traits<H>::Expmap(v.template tail<dimension2>(), Hv ? &D_h_second : 0);
146 Hv->template topLeftCorner<dimension1,dimension1>() = D_g_first;
147 Hv->template bottomRightCorner<dimension2,dimension2>() = D_h_second;
151 static TangentVector Logmap(
const ProductLieGroup& p, ChartJacobian Hp = boost::none) {
152 Jacobian1 D_g_first; Jacobian2 D_h_second;
153 typename traits<G>::TangentVector v1 = traits<G>::Logmap(p.first, Hp ? &D_g_first : 0);
154 typename traits<H>::TangentVector v2 = traits<H>::Logmap(p.second, Hp ? &D_h_second : 0);
159 Hp->template topLeftCorner<dimension1,dimension1>() = D_g_first;
160 Hp->template bottomRightCorner<dimension2,dimension2>() = D_h_second;
164 static TangentVector LocalCoordinates(
const ProductLieGroup& p, ChartJacobian Hp = boost::none) {
165 return Logmap(p, Hp);
168 return compose(ProductLieGroup::Expmap(v));
171 return ProductLieGroup::Logmap(between(g));
178template<
typename G,
typename H>
Base class and basic functions for Lie types.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
A helper class that implements the traits interface for GTSAM lie groups.
Definition: Lie.h:174
Lie Group Concept.
Definition: Lie.h:260
Template to construct the product Lie group of two other Lie groups Assumes Lie group structure for G...
Definition: ProductLieGroup.h:29
ProductLieGroup()
Default constructor yields identity.
Definition: ProductLieGroup.h:40