diff options
author | Hauke Heibel <hauke.heibel@gmail.com> | 2009-10-22 10:11:26 +0200 |
---|---|---|
committer | Hauke Heibel <hauke.heibel@gmail.com> | 2009-10-22 10:11:26 +0200 |
commit | 99bb29abcfc4a62b8d099da6fb045f8d9a22cdf3 (patch) | |
tree | 7adc0c57ec29df43258c2d9208e6fb8f57fbac48 /Eigen | |
parent | e3d08443dc272f740447de0147efc69cf7de1c93 (diff) |
demeaning with colwise expression
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Geometry/Umeyama.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Eigen/src/Geometry/Umeyama.h b/Eigen/src/Geometry/Umeyama.h index 7652aa92e..d0f36d2c9 100644 --- a/Eigen/src/Geometry/Umeyama.h +++ b/Eigen/src/Geometry/Umeyama.h @@ -131,17 +131,11 @@ 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 - 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; - dst_demean.col(i) = dst.col(i) - dst_mean; - } + const RowMajorMatrixType src_demean = src.colwise() - src_mean; + const RowMajorMatrixType dst_demean = dst.colwise() - dst_mean; // Eq. (36)-(37) const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n; - // const Scalar dst_var = dst_demean.rowwise().squaredNorm().sum() * one_over_n; // Eq. (38) const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose(); |