larrd(3)

πŸ’… larrd β€” the manual, but make it make sense

okay so bestie, you've stumbled into larrd(3) from the Library Functions Manual and honestly? You're in the right place. This is the larrd family β€” literally described as "larrd: step in stemr, tridiag eig" β€” and yes it's LAPACK, yes it's Fortran, yes you're gonna slay this. Let's go 🫢


✨ NAME ✨

larrd β€” no cap, the actual name line says: larrd - larrd: step in stemr, tridiag eig. That's it, that's the vibe. It's a step inside stemr, doing tridiagonal eigenvalue things. πŸ’œ


🌸 SYNOPSIS 🌸

🌈 Functions 🌈

  • dlarrd β€” the double-precision bestie. Full signature below πŸ‘‡
  • slarrd β€” the single-precision bestie. Same energy, less decimal places πŸ’…

Both of them: "computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy." That's the whole assignment, and they ate.

subroutine dlarrd (range, order, n, vl, vu, il, iu, gers, reltol, d, e,
    e2, pivmin, nsplit, isplit, m, w, werr, wl, wu, iblock, indexw,
    work, iwork, info)
DLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.
subroutine slarrd (range, order, n, vl, vu, il, iu, gers, reltol, d, e,
    e2, pivmin, nsplit, isplit, m, w, werr, wl, wu, iblock, indexw,
    work, iwork, info)
SLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.

See? Identical twins. πŸ§šβ€β™€οΈ


✨ Detailed Description ✨

okay so there's a section literally called Detailed Description and it's... empty. Nothing under it. It's giving "she said she'd text back." πŸ™ˆ

Moving on β€” the real content lives in the function docs. πŸ’–


πŸŽ€ Function Documentation πŸŽ€

πŸ¦‹ subroutine dlarrd πŸ¦‹

subroutine dlarrd (character range, character order, integer n, double
    precision vl, double precision vu, integer il, integer iu, double
    precision, dimension( * ) gers, double precision reltol, double
    precision, dimension( * ) d, double precision, dimension( * ) e, double
    precision, dimension( * ) e2, double precision pivmin, integer nsplit,
    integer, dimension( * ) isplit, integer m, double precision, dimension(
    * ) w, double precision, dimension( * ) werr, double precision wl,
    double precision wu, integer, dimension( * ) iblock, integer, dimension(
    * ) indexw, double precision, dimension( * ) work, integer, dimension( *
    ) iwork, integer info)
DLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.

πŸ”₯ Purpose πŸ”₯

So here's the tea, straight from the source, in its own comment-block voice:

!>
!> DLARRD computes the eigenvalues of a symmetric tridiagonal
!> matrix T to suitable accuracy. This is an auxiliary code to be
!> called from DSTEMR.
!> The user may ask for all eigenvalues, all eigenvalues
!> in the half-open interval (VL, VU], or the IL-th through IU-th
!> eigenvalues.
!>
!> To avoid overflow, the matrix must be scaled so that its
!> largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value, and for greatest
!> accuracy, it should not be much smaller than that.
!>
!> See W. Kahan , Report CS41, Computer Science Dept., Stanford
!> University, July 21, 1966.
!>

Babe. Read the scaling line again. That's not a suggestion, that's a whole overflow warning β€” scale your matrix so the largest element is ≀ overflow**(1/2) * underflow**(1/4) in absolute value, and for the best accuracy don't make it way smaller than that either. Respect the limits, periodt. 😀

Also shoutout to W. Kahan, Report CS41, Computer Science Dept., Stanford University, July 21, 1966 β€” an absolute icon, we stan. πŸ‘‘


πŸ’« Parameters πŸ’«

  • RANGE β€” CHARACTER*1. Tells it what to hunt for:
    • 'A' β€” () all eigenvalues will be found. Everything. The whole spectrum. πŸ‘‘
    • 'V' β€” () all eigenvalues in the half-open interval (VL, VU] will be found. (Half-open! Square bracket on the right, bestie, that detail matters ✨)
    • 'I' β€” () the IL-th through IU-th eigenvalues (of the entire matrix) will be found. Index range energy. 🎯
  • ORDER β€” CHARACTER*1. Tells it how to lay out what it found:
    • 'B' β€” () the eigenvalues will be grouped by split-off block (see IBLOCK, ISPLIT) and ordered from smallest to largest within the block. Cute little clusters πŸŽ€
    • 'E' β€” () the eigenvalues for the entire matrix will be ordered from smallest to largest. One big sorted lineup, main character energy πŸ’…
  • N β€” INTEGER. The order of the tridiagonal matrix T. Constraint: N >= 0. Zero is allowed, don't come for it. 🫢
  • VL β€” DOUBLE PRECISION. If RANGE='V', the lower bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. Constraint: VL < VU. Not referenced if RANGE = 'A' or 'I'. πŸ“
  • VU β€” DOUBLE PRECISION. If RANGE='V', the upper bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. Constraint: VL < VU. Not referenced if RANGE = 'A' or 'I'. πŸ“
  • IL β€” INTEGER. If RANGE='I', the index of the smallest eigenvalue to be returned. Constraint: 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. Not referenced if RANGE = 'A' or 'V'. πŸ”’
  • IU β€” INTEGER. If RANGE='I', the index of the largest eigenvalue to be returned. Constraint: 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. Not referenced if RANGE = 'A' or 'V'. πŸ”’
  • GERS β€” DOUBLE PRECISION array, dimension (2*N). The N Gerschgorin intervals (the i-th Gerschgorin interval is (GERS(2*i-1), GERS(2*i))). Intervals everywhere, we love a bracket moment πŸ’œ
  • RELTOL β€” DOUBLE PRECISION. The minimum relative width of an interval. When an interval is narrower than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged.
Note: this should always be at least radix*machine epsilon. fr fr, do not skip this one. 😭
  • D β€” DOUBLE PRECISION array, dimension (N). The n diagonal elements of the tridiagonal matrix T. The main character diagonal ✨
  • E β€” DOUBLE PRECISION array, dimension (N-1). The (n-1) off-diagonal elements of the tridiagonal matrix T. The supporting cast πŸŽ€
  • E2 β€” DOUBLE PRECISION array, dimension (N-1). The (n-1) squared off-diagonal elements of the tridiagonal matrix T. Same as E but squared, because why not πŸ’…
  • PIVMIN β€” DOUBLE PRECISION. The minimum pivot allowed in the Sturm sequence for T. Small but mighty. πŸ”₯
  • NSPLIT β€” INTEGER. The number of diagonal blocks in the matrix T. Constraint: 1 <= NSPLIT <= N. 🧩
  • ISPLIT β€” INTEGER array, dimension (N). The splitting points, at which T breaks up into submatrices. The first submatrix consists of rows/columns 1 to ISPLIT(1), the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), etc., and the NSPLIT-th consists of rows/columns ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N.
(Only the first NSPLIT elements will actually be used, but since the user cannot know a priori what value NSPLIT will have, N words must be reserved for ISPLIT.) Reserve the whole N, bestie, don't be stingy 🫢
  • M β€” INTEGER. The actual number of eigenvalues found. Constraint: 0 <= M <= N. (See also the description of INFO=2,3.) Spoiler: it can come back less than you asked for πŸ‘€
  • W β€” DOUBLE PRECISION array, dimension (N). On exit, the first M elements of W will contain the eigenvalue approximations. DLARRD computes an interval I_j = (a_j, b_j] that includes eigenvalue j. The eigenvalue approximation is given as the interval midpoint W(j)= ( a_j + b_j)/2. The corresponding error is bounded by WERR(j) = abs( a_j - b_j)/2. Midpoint math, iconic behaviour 🎯
  • WERR β€” DOUBLE PRECISION array, dimension (N). The error bound on the corresponding eigenvalue approximation in W. It's the receipts for how accurate W actually is 🧾
  • WL β€” DOUBLE PRECISION. That's the whole description. She's mysterious. She contains multitudes. (The details live under WU πŸ‘‡) πŸ™ˆ
  • WU β€” DOUBLE PRECISION. The interval (WL, WU] contains all the wanted eigenvalues.
    • If RANGE='V', then WL=VL and WU=VU. Copy-paste, love that for us.
    • If RANGE='A', then WL and WU are the global Gerschgorin bounds on the spectrum.
    • If RANGE='I', then WL and WU are computed by DLAEBZ from the index range specified.
  • IBLOCK β€” INTEGER array, dimension (N). At each row/column j where E(j) is zero or small, the matrix T is considered to split into a block diagonal matrix. On exit, if INFO = 0, IBLOCK(i) specifies to which block (from 1 to the number of blocks) the eigenvalue W(i) belongs.
(DLARRD may use the remaining N-M elements as workspace.) so don't be surprised if the tail end of your array gets reworked, she needed the room πŸ€·β€β™€οΈ
  • INDEXW β€” INTEGER array, dimension (N). The indices of the eigenvalues within each block (submatrix); for example, INDEXW(i)= j and IBLOCK(i)=k imply that the i-th eigenvalue W(i) is the j-th eigenvalue in block k. Cute little coordinate system πŸ—ΊοΈ
  • WORK β€” DOUBLE PRECISION array, dimension (4*N). Scratch space, double precision flavour. ✨
  • IWORK β€” INTEGER array, dimension (3*N). Scratch space, integer flavour. ✨
  • INFO β€” INTEGER. The whole mood report:
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value πŸ™ƒ
    • > 0: some or all of the eigenvalues failed to converge or were not computed:
      • =1 or 3: Bisection failed to converge for some eigenvalues; these eigenvalues are flagged by a negative block number. The effect is that the eigenvalues may not be as accurate as the absolute and relative tolerances. This is generally caused by unexpectedly inaccurate arithmetic. πŸ’€
      • =2 or 3: RANGE='I' only: Not all of the eigenvalues IL:IU were found.
        • Effect: M < IU+1-IL
        • Cause: non-monotonic arithmetic, causing the Sturm sequence to be non-monotonic.
        • Cure: recalculate, using RANGE='A', and pick out eigenvalues IL:IU. In some cases, increasing the PARAMETER may make things work.
      • = 4: RANGE='I', and the Gershgorin interval initially used was too small. No eigenvalues were computed.
        • Probable cause: your machine has sloppy floating-point arithmetic. 😭
        • Cure: Increase the PARAMETER, recompile, and try again.
🚨 real talk: INFO > 0 is not a cute look. Read the exact code it hands back before you trust any of those numbers, okay? The manpage is being extremely clear about the failure modes and we respect that.

🧚 Internal Parameters: 🧚

  • FUDGE β€” DOUBLE PRECISION, default = 2. A to widen the Gershgorin intervals. Ideally, a value of 1 should work, but on machines with sloppy arithmetic, this needs to be larger. The default for publicly released versions should be large enough to handle the worst machine around. Note that this has no effect on accuracy of the solution. πŸ’…

Contributors

  • W. Kahan, University of California, Berkeley, USA
  • Beresford Parlett, University of California, Berkeley, USA
  • Jim Demmel, University of California, Berkeley, USA
  • Inderjit Dhillon, University of Texas, Austin, USA
  • Osni Marques, LBNL/NERSC, USA
  • Christof Voemel, University of California, Berkeley, USA

Author

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

Definition at line 325 of file dlarrd.f.


slarrd β€” single precision, same energy πŸ’…

subroutine slarrd (character range, character order, integer n, real vl,
    real vu, integer il, integer iu, real, dimension( * ) gers, real reltol,
    real, dimension( * ) d, real, dimension( * ) e, real, dimension( * ) e2,
    real pivmin, integer nsplit, integer, dimension( * ) isplit, integer m,
    real, dimension( * ) w, real, dimension( * ) werr, real wl, real wu,
    integer, dimension( * ) iblock, integer, dimension( * ) indexw, real,
    dimension( * ) work, integer, dimension( * ) iwork, integer info)

SLARRD computes the eigenvalues of a symmetric tridiagonal matrix to suitable accuracy.

✨ Purpose ✨

SLARRD computes the eigenvalues of a symmetric tridiagonal matrix T to suitable accuracy. This is an auxiliary code to be called from SSTEMR. The user may ask for all eigenvalues, all eigenvalues in the half-open interval (VL, VU], or the IL-th through IU-th eigenvalues. πŸŽ€

To avoid overflow, the matrix must be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value, and for greatest accuracy, it should not be much smaller than that. πŸ”₯

See W. Kahan, Report CS41, Computer Science Dept., Stanford University, July 21, 1966.

🌸 Parameters 🌸

  • RANGE β€” CHARACTER*1
    • = 'A': () all eigenvalues will be found.
    • = 'V': () all eigenvalues in the half-open interval (VL, VU] will be found.
    • = 'I': () the IL-th through IU-th eigenvalues (of the entire matrix) will be found.
  • ORDER β€” CHARACTER*1
    • = 'B': () the eigenvalues will be grouped by split-off block (see IBLOCK, ISPLIT) and ordered from smallest to largest within the block.
    • = 'E': () the eigenvalues for the entire matrix will be ordered from smallest to largest.
  • N β€” INTEGER. The order of the tridiagonal matrix T. N >= 0.
  • VL β€” REAL. If RANGE='V', the lower bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. VL < VU. Not referenced if RANGE = 'A' or 'I'.
  • VU β€” REAL. If RANGE='V', the upper bound of the interval to be searched for eigenvalues. Eigenvalues less than or equal to VL, or greater than VU, will not be returned. VL < VU. Not referenced if RANGE = 'A' or 'I'.
  • IL β€” INTEGER. If RANGE='I', the index of the smallest eigenvalue to be returned. 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. Not referenced if RANGE = 'A' or 'V'.
  • IU β€” INTEGER. If RANGE='I', the index of the largest eigenvalue to be returned. 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. Not referenced if RANGE = 'A' or 'V'.
  • GERS β€” REAL array, dimension (2*N). The N Gerschgorin intervals (the i-th Gerschgorin interval is (GERS(2*i-1), GERS(2*i))).
  • RELTOL β€” REAL. The minimum relative width of an interval. When an interval is narrower than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small, i.e., converged. Note: this should always be at least radix*machine epsilon.
  • D β€” REAL array, dimension (N). The n diagonal elements of the tridiagonal matrix T.
  • E β€” REAL array, dimension (N-1). The (n-1) off-diagonal elements of the tridiagonal matrix T.
  • E2 β€” REAL array, dimension (N-1). The (n-1) squared off-diagonal elements of the tridiagonal matrix T.
  • PIVMIN β€” REAL. The minimum pivot allowed in the Sturm sequence for T.
  • NSPLIT β€” INTEGER. The number of diagonal blocks in the matrix T. 1 <= NSPLIT <= N.
  • ISPLIT β€” INTEGER array, dimension (N). The splitting points, at which T breaks up into submatrices. The first submatrix consists of rows/columns 1 to ISPLIT(1), the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), etc., and the NSPLIT-th consists of rows/columns ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. (Only the first NSPLIT elements will actually be used, but since the user cannot know a priori what value NSPLIT will have, N words must be reserved for ISPLIT.)
  • M β€” INTEGER. The actual number of eigenvalues found. 0 <= M <= N. (See also the description of INFO=2,3.)
  • W β€” REAL array, dimension (N). On exit, the first M elements of W will contain the eigenvalue approximations. SLARRD computes an interval I_j = (a_j, b_j] that includes eigenvalue j. The eigenvalue approximation is given as the interval midpoint W(j)= ( a_j + b_j)/2. The corresponding error is bounded by WERR(j) = abs( a_j - b_j)/2.
  • WERR β€” REAL array, dimension (N). The error bound on the corresponding eigenvalue approximation in W.
  • WL β€” REAL.
  • WU β€” REAL. The interval (WL, WU] contains all the wanted eigenvalues. If RANGE='V', then WL=VL and WU=VU. If RANGE='A', then WL and WU are the global Gerschgorin bounds on the spectrum. If RANGE='I', then WL and WU are computed by SLAEBZ from the index range specified.
  • IBLOCK β€” INTEGER array, dimension (N). At each row/column j where E(j) is zero or small, the matrix T is considered to split into a block diagonal matrix. On exit, if INFO = 0, IBLOCK(i) specifies to which block (from 1 to the number of blocks) the eigenvalue W(i) belongs. (SLARRD may use the remaining N-M elements as workspace.)
  • INDEXW β€” INTEGER array, dimension (N). The indices of the eigenvalues within each block (submatrix); for example, INDEXW(i)= j and IBLOCK(i)=k imply that the i-th eigenvalue W(i) is the j-th eigenvalue in block k.
  • WORK β€” REAL array, dimension (4*N).
  • IWORK β€” INTEGER array, dimension (3*N).
  • INFO β€” INTEGER
    • = 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: some or all of the eigenvalues failed to converge or were not computed:
      • =1 or 3: Bisection failed to converge for some eigenvalues; these eigenvalues are flagged by a negative block number. The effect is that the eigenvalues may not be as accurate as the absolute and relative tolerances. This is generally caused by unexpectedly inaccurate arithmetic.
      • =2 or 3: RANGE='I' only: Not all of the eigenvalues IL:IU were found. Effect: M < IU+1-IL Cause: non-monotonic arithmetic, causing the Sturm sequence to be non-monotonic. Cure: recalculate, using RANGE='A', and pick out eigenvalues IL:IU. In some cases, increasing the PARAMETER may make things work.
      • = 4: RANGE='I', and the Gershgorin interval initially used was too small. No eigenvalues were computed. Probable cause: your machine has sloppy floating-point arithmetic. Cure: Increase the PARAMETER, recompile, and try again.

Internal Parameters

  • FUDGE β€” REAL, default = 2. bestie this is the little safety cushion that widens the Gershgorin intervals πŸ’… like, ideally a value of 1 should be enough, but on machines with sloppy arithmetic you gotta go bigger. The default for publicly released versions should be large enough to handle the worst machine around β€” yes, that machine, the cursed one in the corner 😭. And the slay part? It has no effect on accuracy of the solution, so don't stress 🫢

🫢 Contributors 🫢

okay these absolute icons literally built this thing, show some respect:

  • W. Kahan, University of California, Berkeley, USA πŸ‘‘
  • Beresford Parlett, University of California, Berkeley, USA ✨
  • Jim Demmel, University of California, Berkeley, USA πŸ’–
  • Inderjit Dhillon, University of Texas, Austin, USA πŸ¦‹
  • Osni Marques, LBNL/NERSC, USA 🌸
  • Christof Voemel, University of California, Berkeley, USA πŸŽ€

πŸ‘‘ Author πŸ‘‘

The main character energy comes from:

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ“ Definition πŸ“

Located at line 325 of file slarrd.f β€” yes, fr fr, that's the spot πŸ”₯


🌈 Author (the meta one) 🌈

Generated automatically by Doxygen for LAPACK from the source code. Not a human typing this out β€” it's the machine doing its little autopilot thing πŸ€–βœ¨


πŸ’€ real talk: this page is auto-generated, so if something looks weird, blame the Doxygen, not me πŸ™ˆ

and that's a wrap on larrd(3) bestie!! πŸŽ‰ this whole thing is from LAPACK, Version 3.12.0, dated larrd(3) β€” go forth and slay those eigenvalue problems, ily, bye πŸ’œπŸ¦‹πŸ’…

πŸ“¦ where this page comes from