This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Efficient .inverse() solve for a symmetric matrix?

Tags: None
(comma "," separated)
damien_d
Registered Member
Posts
15
Karma
0
Following on from the topic here:
viewtopic.php?f=74&t=111513

There was a suggested and welcome improvement to the following code:
Code: Select all
// [1] Un-numbered equation after (5).
const Eigen::MatrixBase<Derived4> L = C_un_obs_p * C_obs_obs_p.inverse();


Namely,

ggael wrote:Moreover, you'll get faster and more accurate result without explicitly inverting the matrix, e.g.:
Code: Select all
L.transpose() = C_obs_obs_p.transpose().lu().solve(C_un_obs_p.transpose());

In the future, Eigen will do this rewriting for you. Currently avoid .inverse() unless you really want it!


Since C_obs_obs_p is a symmetric positive-defininte matrix, is there an improved method for this (e.g. LLT)?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
yes, if it's symmetric positive definite then you can use .llt() instead of .lu()


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]