4 #ifndef SOPHUS_ROTATION_MATRIX_HPP 
    5 #define SOPHUS_ROTATION_MATRIX_HPP 
   18   using Scalar = 
typename D::Scalar;
 
   19   static int const N = D::RowsAtCompileTime;
 
   20   static int const M = D::ColsAtCompileTime;
 
   22   static_assert(N == M, 
"must be a square matrix");
 
   23   static_assert(N >= 2, 
"must have compile time dimension >= 2");
 
   34   using Scalar = 
typename D::Scalar;
 
   35   static int const N = D::RowsAtCompileTime;
 
   36   static int const M = D::ColsAtCompileTime;
 
   40   Scalar det = sR.determinant();
 
   42   if (det <= Scalar(0)) {
 
   46   Scalar scale_sqr = pow(det, Scalar(2. / N));
 
   48   static_assert(N == M, 
"must be a square matrix");
 
   49   static_assert(N >= 2, 
"must have compile time dimension >= 2");
 
   52              .template lpNorm<Eigen::Infinity>() <
 
   60     std::is_floating_point<typename D::Scalar>::value,
 
   61     Matrix<typename D::Scalar, D::RowsAtCompileTime, D::RowsAtCompileTime>>
 
   63   using Scalar = 
typename D::Scalar;
 
   64   static int const N = D::RowsAtCompileTime;
 
   65   static int const M = D::ColsAtCompileTime;
 
   67   static_assert(N == M, 
"must be a square matrix");
 
   68   static_assert(N >= 2, 
"must have compile time dimension >= 2");
 
   70   Eigen::JacobiSVD<Matrix<Scalar, N, N>> svd(
 
   71       R, Eigen::ComputeFullU | Eigen::ComputeFullV);
 
   74   Scalar d = (svd.matrixU() * svd.matrixV().transpose()).determinant();
 
   78   Diag(N - 1, N - 1) = d;
 
   79   return svd.matrixU() * Diag * svd.matrixV().transpose();
 
   84 #endif  // SOPHUS_ROTATION_MATRIX_HPP