Reply to topic

Efficient .inverse() solve for a symmetric matrix?

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
2195
Karma
15
OS
yes, if it's symmetric positive definite then you can use .llt() instead of .lu()

 
Reply to topic

Bookmarks



Who is online

Registered users: Alexa [Bot], Artmessiah, Baidu [Spider], barrypicker, Bing [Bot], eagleton, Exabot [Bot], garthecho, ggael, ghevan, Google [Bot], google01103, Hans, jsirek, ken300, koriun, Majestic-12 [Bot], mcaceres, mutlu, nezumi, pinguin74, private_lock, samuelig, scummos, Tepee, TheraHedwig, tparrott, Yahoo [Bot], zabastodwa