SRC/cgtsvx.f(3)
π SRC/cgtsvx.f(3) β Library Functions Manual, but make it make sense
okay so bestie, buckle in π this is a page from the Library Functions Manual, and it's about one (1) extremely specific Fortran subroutine. she's giving linear algebra main character energy and honestly? iconic.
β¨ NAME β¨
SRC/cgtsvx.f β no cap, that's literally it, that's the name π
πΈ SYNOPSIS πΈ
Functions/Subroutines
subroutine cgtsvx (fact, trans, n, nrhs, dl, d, du, dlf, df, duf, du2,
ipiv, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info)
CGTSVX computes the solution to system of linear equations A * X =
B for GT matrices
likeβ¦ look at that argument list. she's long. she's thorough. she ate π
π¦ Function/Subroutine Documentation π¦
subroutine cgtsvx (character fact, character trans, integer n, integer nrhs,
complex, dimension( * ) dl, complex, dimension( * ) d, complex,
dimension( * ) du, complex, dimension( * ) dlf, complex, dimension( * )
df, complex, dimension( * ) duf, complex, dimension( * ) du2, integer,
dimension( * ) ipiv, complex, dimension( ldb, * ) b, integer ldb,
complex, dimension( ldx, * ) x, integer ldx, real rcond, real,
dimension( * ) ferr, real, dimension( * ) berr, complex, dimension( * )
work, real, dimension( * ) rwork, integer info)
CGTSVX computes the solution to system of linear equations A * X = B for GT matrices β that's the whole vibe, fr fr π
π Purpose π
okay so picture this π:
CGTSVXuses the LU factorization to compute the solution to a complex system of linear equationsA * X = B,A**T * X = B, orA**H * X = B, where A is a tridiagonal matrix of order N and X and B are N-by-NRHS matrices.
and that's not even the best part β she ALSO hooks you up with error bounds on the solution and a condition estimate. like, she solved it AND she's telling you how much to trust it. thoughtful queen π«Ά
π₯ Description π₯
here's the step-by-step, bestie β the routine does all of this, in order:
- If
FACT = 'N', the LU decomposition is used to factor the matrix A asA = L * U, where L is a product of permutation and unit lower bidiagonal matrices and U is upper triangular with nonzeros in only the main diagonal and first two superdiagonals. - If some
U(i,i)=0, so that U is exactly singular, then the routine returns withINFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision,INFO = N+1is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below. - The system of equations is solved for X using the factored form of A.
- Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
ngl step 2 is the drama of the whole page π a warning but she keeps going anyway. resilient.
π Parameters π
FACTβCHARACTER*1. Specifies whether or not the factored form of A has been supplied on entry.= 'F':DLF,DF,DUF,DU2, andIPIVcontain the factored form of A;DL,D,DU,DLF,DF,DUF,DU2andIPIVwill not be modified.= 'N': The matrix will be copied toDLF,DF, andDUFand factored.
TRANSβCHARACTER*1. Specifies the form of the system of equations:= 'N':A * X = B(No transpose)= 'T':A**T * X = B(Transpose)= 'C':A**H * X = B(Conjugate transpose)
NβINTEGER. The order of the matrix A.N >= 0.NRHSβINTEGER. The number of right hand sides, i.e., the number of columns of the matrix B.NRHS >= 0.DLβCOMPLEX array, dimension (N-1). The (n-1) subdiagonal elements of A.DβCOMPLEX array, dimension (N). The n diagonal elements of A.DUβCOMPLEX array, dimension (N-1). The (n-1) superdiagonal elements of A.DLFβCOMPLEX array, dimension (N-1).- If
FACT = 'F', thenDLFis an input argument and on entry contains the (n-1) multipliers that define the matrix L from the LU factorization of A as computed byCGTTRF. - If
FACT = 'N', thenDLFis an output argument and on exit contains the (n-1) multipliers that define the matrix L from the LU factorization of A.
- If
DFβCOMPLEX array, dimension (N).- If
FACT = 'F', thenDFis an input argument and on entry contains the n diagonal elements of the upper triangular matrix U from the LU factorization of A. - If
FACT = 'N', thenDFis an output argument and on exit contains the n diagonal elements of the upper triangular matrix U from the LU factorization of A.
- If
DUFβCOMPLEX array, dimension (N-1).- If
FACT = 'F', thenDUFis an input argument and on entry contains the (n-1) elements of the first superdiagonal of U. - If
FACT = 'N', thenDUFis an output argument and on exit contains the (n-1) elements of the first superdiagonal of U.
- If
DU2βCOMPLEX array, dimension (N-2).- If
FACT = 'F', thenDU2is an input argument and on entry contains the (n-2) elements of the second superdiagonal of U. - If
FACT = 'N', thenDU2is an output argument and on exit contains the (n-2) elements of the second superdiagonal of U.
- If
IPIVβINTEGER array, dimension (N).- If
FACT = 'F', thenIPIVis an input argument and on entry contains the pivot indices from the LU factorization of A as computed byCGTTRF. - If
FACT = 'N', thenIPIVis an output argument and on exit contains the pivot indices from the LU factorization of A; row i of the matrix was interchanged with rowIPIV(i).IPIV(i)will always be either i or i+1;IPIV(i) = iindicates a row interchange was not required.
- If
BβCOMPLEX array, dimension (LDB,NRHS). The N-by-NRHS right hand side matrix B.LDBβINTEGER. The leading dimension of the array B.LDB >= max(1,N).XβCOMPLEX array, dimension (LDX,NRHS). IfINFO = 0orINFO = N+1, the N-by-NRHS solution matrix X.LDXβINTEGER. The leading dimension of the array X.LDX >= max(1,N).RCONDβREAL. The estimate of the reciprocal condition number of the matrix A. IfRCONDis less than the machine precision (in particular, ifRCOND = 0), the matrix is singular to working precision. This condition is indicated by a return code ofINFO > 0.FERRβREAL array, dimension (NRHS). The estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrix X). IfXTRUEis the true solution corresponding toX(j),FERR(j)is an estimated upper bound for the magnitude of the largest element in(X(j) - XTRUE)divided by the magnitude of the largest element inX(j). The estimate is as reliable as the estimate forRCOND, and is almost always a slight overestimate of the true error.BERRβREAL array, dimension (NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element of A or B that makesX(j)an exact solution).WORKβCOMPLEX array, dimension (2*N).RWORKβREAL array, dimension (N).INFOβINTEGER.= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: ifINFO = i, and i is<= N:U(i,i)is exactly zero. The factorization has not been completed unlessi = N, but the factor U is exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+1: U is nonsingular, butRCONDis less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value ofRCONDwould suggest.
bestie please actually read the INFO > 0 section π "singular to working precision" is not a vibe, it's a warning.
π§ Author π§
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
β Definition at line 291 of file cgtsvx.f. β
π Author π
Generated automatically by Doxygen for LAPACK from the source code. (yes, a robot wrote this part, we respect the robot π«‘)
π Sign-off π
and that's the whole page, bestie π β this beauty is from LAPACK, Version 3.12.0, and she lives at SRC/cgtsvx.f(3). periodt π
β¨
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms