## Efficient .inverse() solve for a symmetric matrix?

damien_d
Registered Member
Posts
15
Karma
0

### Efficient .inverse() solve for a symmetric matrix?

Thu Jun 13, 2013 12:36 am
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)?
ggael
Moderator
Posts
2653
Karma
16
OS

### Re: Efficient .inverse() solve for a symmetric matrix?

Thu Jun 13, 2013 6:27 am
yes, if it's symmetric positive definite then you can use .llt() instead of .lu()

## Who is online

Registered users: Baidu [Spider], Bing [Bot], carlosan, cylverbak, davidemme, ennon, Exabot [Bot], Google [Bot], google01103, jmacleod, ken300, louis94, M4he, Majestic-12 [Bot], paulus3005, pedrorodriguez, rodorapido, Shabakthanai, twithaar, veqz, Yahoo [Bot]