SRC/sposvx.f(3)
πΈ SRC/sposvx.f(3) πΈ
okay so bestie, welcome to SRC/sposvx.f β this is a page from the Library Functions Manual and it's literally about to hand you the glow-up of a lifetime π
β¨
π NAME π
SRC/sposvx.f β yeah, that's it, that's the name, the source file itself is the whole main character here π
π¦ SYNOPSIS π¦
β¨ Functions/Subroutines β¨
okay so here's the one function this page is obsessed with β brace yourself:
subroutine sposvx (fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b,
ldb, x, ldx, rcond, ferr, berr, work, iwork, info)
and what does it do? it computes the solution to a system of linear equations A * X = B for PO matrices π that's the vibe, no cap π
ngl, that's a lot of arguments β count them at your peril π but every single one of them is gonna get introduced properly, so don't panic, we got you π«Ά
π FUNCTION/SUBROUTINE DOCUMENTATION π
subroutine sposvx (character fact, character uplo, integer n, integer nrhs,
real, dimension( lda, * ) a, integer lda, real, dimension( ldaf, * ) af,
integer ldaf, character equed, real, dimension( * ) s, real, dimension(
ldb, * ) b, integer ldb, real, dimension( ldx, * ) x, integer ldx, real
rcond, real, dimension( * ) ferr, real, dimension( * ) berr, real,
dimension( * ) work, integer, dimension( * ) iwork, integer info)
SPOSVX computes the solution to system of linear equations A * X = B for PO matrices β¨
β¨ PURPOSE β¨
Okay so SPOSVX uses the Cholesky factorization A = U**T*U or A = L*L**T to compute the solution to a real system of linear equations
A * X = B,
where A is an N-by-N symmetric positive definite matrix and X and B are N-by-NRHS matrices.
Error bounds on the solution and a condition estimate are also provided. The math is literally doing main character energy π
πΈ DESCRIPTION πΈ
The following steps are performed:
- If
FACT = 'E', real scaling factors are computed to equilibrate the system:
diag(S) * A * diag(S) * inv(diag(S)) * X = diag(S) * B
Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
- If
FACT = 'N'or'E', the Cholesky decomposition is used to factor the matrixA(after equilibration ifFACT = 'E') as
A = U**T* U, if UPLO = 'U', or
A = L * L**T, if UPLO = 'L',
where U is an upper triangular matrix and L is a lower triangular matrix.
- If the leading principal minor of order
iis not positive, then the routine returns withINFO = i. Otherwise, the factored form ofAis used to estimate the condition number of the matrixA. 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 forXand compute error bounds as described below. - The system of equations is solved for
Xusing the factored form ofA. - Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
- If equilibration was used, the matrix
Xis premultiplied bydiag(S)so that it solves the original system before equilibration.
π PARAMETERS π
FACTβFACT is CHARACTER*1. Specifies whether or not the factored form of the matrixAis supplied on entry, and if not, whether the matrixAshould be equilibrated before it is factored.= 'F': On entry,AFcontains the factored form ofA. IfEQUED = 'Y', the matrixAhas been equilibrated with scaling factors given byS.AandAFwill not be modified.= 'N': The matrixAwill be copied toAFand factored.= 'E': The matrixAwill be equilibrated if necessary, then copied toAFand factored.
UPLOβUPLO is CHARACTER*1.= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NβN is INTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.NRHSβNRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.AβA is REAL array, dimension (LDA,N).- On entry, the symmetric matrix
A, except ifFACT = 'F'andEQUED = 'Y', thenAmust contain the equilibrated matrixdiag(S)*A*diag(S). IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA, and the strictly lower triangular part ofAis not referenced. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA, and the strictly upper triangular part ofAis not referenced.Ais not modified ifFACT = 'F'or'N', or ifFACT = 'E'andEQUED = 'N'on exit. - On exit, if
FACT = 'E'andEQUED = 'Y',Ais overwritten bydiag(S)*A*diag(S).
- On entry, the symmetric matrix
LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).AFβAF is REAL array, dimension (LDAF,N).- If
FACT = 'F', thenAFis an input argument and on entry contains the triangular factorUorLfrom the Cholesky factorizationA = U**T*UorA = L*L**T, in the same storage format asA. IfEQUED .ne. 'N', thenAFis the factored form of the equilibrated matrixdiag(S)*A*diag(S). - If
FACT = 'N', thenAFis an output argument and on exit returns the triangular factorUorLfrom the Cholesky factorizationA = U**T*UorA = L*L**Tof the original matrixA. - If
FACT = 'E', thenAFis an output argument and on exit returns the triangular factorUorLfrom the Cholesky factorizationA = U**T*UorA = L*L**Tof the equilibrated matrixA(see the description ofAfor the form of the equilibrated matrix).
- If
LDAFβLDAF is INTEGER. The leading dimension of the arrayAF.LDAF >= max(1,N).EQUEDβEQUED is CHARACTER*1. Specifies the form of equilibration that was done.EQUEDis an input argument ifFACT = 'F'; otherwise, it is an output argument.= 'N': No equilibration (always true ifFACT = 'N').= 'Y': Equilibration was done, i.e.,Ahas been replaced bydiag(S) * A * diag(S).
SβS is REAL array, dimension (N). The scale factors forA; not accessed ifEQUED = 'N'.Sis an input argument ifFACT = 'F'; otherwise,Sis an output argument. IfFACT = 'F'andEQUED = 'Y', each element ofSmust be positive.BβB is REAL array, dimension (LDB,NRHS). On entry, theN-by-NRHSright hand side matrixB. On exit, ifEQUED = 'N',Bis not modified; ifEQUED = 'Y',Bis overwritten bydiag(S) * B.LDBβLDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).XβX is REAL array, dimension (LDX,NRHS). IfINFO = 0orINFO = N+1, theN-by-NRHSsolution matrixXto the original system of equations. Note that ifEQUED = 'Y',AandBare modified on exit, and the solution to the equilibrated system isinv(diag(S))*X.LDXβLDX is INTEGER. The leading dimension of the arrayX.LDX >= max(1,N).RCONDβRCOND is REAL. The estimate of the reciprocal condition number of the matrixAafter equilibration (if done). 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βFERR is REAL array, dimension (NRHS). The estimated forward error bound for each solution vectorX(j)(thej-th column of the solution matrixX). 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βBERR is REAL array, dimension (NRHS). The componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any element ofAorBthat makesX(j)an exact solution).WORKβWORK is REAL array, dimension (3*N).IWORKβIWORK is INTEGER array, dimension (N).INFOβINFO is INTEGER.= 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value> 0: ifINFO = i, andiis<= N: the leading principal minor of orderiofAis not positive, so the factorization could not be completed, and the solution has not been computed.RCOND = 0is returned.= N+1:Uis 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.
π¦ AUTHOR π¦
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π DEFINITION π
Definition at line 304 of file sposvx.f.
π AUTHOR (GENERATED) π
Generated automatically by Doxygen for LAPACK from the source code.
Cute lil footer sign-off: this page is LAPACK Version 3.12.0 from SRC/sposvx.f(3) (plus the date on that footer line), and thatβs the source/version sign-off, 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