This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
View | Details | Raw Unified | Return to bug 774
Collapse All | Expand All

(-)Umeyama.h.orig (-14 / +5 lines)
Lines 136-157 Link Here
136
136
137
  // Eq. (39)
137
  // Eq. (39)
138
  VectorType S = VectorType::Ones(m);
138
  VectorType S = VectorType::Ones(m);
139
  if (sigma.determinant()<0) S(m-1) = -1;
140
139
141
  // Eq. (40) and (43)
140
  // Eq. (40) and (43)
142
  const VectorType& d = svd.singularValues();
141
  if  ( svd.matrixU().determinant() * svd.matrixV().determinant() < 0 )
143
  Index rank = 0; for (Index i=0; i<m; ++i) if (!internal::isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
142
    S(m-1) = -1;
144
  if (rank == m-1) {
143
145
    if ( svd.matrixU().determinant() * svd.matrixV().determinant() > 0 ) {
144
  Rt.block(0,0,m,m).noalias() =
146
      Rt.block(0,0,m,m).noalias() = svd.matrixU()*svd.matrixV().transpose();
145
    svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose();
147
    } else {
148
      const Scalar s = S(m-1); S(m-1) = -1;
149
      Rt.block(0,0,m,m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose();
150
      S(m-1) = s;
151
    }
152
  } else {
153
    Rt.block(0,0,m,m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose();
154
  }
155
146
156
  if (with_scaling)
147
  if (with_scaling)
157
  {
148
  {

Return to bug 774