<s>
In	O
numerical	O
linear	O
algebra	O
,	O
the	O
tridiagonal	B-Language
matrix	I-Language
algorithm	I-Language
,	O
also	O
known	O
as	O
the	O
Thomas	B-Language
algorithm	I-Language
(	O
named	O
after	O
Llewellyn	O
Thomas	O
)	O
,	O
is	O
a	O
simplified	O
form	O
of	O
Gaussian	B-Algorithm
elimination	I-Algorithm
that	O
can	O
be	O
used	O
to	O
solve	O
tridiagonal	B-Algorithm
systems	I-Algorithm
of	I-Algorithm
equations	I-Algorithm
.	O
</s>
<s>
For	O
such	O
systems	O
,	O
the	O
solution	O
can	O
be	O
obtained	O
in	O
operations	O
instead	O
of	O
required	O
by	O
Gaussian	B-Algorithm
elimination	I-Algorithm
.	O
</s>
<s>
Examples	O
of	O
such	O
matrices	O
commonly	O
arise	O
from	O
the	O
discretization	O
of	O
1D	O
Poisson	O
equation	O
and	O
natural	B-Algorithm
cubic	I-Algorithm
spline	I-Algorithm
interpolation	O
.	O
</s>
<s>
Thomas	O
 '	O
algorithm	O
is	O
not	O
stable	B-Algorithm
in	O
general	O
,	O
but	O
is	O
so	O
in	O
several	O
special	O
cases	O
,	O
such	O
as	O
when	O
the	O
matrix	O
is	O
diagonally	B-Algorithm
dominant	I-Algorithm
(	O
either	O
by	O
rows	O
or	O
columns	O
)	O
or	O
symmetric	B-Algorithm
positive	I-Algorithm
definite	I-Algorithm
;	O
for	O
a	O
more	O
precise	O
characterization	O
of	O
stability	O
of	O
Thomas	O
 '	O
algorithm	O
,	O
see	O
Higham	O
Theorem	O
9.12	O
.	O
</s>
<s>
If	O
stability	O
is	O
required	O
in	O
the	O
general	O
case	O
,	O
Gaussian	B-Algorithm
elimination	I-Algorithm
with	O
partial	B-Algorithm
pivoting	I-Algorithm
(	O
GEPP	O
)	O
is	O
recommended	O
instead	O
.	O
</s>
<s>
The	O
implementation	O
in	O
a	O
VBA	B-Language
subroutine	O
without	O
preserving	O
the	O
coefficient	O
vectors	O
:	O
</s>
<s>
The	O
derivation	O
of	O
the	O
tridiagonal	B-Language
matrix	I-Language
algorithm	I-Language
is	O
a	O
special	O
case	O
of	O
Gaussian	B-Algorithm
elimination	I-Algorithm
.	O
</s>
<s>
In	O
some	O
situations	O
,	O
particularly	O
those	O
involving	O
periodic	B-Algorithm
boundary	I-Algorithm
conditions	I-Algorithm
,	O
a	O
slightly	O
perturbed	O
form	O
of	O
the	O
tridiagonal	B-Algorithm
system	O
may	O
need	O
to	O
be	O
solved	O
:	O
</s>
<s>
In	O
this	O
case	O
,	O
we	O
can	O
make	O
use	O
of	O
the	O
Sherman	O
–	O
Morrison	O
formula	O
to	O
avoid	O
the	O
additional	O
operations	O
of	O
Gaussian	B-Algorithm
elimination	I-Algorithm
and	O
still	O
use	O
the	O
Thomas	B-Language
algorithm	I-Language
.	O
</s>
<s>
This	O
can	O
be	O
done	O
efficiently	O
if	O
both	O
solutions	O
are	O
computed	O
at	O
once	O
,	O
as	O
the	O
forward	O
portion	O
of	O
the	O
pure	O
tridiagonal	B-Language
matrix	I-Language
algorithm	I-Language
can	O
be	O
shared	O
.	O
</s>
<s>
In	O
this	O
case	O
the	O
coefficients	O
and	O
are	O
,	O
generally	O
speaking	O
,	O
non-zero	O
,	O
so	O
their	O
presence	O
does	O
not	O
allow	O
to	O
apply	O
the	O
Thomas	B-Language
algorithm	I-Language
directly	O
.	O
</s>
<s>
The	O
solution	O
is	O
then	O
obtained	O
in	O
the	O
following	O
way	O
:	O
first	O
we	O
solve	O
two	O
tridiagonal	B-Algorithm
systems	I-Algorithm
of	I-Algorithm
equations	I-Algorithm
applying	O
the	O
Thomas	B-Language
algorithm	I-Language
:	O
</s>
<s>
The	O
implementation	O
in	O
C	B-Language
without	O
preserving	O
the	O
coefficient	O
vectors	O
:	O
</s>
<s>
There	O
is	O
also	O
another	O
way	O
to	O
solve	O
the	O
slightly	O
perturbed	O
form	O
of	O
the	O
tridiagonal	B-Algorithm
system	O
considered	O
above	O
.	O
</s>
<s>
We	O
can	O
now	O
find	O
the	O
solutions	O
and	O
applying	O
Thomas	B-Language
algorithm	I-Language
to	O
the	O
two	O
auxiliary	O
tridiagonal	B-Algorithm
system	O
.	O
</s>
<s>
The	O
implementation	O
in	O
Dev-C	B-Protocol
++	I-Protocol
without	O
preserving	O
the	O
coefficient	O
vectors	O
:	O
</s>
<s>
In	O
other	O
situations	O
,	O
the	O
system	O
of	O
equations	O
may	O
be	O
block	O
tridiagonal	B-Algorithm
(	O
see	O
block	B-Algorithm
matrix	I-Algorithm
)	O
,	O
with	O
smaller	O
submatrices	O
arranged	O
as	O
the	O
individual	O
elements	O
in	O
the	O
above	O
matrix	O
system	O
(	O
e.g.	O
,	O
the	O
2D	O
Poisson	B-Algorithm
problem	I-Algorithm
)	O
.	O
</s>
<s>
Simplified	O
forms	O
of	O
Gaussian	B-Algorithm
elimination	I-Algorithm
have	O
been	O
developed	O
for	O
these	O
situations	O
.	O
</s>
