The routine may be called by the names f01lef or nagf_matop_real_gen_tridiag_lu.
The matrix , where is a real tridiagonal matrix, is factorized as
where is a permutation matrix, is a unit lower triangular matrix with at most one nonzero subdiagonal element per column, and is an upper triangular matrix with at most two nonzero superdiagonal elements per column.
The factorization is obtained by Gaussian elimination with partial pivoting and implicit row scaling.
An indication of whether or not the matrix is nearly singular is returned in the th element of the array ipiv. If it is important that is nonsingular, as is usually the case when solving a system of tridiagonal equations, then it is strongly recommended that is inspected on return from f01lef. (See the argument ipiv and Section 9 for further details.)
The argument is included in the routine so that f01lef may be used, in conjunction with f04lef, to obtain eigenvectors of by inverse iteration.
Wilkinson J H (1965) The Algebraic Eigenvalue Problem Oxford University Press, Oxford
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
1: – IntegerInput
On entry: , the order of the matrix .
2: – Real (Kind=nag_wp) arrayInput/Output
On entry: the diagonal elements of .
On exit: the diagonal elements of the upper triangular matrix .
3: – Real (Kind=nag_wp)Input
On entry: the scalar . f01lef factorizes .
4: – Real (Kind=nag_wp) arrayInput/Output
On entry: the superdiagonal elements of , stored in to ; is not used.
On exit: the elements of the first superdiagonal of , stored in to .
5: – Real (Kind=nag_wp) arrayInput/Output
On entry: the subdiagonal elements of , stored in to ; is not used.
On exit: the subdiagonal elements of , stored in to .
6: – Real (Kind=nag_wp)Input
On entry: a relative tolerance used to indicate whether or not the matrix () is nearly singular. tol should normally be chosen as approximately the largest relative error in the elements of . For example, if the elements of are correct to about significant figures, then tol should be set to about . See Section 9 for further details on how tol is used. If tol is supplied as less than , where is the machine precision, then the value is used in place of tol.
7: – Real (Kind=nag_wp) arrayOutput
On exit: the elements of the second superdiagonal of , stored in to ; and are not used.
8: – Integer arrayOutput
On exit: details of the permutation matrix . If an interchange occurred at the th step of the elimination, then , otherwise . If a diagonal element of is small, indicating that is nearly singular, then the element is returned as positive. Otherwise is returned as . See Section 9 for further details. If the application is such that it is important that is not nearly singular, then it is strongly recommended that is inspected on return.
9: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The computed factorization will satisfy the equation
where is the machine precision.
8Parallelism and Performance
f01lef makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The time taken by f01lef is approximately proportional to .
The factorization of a tridiagonal matrix proceeds in steps, each step eliminating one subdiagonal element of the tridiagonal matrix. In order to avoid small pivot elements and to prevent growth in the size of the elements of , rows and () will, if necessary, be interchanged at the th step prior to the elimination.
The element returns the smallest integer, , for which
where denotes the sum of the absolute values of the th row of the matrix (). If no such exists, then is returned as zero. If such a exists, then is small and hence () is singular or nearly singular.
This routine may be followed by f04lef to solve systems of tridiagonal equations. If you wish to solve single systems of tridiagonal equations you should be aware of f07caf, which solves tridiagonal systems with a single call. f07caf requires less storage and will generally be faster than the combination of f01lef and f04lef, but no test for near singularity is included in f07caf and so it should only be used when the equations are known to be nonsingular.
This example factorizes the tridiagonal matrix where
and then to solve the equations , where
by a call to f04lef. The example program sets and, of course, sets .