Re: [eigen] Memory fault when using a function returning a SelfAdjointView

[ Thread Index | Date Index | More Archives ]

On 26.10.2011 21:52, Douglas Bates wrote:
It certainly requires redundant code, but even with basic code optimizations
there should be no overhead due to that.

I wasn't concerned about overhead as much as creating more readable code.

Yes, I agree. The only thing I could suggest is sth like:

// calculate matrix:
MatrixXd mat = XtXmat(...);

// use only xtx after that:
SelfAdjointView xtx(mat);

You can't entirely avoid the separate declaration of a plain matrix, because somewhere the actual data has to be stored.

MatrixXd(cols, cols).setZero() == MatrixXd::Zero(cols, cols).

I don't think so - at least in my testing it didn't.  That problem is
that MatrixXd::Zero returns a constant matrix and I want to modify it.

Yes, you are right. Actually I was wondering, if rankUpdate() on a ZeroMatrix is automagically optimized to basically just X.transpose()*X (evaluating just one half), but apparently it does not work anyways.

Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252

Mail converted by MHonArc 2.6.19+