diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-07-27 13:17:39 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-07-27 13:17:39 +0200 |
commit | 0590c18555bd5d195e29ee6a131285cf0f80f9d1 (patch) | |
tree | a7c26663e1f1c7b72e666889cb1bf7d4c0df01b7 /Eigen/src/Core | |
parent | b5e40642898e3af17e67a7b78fa3b63191e11bb7 (diff) |
various compilation and bug fixes in selfadjoint stuff
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/SelfAdjointView.h | 13 | ||||
-rw-r--r-- | Eigen/src/Core/products/SelfadjointMatrixVector.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/products/SelfadjointProduct.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/products/SelfadjointRank2Update.h | 10 |
4 files changed, 15 insertions, 13 deletions
diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index 4787bcbd8..3faebfc5d 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -125,20 +125,24 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView * The vectors \a u and \c v \b must be column vectors, however they can be * a adjoint expression without any overhead. Only the meaningful triangular * part of the matrix is updated, the rest is left unchanged. + * + * \sa rankUpdate(const MatrixBase<DerivedU>&, Scalar) */ template<typename DerivedU, typename DerivedV> - SelfAdjointView& rank2update(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha = Scalar(1)); + SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha = Scalar(1)); /** Perform a symmetric rank K update of the selfadjoint matrix \c *this: * \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix. - * + * * \returns a reference to \c *this * * Note that to perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply * call this function with u.adjoint(). + * + * \sa rankUpdate(const MatrixBase<DerivedU>&, const MatrixBase<DerivedV>&, Scalar) */ template<typename DerivedU> - SelfAdjointView& rankKupdate(const MatrixBase<DerivedU>& u, Scalar alpha = Scalar(1)); + SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha = Scalar(1)); /////////// Cholesky module /////////// @@ -231,13 +235,14 @@ struct ei_selfadjoint_product_returntype<Lhs,LhsMode,false,Rhs,0,true> template<typename Dest> void evalTo(Dest& dst) const { - dst.resize(m_lhs.rows(), m_rhs.cols()); dst.setZero(); evalTo(dst,1); } template<typename Dest> void evalTo(Dest& dst, Scalar alpha) const { + ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); + const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs); const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs); diff --git a/Eigen/src/Core/products/SelfadjointMatrixVector.h b/Eigen/src/Core/products/SelfadjointMatrixVector.h index 8e0dc9526..279836f8a 100644 --- a/Eigen/src/Core/products/SelfadjointMatrixVector.h +++ b/Eigen/src/Core/products/SelfadjointMatrixVector.h @@ -63,9 +63,6 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector( rhs = r; } - for (int i=0;i<size;i++) - res[i] = 0; - int bound = std::max(0,size-8) & 0xfffffffE; if (FirstTriangular) bound = size - bound; diff --git a/Eigen/src/Core/products/SelfadjointProduct.h b/Eigen/src/Core/products/SelfadjointProduct.h index d971720d6..f6420d10c 100644 --- a/Eigen/src/Core/products/SelfadjointProduct.h +++ b/Eigen/src/Core/products/SelfadjointProduct.h @@ -126,7 +126,7 @@ struct ei_selfadjoint_product<Scalar,MatStorageOrder, ColMajor, AAT, UpLo> template<typename MatrixType, unsigned int UpLo> template<typename DerivedU> SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo> -::rankKupdate(const MatrixBase<DerivedU>& u, Scalar alpha) +::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha) { typedef ei_blas_traits<DerivedU> UBlasTraits; typedef typename UBlasTraits::DirectLinearAccessType ActualUType; diff --git a/Eigen/src/Core/products/SelfadjointRank2Update.h b/Eigen/src/Core/products/SelfadjointRank2Update.h index 65a321fde..f7dcc003f 100644 --- a/Eigen/src/Core/products/SelfadjointRank2Update.h +++ b/Eigen/src/Core/products/SelfadjointRank2Update.h @@ -41,7 +41,7 @@ struct ei_selfadjoint_rank2_update_selector<Scalar,UType,VType,LowerTriangular> // std::cerr << "lower \n" << u.transpose() << "\n" << v.transpose() << "\n\n"; for (int i=0; i<size; ++i) { -// std::cerr << +// std::cerr << Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i+i, size-i) += (alpha * ei_conj(u.coeff(i))) * v.end(size-i) + (alpha * ei_conj(v.coeff(i))) * u.end(size-i); @@ -70,13 +70,13 @@ template<bool Cond, typename T> struct ei_conj_expr_if template<typename MatrixType, unsigned int UpLo> template<typename DerivedU, typename DerivedV> SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo> -::rank2update(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha) +::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha) { typedef ei_blas_traits<DerivedU> UBlasTraits; typedef typename UBlasTraits::DirectLinearAccessType ActualUType; typedef typename ei_cleantype<ActualUType>::type _ActualUType; const ActualUType actualU = UBlasTraits::extract(u.derived()); - + typedef ei_blas_traits<DerivedV> VBlasTraits; typedef typename VBlasTraits::DirectLinearAccessType ActualVType; typedef typename ei_cleantype<ActualVType>::type _ActualVType; @@ -87,8 +87,8 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo> enum { IsRowMajor = (ei_traits<MatrixType>::Flags&RowMajorBit)?1:0 }; ei_selfadjoint_rank2_update_selector<Scalar, - typename ei_conj_expr_if<IsRowMajor ^ UBlasTraits::NeedToConjugate,_ActualUType>::ret, - typename ei_conj_expr_if<IsRowMajor ^ VBlasTraits::NeedToConjugate,_ActualVType>::ret, + typename ei_cleantype<typename ei_conj_expr_if<IsRowMajor ^ UBlasTraits::NeedToConjugate,_ActualUType>::ret>::type, + typename ei_cleantype<typename ei_conj_expr_if<IsRowMajor ^ VBlasTraits::NeedToConjugate,_ActualVType>::ret>::type, (IsRowMajor ? (UpLo==UpperTriangular ? LowerTriangular : UpperTriangular) : UpLo)> ::run(const_cast<Scalar*>(_expression().data()),_expression().stride(),actualU,actualV,actualAlpha); |