From fcc3be5dceb2378a1b7659793686faaeb3fbe294 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 23 Dec 2009 09:07:01 +0100 Subject: [PATCH] a couple of fixes after thye merge --- Eigen/src/Core/ProductBase.h | 7 +++++-- Eigen/src/Core/TriangularMatrix.h | 4 ++-- Eigen/src/Geometry/Homogeneous.h | 2 +- Eigen/src/LU/Inverse.h | 3 +-- Eigen/src/Sparse/SparseSelfAdjointView.h | 4 +++- Eigen/src/Sparse/SparseUtil.h | 11 +++++++++++ test/sparse_product.cpp | 2 +- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h index 3248e7293..1d19ef72a 100644 --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -29,8 +29,9 @@ * */ template -struct ei_traits > : ei_traits::type> +struct ei_traits > //: ei_traits::type> { + typedef DenseStorageMatrix DenseStorageType; typedef typename ei_cleantype<_Lhs>::type Lhs; typedef typename ei_cleantype<_Rhs>::type Rhs; typedef typename ei_scalar_product_traits::ReturnType Scalar; @@ -172,7 +173,9 @@ struct ei_traits > : ei_traits, typename NestedProduct::_LhsNested, typename NestedProduct::_RhsNested> > -{}; +{ + typedef typename ei_traits::StorageType StorageType; +}; template class ScaledProduct diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index aaf781d1f..e593a468d 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -465,7 +465,7 @@ TriangularView::operator=(const MatrixBase& othe { if(OtherDerived::Flags & EvalBeforeAssigningBit) { - typename OtherDerived::PlainMatrixType other_evaluated(other.rows(), other.cols()); + typename ei_plain_matrix_type::type other_evaluated(other.rows(), other.cols()); other_evaluated.template triangularView().lazyAssign(other.derived()); lazyAssign(other_evaluated); } @@ -536,7 +536,7 @@ void TriangularBase::evalTo(MatrixBase &other) const { if(ei_traits::Flags & EvalBeforeAssigningBit) { - typename Derived::PlainMatrixType other_evaluated(rows(), cols()); + typename ei_plain_matrix_type::type other_evaluated(rows(), cols()); evalToLazy(other_evaluated); other.derived().swap(other_evaluated); } diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h index a601e29cf..b0232e77c 100644 --- a/Eigen/src/Geometry/Homogeneous.h +++ b/Eigen/src/Geometry/Homogeneous.h @@ -194,7 +194,7 @@ VectorwiseOp::hnormalized() const return HNormalized_Block(_expression(),0,0, Direction==Vertical ? _expression().rows()-1 : _expression().rows(), Direction==Horizontal ? _expression().cols()-1 : _expression().cols()).cwiseQuotient( - Replicate, + Replicate (HNormalized_Factors(_expression(), diff --git a/Eigen/src/LU/Inverse.h b/Eigen/src/LU/Inverse.h index ea2330da3..36392c8d8 100644 --- a/Eigen/src/LU/Inverse.h +++ b/Eigen/src/LU/Inverse.h @@ -203,7 +203,7 @@ struct ei_compute_inverse_size4 result.coeffRef(1,3) = matrix.minor(3,1).determinant(); result.coeffRef(2,3) = -matrix.minor(3,2).determinant(); result.coeffRef(3,3) = matrix.minor(3,3).determinant(); - result /= (matrix.col(0).cwise()*result.row(0).transpose()).sum(); + result /= (matrix.col(0).cwiseProduct(result.row(0).transpose())).sum(); } }; @@ -212,7 +212,6 @@ struct ei_compute_inverse : ei_compute_inverse_size4 { - // FIXME empty? }; template diff --git a/Eigen/src/Sparse/SparseSelfAdjointView.h b/Eigen/src/Sparse/SparseSelfAdjointView.h index f5296accf..9f9c5b5e8 100644 --- a/Eigen/src/Sparse/SparseSelfAdjointView.h +++ b/Eigen/src/Sparse/SparseSelfAdjointView.h @@ -144,7 +144,9 @@ SparseSelfAdjointView::rankUpdate(const MatrixBase& u template struct ei_traits > : ei_traits, Lhs, Rhs> > -{}; +{ + typedef Dense StorageType; +}; template class SparseSelfAdjointTimeDenseProduct diff --git a/Eigen/src/Sparse/SparseUtil.h b/Eigen/src/Sparse/SparseUtil.h index 965565b73..031fd9fac 100644 --- a/Eigen/src/Sparse/SparseUtil.h +++ b/Eigen/src/Sparse/SparseUtil.h @@ -155,4 +155,15 @@ template class ei_eval typedef SparseMatrix<_Scalar, _Flags> type; }; +template struct ei_plain_matrix_type +{ + typedef typename ei_traits::Scalar _Scalar; + enum { + _Flags = ei_traits::Flags + }; + + public: + typedef SparseMatrix<_Scalar, _Flags> type; +}; + #endif // EIGEN_SPARSEUTIL_H diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp index e944d6c53..00c2cdf74 100644 --- a/test/sparse_product.cpp +++ b/test/sparse_product.cpp @@ -61,7 +61,7 @@ template void sparse_product(const SparseMatrixType& VERIFY_IS_APPROX(dm4=m2*(refMat3+refMat3), refMat4=refMat2*(refMat3+refMat3)); VERIFY_IS_APPROX(dm4=m2.transpose()*(refMat3+refMat5)*0.5, refMat4=refMat2.transpose()*(refMat3+refMat5)*0.5); - + // dense * sparse VERIFY_IS_APPROX(dm4=refMat2*m3, refMat4=refMat2*refMat3); VERIFY_IS_APPROX(dm4=refMat2*m3.transpose(), refMat4=refMat2*refMat3.transpose());