aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Geometry/Umeyama.h
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2009-05-27 19:24:05 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2009-05-27 19:24:05 +0200
commit4d1e492c00c245b2cf44d016d79c4ba5f0d3d396 (patch)
tree2209174dae4a6d103ae42179a0c5fb2d6f3465fb /Eigen/src/Geometry/Umeyama.h
parent7a7a3f35700e591c43df39b8a3f5cf9ab0c2fa3d (diff)
* Umeyama has now similar performance for RowMajor and ColMajor layouts.
* Fixed a bug in umeyama for fixed size matrices. * Fixed the umeyama unit test for fixed size matrices. * Added XprHelper::ei_plain_matrix_type_row_major.
Diffstat (limited to 'Eigen/src/Geometry/Umeyama.h')
-rw-r--r--Eigen/src/Geometry/Umeyama.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/Eigen/src/Geometry/Umeyama.h b/Eigen/src/Geometry/Umeyama.h
index 6eb1f58fd..b55445797 100644
--- a/Eigen/src/Geometry/Umeyama.h
+++ b/Eigen/src/Geometry/Umeyama.h
@@ -46,21 +46,18 @@ namespace
{
enum {
MinRowsAtCompileTime = EIGEN_ENUM_MIN(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime),
- MinMaxRowsAtCompileTime = EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime, OtherMatrixType::MaxRowsAtCompileTime),
// When possible we want to choose some small fixed size value since the result
// is likely to fit on the stack.
- HomogeneousDimension = EIGEN_ENUM_MIN(MinRowsAtCompileTime+1, Dynamic),
- MaxRowsAtCompileTime = EIGEN_ENUM_MIN(MinMaxRowsAtCompileTime+1, Dynamic),
- MaxColsAtCompileTime = EIGEN_ENUM_MIN(MatrixType::MaxColsAtCompileTime, OtherMatrixType::MaxColsAtCompileTime)
+ HomogeneousDimension = EIGEN_ENUM_MIN(MinRowsAtCompileTime+1, Dynamic)
};
typedef Matrix<typename ei_traits<MatrixType>::Scalar,
HomogeneousDimension,
HomogeneousDimension,
AutoAlign | (ei_traits<MatrixType>::Flags & RowMajorBit ? RowMajor : ColMajor),
- MaxRowsAtCompileTime,
- MaxColsAtCompileTime
+ HomogeneousDimension,
+ HomogeneousDimension
> type;
};
}
@@ -87,9 +84,9 @@ namespace
* of the input point sets \f$ \mathbf{x} \f$ and \f$ \mathbf{y} \f$ where
* \f$d\f$ is corresponding to the dimension (which is typically small).
* The analysis is involving the SVD having a complexity of \f$O(d^3)\f$
-* though the actual bottleneck usually lies in the computation of the covariance
-* matrix which has an asymptotic lower bound of \f$O(dm)\f$ when the input point
-* sets have dimension \f$d \times m\f$.
+* though the actual computational effort lies in the covariance
+* matrix computation which has an asymptotic lower bound of \f$O(dm)\f$ when
+* the input point sets have dimension \f$d \times m\f$.
*
* Currently the method is working only for floating point matrices.
*
@@ -120,7 +117,8 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
enum { Dimension = EIGEN_ENUM_MIN(Derived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime) };
typedef Matrix<Scalar, Dimension, 1> VectorType;
- typedef Matrix<Scalar, Dimension, Dimension> MatrixType;
+ typedef typename ei_plain_matrix_type<Derived>::type MatrixType;
+ typedef typename ei_plain_matrix_type_row_major<Derived>::type RowMajorMatrixType;
const int m = src.rows(); // dimension
const int n = src.cols(); // number of measurements
@@ -133,8 +131,8 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
const VectorType dst_mean = dst.rowwise().sum() * one_over_n;
// demeaning of src and dst points
- MatrixType src_demean(m,n);
- MatrixType dst_demean(m,n);
+ RowMajorMatrixType src_demean(m,n);
+ RowMajorMatrixType dst_demean(m,n);
for (int i=0; i<n; ++i)
{
src_demean.col(i) = src.col(i) - src_mean;