Re: [eigen] triangular solve |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] triangular solve*From*: M A <markoilcan@xxxxxxxxx>*Date*: Fri, 21 Dec 2012 09:20:36 -0600*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=/R20XPwrM2h5pSxI1GPKIwnyGxb+iZcXti/10IO3xK8=; b=mqoGMD7SXCHUJ1BS7FD5G0LCJz8AFFh6KPwVAfYvqgrvkAUX84tj3wdYm/mHdJwVlc RTFrUNNeFixbBF7TryZSEn10kpYg/luYz/0XykT8SPWtRymnNMu7XclV+8ppV/Ofy85/ mGNuFaTZaHY5wiDEZ4I8BVXUnLziJDXGe2NcxxPvt93+7/uP4qlQD70b6eh1TJLJXg8m tnZ3X2OqW3jVm0LgNCh4bHoh4hbOYwMDacjUOG7M7AKs85VpdbhPvwD2redkW2SEkWt7 eM3LFMRN3wklDuUl8XINDTXYgY5XfHsqYF/fngoifo1Q/EoLKpCJkVCFkcNw5PaPB+pk FfRg==

Thanks. If my understanding is correct putting in the MatrixXf(this->matrixL()) results in the allocation of another matrix. Is it possible to avoid doing this? After all the lower triangle matrix already exists in the LLT object (albeit in some representation that I don't fully understand). I'm going to be using this function literally zillions of times and the matrices are on the order of 1000 x 1000 or larger, so efficiency is highly critical. Thanks, Mark A On Thu, Dec 20, 2012 at 4:39 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote: > Hi, > > you cannot take advantage of the triangular nature of the matrix for the > right hand side, so you have to copy it into a full matrix: > > float denom = > total_cov.matrixL().solve(MatrixXf(this->matrixL())).squaredNorm(); > > cheers, > Gael. > > > On Thu, Dec 20, 2012 at 10:53 PM, M A <markoilcan@xxxxxxxxx> wrote: >> >> I'm having trouble compiling eigen code to do a solve with two lower >> triangular matrices. That is I want L1^{-1} * L2 where L1 and L2 both >> come from LLT objects by way of matrixL(). Here is my class and >> function, >> >> class Covariance_comp : public LLT<MatrixXf> { >> public: >> float variance; >> >> Covariance_comp( const MatrixXf &pdmat, float var) : LLT<MatrixXf> >> (pdmat), variance( var ) {} >> >> float update_fixedpt( const Covariance_comp &total_cov, VectorXf >> resids ) { >> float numer = (this->matrixU() * >> total_cov.solve(resids)).array().square().sum(); >> cout << "numer = " << numer << endl; >> // This next line is the problem: >> float denom = >> total_cov.matrixL().solve(this->matrixL()).array().square().sum(); >> cout << "denom = " << denom << endl; >> variance *= numer / denom; >> return variance; >> } >> }; >> >> The problem comes in the line float denom = .... with g++ complaining >> about the solve: >> >> error: no matching function for call to ‘Eigen::TriangularView<const >> Eigen::Matrix<float, -0x00000000000000001, -0x00000000000000001, 0, >> -0x00000000000000001, -0x00000000000000001>, 1u>::solve(const >> Eigen::TriangularView<const Eigen::Matrix<float, -0x00000000000000001, >> -0x00000000000000001, 0, -0x00000000000000001, -0x00000000000000001>, >> 1u>) const’ >> >> I don't understand the problem. Both total_cov and this are >> essentially LLT objects. Is the problem using this->matrixL() as the >> argument to solve? What is the best way to do this that takes >> advantage of the triangular nature of the matrices? This is using >> eigen 3.1.2. >> >> Thanks! >> >> Mark A >> >> >

**Follow-Ups**:**Re: [eigen] triangular solve***From:*Gael Guennebaud

**References**:**[eigen] triangular solve***From:*M A

**Re: [eigen] triangular solve***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] triangular solve** - Next by Date:
**Re: [eigen] triangular solve** - Previous by thread:
**Re: [eigen] triangular solve** - Next by thread:
**Re: [eigen] triangular solve**

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