[eigen] Clarification on the documentation for SparseSelfAdjointView::RankUpdate

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


The documentation for this method states


    /** 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 it is faster to set alpha=0 than initializing the
matrix to zero
      * and then keep the default value alpha=1.
      *
      * To perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply
      * call this function with u.adjoint().
      */

The second-last paragraph is what has confused me.  I want to evaluate
the Lower triangle of Z.adjoint() * ZLam so I am doing it as

    SparseMatrix<double>  ZtZ;
    ZtZ.selfadjointView<Lower>().rankUpdate(Z.adjoint(),
0.).rankUpdate(Z.adjoint());

Is that what is meant - that I should do the
..rankUpdate(Zlam.adjoint(), 0) then do the rankUpdate(Zlam.adjoint())?

A second question, if I may: What would be an effective way of
evaluating, as a sparse matrix, (I + Z'Z)?  I think I would want to
initialize the result to the identity then apply the rankUpdate method
but I want to be sure that I don't accidentally create a dense, square
matrix along the way.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/