2

I am trying to solve a linear system Ax=b where A is 3x3 symmetric positive definite.

Though it is low in scale, I will have to repeat it for different As millions of times. So efficiency is still important.

There are many solvers for linear systems (C++, via Eigen). I personally prefer: HouseholderQr().solve(), and llt().solve(), ldlt().solve().

I know that when n is very large, solvers based on Cholesky decomposition are faster than that of Householder's. But for my case when n is only 3, how can I compare their relative efficiency? Is there any formula for the exact float operation analysis?

thanks

LCFactorization
  • 1,652
  • 1
  • 25
  • 35

1 Answers1

0

Yes, Cholesky will still be faster. It will be about n^3/3 flops. The only reason to use QR would be if your matrix was very ill-conditioned.

If you need to solve these systems a million times and efficiency is important, I'd recommend calling LAPACK directly. You want the DPOSV function.

http://www.netlib.org/lapack/lug/node26.html#1272

http://www.netlib.org/clapack/what/double/dposv.c

codehippo
  • 1,379
  • 1
  • 8
  • 19
  • LAPACK is really slow for small matrices, moreover if its only 3x3 then everything should be unrolled in Eigen I would hope – Lindon Feb 23 '16 at 20:37
  • I'm not sure I agree that LAPACK is really slow for small matrices. I'd be interested in seeing a benchmark between it and Eigen. Vendors also implement their own versions of LAPACK functions like DPOSV. It would be interesting to test the INTEL MKL version of LAPACK. – codehippo Feb 24 '16 at 00:11