Commit 1b18a06b authored by jcarpent's avatar jcarpent
Browse files

[LieGroup] Add eval_set_dim to Lie Groups

parent 4f694cda
//
// Copyright (c) 2016-2017 CNRS
// Copyright (c) 2016-2018 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
......@@ -22,14 +22,32 @@
namespace se3
{
template<int dim1, int dim2>
struct eval_set_dim
{
enum { value = dim1 + dim2 };
};
template<int dim>
struct eval_set_dim<dim,Eigen::Dynamic>
{
enum { value = Eigen::Dynamic };
};
template<int dim>
struct eval_set_dim<Eigen::Dynamic,dim>
{
enum { value = Eigen::Dynamic };
};
template<typename LieGroup1, typename LieGroup2>
struct CartesianProductOperation;
template<typename LieGroup1, typename LieGroup2>
struct traits<CartesianProductOperation<LieGroup1, LieGroup2> > {
typedef double Scalar;
enum {
NQ = LieGroup1::NQ + LieGroup2::NQ,
NV = LieGroup1::NV + LieGroup2::NV
NQ = eval_set_dim<LieGroup1::NQ,LieGroup2::NQ>::value,
NV = eval_set_dim<LieGroup1::NV,LieGroup2::NV>::value
};
};
......
......@@ -403,4 +403,15 @@ BOOST_AUTO_TEST_CASE ( test_size )
BOOST_CHECK (r3xso3.name () == "R^3*SO(3)");
BOOST_CHECK (r3xso3.neutral () == neutral);
}
BOOST_AUTO_TEST_CASE(test_dim_computation)
{
int dim = eval_set_dim<1,1>::value ;
BOOST_CHECK(dim == 2);
dim = eval_set_dim<Eigen::Dynamic,1>::value;
BOOST_CHECK(dim == Eigen::Dynamic);
dim = eval_set_dim<1,Eigen::Dynamic>::value;
BOOST_CHECK(dim == Eigen::Dynamic);
}
BOOST_AUTO_TEST_SUITE_END ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment