laln2(3)
okay bestie, gather round π this is laln2(3) from the Library Functions Manual, and it's literally two lil' subroutines β dlaln2 and slaln2 β that do a 1x1 or 2x2 solve as one step inside trevc. Same routine twice, once in double precision, once in single. no cap, that's the whole vibe.
NAME
laln2 β laln2: 1x1 or 2x2 solve, step in trevc πΈ
SYNOPSIS
β¨ Functions β¨
subroutine dlaln2 (ltrans, na, nw, smin, ca, a, lda, d1, d2, b, ldb, wr,
wi, x, ldx, scale, xnorm, info)
DLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
subroutine slaln2 (ltrans, na, nw, smin, ca, a, lda, d1, d2, b, ldb, wr,
wi, x, ldx, scale, xnorm, info)
SLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
Detailed Description
lowkey there is no prose here at all π the page just goes straight into the function documentation. iconic of it honestly. moving on π«Ά
Function Documentation
subroutine dlaln2 (logical ltrans, integer na, integer nw, double precision smin, double precision ca, double precision, dimension( lda, * ) a, integer lda, double precision d1, double precision d2, double precision, dimension( ldb, * ) b, integer ldb, double precision wr, double precision wi, double precision, dimension( ldx, * ) x, integer ldx, double precision scale, double precision xnorm, integer info)
DLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
π Purpose
ok so picture this: DLALN2 solves a system of the form
(ca A - w D ) X = s B
or
(ca A**T - w D) X = s B
with possible scaling (that's the s π
) and perturbation of A. (A**T means A-transpose, iykyk.)
Ais anNAxNAreal matrix,cais a real scalar,Dis anNAxNAreal diagonal matrix,wis a real or complex value, andXandBareNAx 1 matrices β real ifwis real, complex ifwis complex.NAmay be 1 or 2.- If
wis complex,XandBare represented asNAx 2 matrices, the first column of each being the real part and the second being the imaginary part. - s is a scaling factor (
<= 1), computed byDLALN2, which is so chosen thatXcan be computed without overflow.Xis further scaled if necessary to assure thatnorm(ca A - w D)*norm(X)is less than overflow. - If both singular values of
(ca A - w D)are less thanSMIN,SMIN*identitywill be used instead of(ca A - w D). If only one singular value is less thanSMIN, one element of(ca A - w D)will be perturbed enough to make the smallest singular value roughlySMIN. If both singular values are at leastSMIN,(ca A - w D)will not be perturbed. In any case, the perturbation will be at most some small multiple ofmax( SMIN, ulp*norm(ca A - w D) ). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so. so like, close enough π€·ββοΈ - Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See
BIGNUM.)
π Parameters
LTRANSβLTRANS is LOGICAL=.TRUE.: A-transpose will be used.=.FALSE.:Awill be used (not transposed.)
NAβNA is INTEGER. The size of the matrixA. It may (only) be 1 or 2. literally only those two, don't try it πNWβNW is INTEGER. 1 if w is real, 2 if w is complex. It may only be 1 or 2.SMINβSMIN is DOUBLE PRECISION. The desired lower bound on the singular values ofA. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow ). (SeeBIGNUMandULP.)CAβCA is DOUBLE PRECISION. The coefficientc, whichAis multiplied by.AβA is DOUBLE PRECISION array, dimension (LDA,NA). TheNAxNAmatrixA.LDAβLDA is INTEGER. The leading dimension ofA. It must be at leastNA.D1βD1 is DOUBLE PRECISION. The 1,1 element in the diagonal matrixD.D2βD2 is DOUBLE PRECISION. The 2,2 element in the diagonal matrixD. Not used ifNA=1.BβB is DOUBLE PRECISION array, dimension (LDB,NW). TheNAxNWmatrixB(right-hand side). IfNW=2(w is complex), column 1 contains the real part ofBand column 2 contains the imaginary part.LDBβLDB is INTEGER. The leading dimension ofB. It must be at leastNA.WRβWR is DOUBLE PRECISION. The real part of the scalar w.WIβWI is DOUBLE PRECISION. The imaginary part of the scalar w. Not used ifNW=1.XβX is DOUBLE PRECISION array, dimension (LDX,NW). TheNAxNWmatrixX(unknowns), as computed byDLALN2. IfNW=2(w is complex), on exit, column 1 will contain the real part ofXand column 2 will contain the imaginary part.LDXβLDX is INTEGER. The leading dimension ofX. It must be at leastNA.SCALEβSCALE is DOUBLE PRECISION. The scale factor thatBmust be multiplied by to insure that overflow does not occur when computingX. Thus,(ca A - w D) Xwill beSCALE*B, notB(ignoring perturbations ofA.) It will be at most 1.XNORMβXNORM is DOUBLE PRECISION. The infinity-norm ofX, whenXis regarded as anNAxNWreal matrix.INFOβINFO is INTEGER. An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number ifca A - w Dhad to be perturbed. The possible values are:= 0: No error occurred, and(ca A - w D)did not have to be perturbed.= 1:(ca A - w D)had to be perturbed to make its smallest (or only) singular value greater thanSMIN.
NOTE: In the interests of speed, this routine does not check the inputs for errors. π she's fast, not careful, respect it
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 216 of file dlaln2.f.
subroutine slaln2 (logical ltrans, integer na, integer nw, real smin, real ca, real, dimension( lda, * ) a, integer lda, real d1, real d2, real, dimension( ldb, * ) b, integer ldb, real wr, real wi, real, dimension( ldx, * ) x, integer ldx, real scale, real xnorm, integer info)
SLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
π¦ Purpose
same whole entire mood as DLALN2, just single precision this time bestie. SLALN2 solves a system of the form
(ca A - w D ) X = s B
or
(ca A**T - w D) X = s B
with possible scaling (the s again π
) and perturbation of A. (A**T means A-transpose.)
Ais anNAxNAreal matrix,cais a real scalar,Dis anNAxNAreal diagonal matrix,wis a real or complex value, andXandBareNAx 1 matrices β real ifwis real, complex ifwis complex.NAmay be 1 or 2.- If
wis complex,XandBare represented asNAx 2 matrices, the first column of each being the real part and the second being the imaginary part. - s is a scaling factor (
<= 1), computed bySLALN2, which is so chosen thatXcan be computed without overflow.Xis further scaled if necessary to assure thatnorm(ca A - w D)*norm(X)is less than overflow. - If both singular values of
(ca A - w D)are less thanSMIN,SMIN*identitywill be used instead of(ca A - w D). If only one singular value is less thanSMIN, one element of(ca A - w D)will be perturbed enough to make the smallest singular value roughlySMIN. If both singular values are at leastSMIN,(ca A - w D)will not be perturbed. In any case, the perturbation will be at most some small multiple ofmax( SMIN, ulp*norm(ca A - w D) ). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so. - Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See
BIGNUM.)
π Parameters
LTRANSβLTRANS is LOGICAL=.TRUE.: A-transpose will be used.=.FALSE.:Awill be used (not transposed.)
NAβNA is INTEGER. The size of the matrixA. It may (only) be 1 or 2.NWβNW is INTEGER. 1 if w is real, 2 if w is complex. It may only be 1 or 2.SMINβSMIN is REAL. The desired lower bound on the singular values ofA. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow ). (SeeBIGNUMandULP.)CAβCA is REAL. The coefficientc, whichAis multiplied by.AβA is REAL array, dimension (LDA,NA). TheNAxNAmatrixA.LDAβLDA is INTEGER. The leading dimension ofA. It must be at leastNA.D1βD1 is REAL. The 1,1 element in the diagonal matrixD.D2βD2 is REAL. The 2,2 element in the diagonal matrixD. Not used ifNA=1.BβB is REAL array, dimension (LDB,NW). TheNAxNWmatrixB(right-hand side). IfNW=2(w is complex), column 1 contains the real part ofBand column 2 contains the imaginary part.LDBβLDB is INTEGER. The leading dimension ofB. It must be at leastNA.WRβWR is REAL. The real part of the scalar w.WIβWI is REAL. The imaginary part of the scalar w. Not used ifNW=1. π§
okay so that's where part 1 runs out of page, bestie β the rest of slaln2's params (and everything after) is waiting for you in part 2 πβ¨
Okay so we're in the output-parameter era of this page and honestly it's giving season-finale energy π Everything down here is what SLALN2 hands back to you once it's done doing its thing β read these, bestie, they're the receipts.
WIβREAL
The imaginary part of the scalar . Not used if NW=1. (and yeah, the page literally trails off right there at "the scalar ." β we don't write 'em, we just report 'em π)
XβREAL array, dimension (LDX,NW)
The NA x NW matrix X (unknowns), as computed by SLALN2. If NW=2 ( is complex), on exit, column 1 will contain the real part of X and column 2 will contain the imaginary part. Two real columns doing the job of one complex column, we love a budget hack that slays π
LDXβINTEGER
The leading dimension of X. It must be at least NA. It must be at least NA, bestie β that's not a suggestion, that's the vibe check β¨
SCALEβREAL
The scale factor that B must be multiplied by to insure that overflow does not occur when computing X. Thus, (ca A - w D) X will be SCALE*B, not B (ignoring perturbations of A.) It will be at most 1.
XNORMβREAL
The infinity-norm of X, when X is regarded as an NA x NW real matrix.
INFOβINTEGER
An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number if ca A - w D had to be perturbed. The possible values are:
= 0: No error occurred, and(ca A - w D)did not have to be perturbed. iconic, no notes π= 1:(ca A - w D)had to be perturbed to make its smallest (or only) singular value greater thanSMIN. a lil nudge to keep things invertible, no cap π«Ά
β οΈ NOTE: In the interests of speed, this routine does not check the inputs for errors. Translation: it trusts you completely. Betray that trust and it's on you, bestie ππ₯
π AUTHOR π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Four institutions, one routine, absolute main character energy πΈ
Definition at line 216 of file slaln2.f. (yes, if you wanna go read the actual Fortran, that's where it lives β go off, researcher π₯)
Author (the Doxygen one, not the humans)
Generated automatically by Doxygen for LAPACK from the source code. So like, a robot wrote this bit, and then a slightly chattier robot rewrote the robot's bit. It's givingβ¦ lineage π§
That's the whole page, bestie! π Footer deets for the record books: this is from LAPACK, Version 3.12.0, with the source/version and date stamped on exactly like the manpage does it. Go forth and be the most well-conditioned version of yourself π¦β¨π
π¦ 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