I am modelling physical system with heat conduction, and to do numerical calculations I need to solve system of linear equations with tridiagonal matrix. I am using this algorithm to get results: http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm But I am afraid that my method is straightforward and not optimal. What C++ library should be used to solve that system in the fastest way? I should also mention that matrix is not changed often (only right part of the equation is changed). Thanks!
Asked
Active
Viewed 2,100 times
1
-
Did you implement your own or are you using a library already? – themel Nov 08 '11 at 09:54
-
I have implemented my own: simply coded the algorithm, only using the fact that matrix is not changing to do some precalculations. – user517893 Nov 08 '11 at 09:58
3 Answers
3
-
To my knowledge, Eigen doesn't yet have the concept of tridiagonal or band matrices yet. You can still make a dense matrix and solve that but not sure it would be efficient – Simmovation Apr 05 '17 at 10:13
1
The performance of this algorithm is likely dominated by floating-point division. Use SSE2 to perform two divisions (of ci and di) at once, and you will get close to optimal performance.

Marat Dukhan
- 11,993
- 4
- 27
- 41
0
It is worth looking at the LAPACK and BLAS interfaces, of which there are several implementation libraries. Originally netlib which is open-source, and then other such as MKL that you have to pay for. The function dgtsv does what you are looking for. The open-source netlib versions don't do any explicit SIMD instructions, but MKL does and will perform best on intel chips.

Simmovation
- 223
- 2
- 9