Comparing algorithms for tridiagonal linear systems solution
Below there are two algorithms for solving tridiagonal linear systems of the form $$ \left[ \begin{array}{ccccc|c} b_1 & c_1 & & & &d_1\ a_2 & b_2 & c_2 & & & d_2\ & \ddots & \ddots & \ddots & & \vdots\ & & a_{n-1} & b_{n-1} & c_{n-1} & d_{n-1}\ & & & a_n & b_n & d_n \end{array} \right]. $$ I called them Algorithms A and B. 490
Both of them are equivalent to Gaussian elimination, but with important difference in the form of the resulting triangular (bidiagonal) matrix.
My main question is: which one of them is more preferrable?
Algorithm A is the one that described in Wikipedia and many textbooks, it is called <PERSON> algorithm and is implemented, for example, in Numerical Recipes in some tricky form. Algorithm B is more straightforward and, in my opinion, is more numerically stable in cases when $|b_i|\gg|a_i|+|c_i|$ . Though I haven't seen Algorithm B in texbooks, note that exactly this algorithm is implemented in the mentioned Wikipedia article, see "Implementation in Fortran 90", while "Implementation in Matlab" deals with Algorithm A ("Implementation in C" in its current state is a mess that does not seem to work at all). 768