naginterfaces.library.matop.real_gen_tridiag_lu¶
- naginterfaces.library.matop.real_gen_tridiag_lu(a, lamda, b, c, tol)[source]¶
real_gen_tridiag_lu
computes an factorization of a real tridiagonal matrix, using Gaussian elimination with partial pivoting.For full information please refer to the NAG Library document for f01le
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/f01/f01lef.html
- Parameters
- afloat, array-like, shape
The diagonal elements of .
- lamdafloat
The scalar .
real_gen_tridiag_lu
factorizes .- bfloat, array-like, shape
The superdiagonal elements of , stored in to ; is not used.
- cfloat, array-like, shape
The subdiagonal elements of , stored in to ; is not used.
- tolfloat
A relative tolerance used to indicate whether or not the matrix () is nearly singular. 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 should be set to about . See Further Comments for further details on how is used. If is supplied as less than , where is the machine precision, then the value is used in place of .
- Returns
- afloat, ndarray, shape
The diagonal elements of the upper triangular matrix .
- bfloat, ndarray, shape
The elements of the first superdiagonal of , stored in to .
- cfloat, ndarray, shape
The subdiagonal elements of , stored in to .
- dfloat, ndarray, shape
The elements of the second superdiagonal of , stored in to ; and are not used.
- ipivint, ndarray, shape
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 Further Comments 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.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
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 . 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
real_gen_tridiag_lu
. (See the argument and Further Comments for further details.)The argument is included in the function so that
real_gen_tridiag_lu
may be used, in conjunction withlinsys.real_tridiag_fac_solve
, to obtain eigenvectors of by inverse iteration.
- References
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