TESTING/LIN/ctpt02.f(3)
β¨ NAME β¨
ctpt02.f β the absolute icon of a test routine for packed triangular systems, no cap π
π SYNOPSIS π
subroutine ctpt02 (uplo, trans, diag, n, nrhs, ap, x, ldx, b, ldb, work,
rwork, resid)
CTPT02 β the baddie that computes residuals and we're obsessed π«Ά
πΈ DESCRIPTION πΈ
Okay bestie, so here's the tea: CTPT02 computes the residual for the computed solution to a triangular system of linear equations op(A)*X = B, when the triangular matrix A is stored in packed format. It's literally serving main character energy for accuracy checks β¨.
The test ratio is the maximum over:
norm(b - op(A)*x) / ( ||op(A)||_1 * norm(x) * EPS ),
where op(A) = A, A**T, or A**H, b is the column of B, x is the solution vector, and EPS is the machine epsilon. So it's basically asking "how good is your solution, really?" and the answer better be slay π―.
π PARAMETERS π
UPLOβ is aCHARACTER*1. It specifies whether the matrixAis upper or lower triangular, periodt.= 'U': Upper triangular π= 'L': Lower triangular π
TRANSβ is aCHARACTER*1. It specifies the operation applied toA. The way this works is lowkey iconic.= 'N':A * X = B(No transpose) π ββοΈ= 'T':A**T * X = B(Transpose) π= 'C':A**H * X = B(Conjugate transpose) π
DIAGβ is aCHARACTER*1. It specifies whether or not the matrixAis unit triangular. No cap, this matters.= 'N': Non-unit triangular π€= 'U': Unit triangular π
Nβ isINTEGER. The order of the matrixA. So like,N >= 0. Must be, okay? πNRHSβ isINTEGER. The number of right hand sides, i.e., the number of columns of the matricesXandB.NRHS >= 0. Giving us all the X and B energy fr fr.APβ isCOMPLEX array, dimension (N*(N+1)/2). This is the upper or lower triangular matrixA, packed columnwise in a linear array. Thej-th column ofAis stored in the arrayAPas follows:- if
UPLO = 'U',AP((j-1)*j/2 + i) = A(i,j)for1<=i<=j; - if
UPLO = 'L',AP((j-1)*(n-j) + j*(j+1)/2 + i-j) = A(i,j)forj<=i<=n.
- if
It's giving packed storage realness π
Xβ isCOMPLEX array, dimension (LDX,NRHS). The computed solution vectors for the system of linear equations. So proud of you, X π₯²LDXβ isINTEGER. The leading dimension of the arrayX.LDX >= max(1,N). Don't play with this, bestie.Bβ isCOMPLEX array, dimension (LDB,NRHS). The right hand side vectors for the system of linear equations. We <3 B for holding it down πLDBβ isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N). It's literal math, no shortcuts π₯WORKβ isCOMPLEX array, dimension (N). Just doing its job, lowkey iconic πΌRWORKβ isREAL array, dimension (N). Real ones know πΈRESIDβ isREAL. The maximum over the number of right hand sides of
norm(op(A)*B - B) / ( norm(op(A)) * norm(X) * EPS ).
This is the final boss of the residual check. The whole point. The moment. Periodt. π
π¦ AUTHOR π¦
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 145 of file ctpt02.f. So go check it out if you want the full source π«
π SIGN-OFF π
Brought to you with love by the absolute legends at LAPACK, Version 3.12.0, straight from TESTING/LIN/ctpt02.f β generated automatically by Doxygen for LAPACK from the source code. Stay slay, bestie, and remember: residuals are just vibes with numbers πβ¨π
π¦ 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