SRC/sgetri.f(3)

✨ SRC/sgetri.f ✨

okay so this page lives in the Library Functions Manual (LAPACK's own little corner of the internet) and honestly? it's a bop. it's the docs for sgetri, and if you've ever wanted to un-multiply a matrix, bestie, this is your girl πŸ’…


🌸 SYNOPSIS 🌸

Functions/Subroutines

  • subroutine sgetri (n, a, lda, ipiv, work, lwork, info) β€” the whole squad, introduced below. this is SGETRI, no notes πŸ‘‘

πŸ¦‹ Function/Subroutine Documentation πŸ¦‹

subroutine sgetri (integer n, real, dimension( lda, * ) a, integer lda, integer, dimension( * ) ipiv, real, dimension( * ) work, integer lwork, integer info)

SGETRI β€” literally her name, spelled out twice because she's that iconic πŸŽ€

πŸ’– Purpose πŸ’–

so here's the tea, in the original's own framing:

!>
!> SGETRI computes the inverse of a matrix using the LU factorization
!> computed by SGETRF.
!>
!> This method inverts U and then computes inv(A) by solving the system
!> inv(A)*L = inv(U) for inv(A).
!>

like, you already did the work with SGETRF β€” this just finishes the job. it flips U, then solves inv(A)*L = inv(U) to get inv(A). she's giving "second half of a two-part episode" and honestly it ate πŸ”₯

⭐ Parameters ⭐

  • N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!>

the order of the matrix A, and bestie she has standards: N >= 0. no negatives, no drama, periodt.

  • A
!>          A is REAL array, dimension (LDA,N)
!>          On entry, the factors L and U from the factorization
!>          A = P*L*U as computed by SGETRF.
!>          On exit, if INFO = 0, the inverse of the original matrix A.
!>

a REAL array sized (LDA,N), and it's basically a glow-up transformation πŸ’« on entry it's holding the factors L and U from A = P*L*U (as computed by SGETRF), and on exit, if INFO = 0, it's the inverse of the original matrix A. same array, whole new era. main character energy fr.

  • LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!>

the leading dimension of the array A, and the vibe check is LDA >= max(1,N) 🫢

  • IPIV
!>          IPIV is INTEGER array, dimension (N)
!>          The pivot indices from SGETRF; for 1<=i<=N, row i of the
!>          matrix was interchanged with row IPIV(i).
!>

an INTEGER array sized (N) holding the pivot indices from SGETRF β€” for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i). she keeps receipts of every swap πŸ‘€

  • WORK
!>          WORK is REAL array, dimension (MAX(1,LWORK))
!>          On exit, if INFO=0, then WORK(1) returns the optimal LWORK.
!>

a REAL array sized (MAX(1,LWORK)), and on exit, if INFO=0, WORK(1) hands you back the optimal LWORK. she's a workspace and a messenger 🧚

  • LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK.  LWORK >= max(1,N).
!>          For optimal performance LWORK >= N*NB, where NB is
!>          the optimal blocksize returned by ILAENV.
!>
!>          If LWORK = -1, then a workspace query is assumed; the routine
!>          only calculates the optimal size of the WORK array, returns
!>          this value as the first entry of the WORK array, and no error
!>          message related to LWORK is issued by XERBLA.
!>

an INTEGER, the dimension of the array WORK. minimum is LWORK >= max(1,N), but for optimal performance you want LWORK >= N*NB, where NB is the optimal blocksize returned by ILAENV πŸ’…

and here's the special trick: if LWORK = -1, a workspace query is assumed πŸͺ„ the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. so like, don't panic when nothing yells at you, that's the whole point.
  • INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>          > 0:  if INFO = i, U(i,i) is exactly zero; the matrix is
!>                singular and its inverse could not be computed.
!>

an INTEGER and the ultimate vibe report:

  • = 0: successful exit πŸŽ‰ she did it
  • < 0: if INFO = -i, the i-th argument had an illegal value πŸ™ˆ
  • > 0: if INFO = i, U(i,i) is exactly zero β€” the matrix is singular and its inverse could not be computed πŸ’€ no inverse for you, it's giving undefined and honestly, respect the boundary.

πŸ‘‘ Author πŸ‘‘

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

four absolute legends, we stan 🌈

Definition at line 113 of file sgetri.f. yes, exactly line 113, don't @ me πŸ“


πŸ“ Author πŸ“

this page was generated automatically by Doxygen for LAPACK from the source code β€” so like, a robot wrote the layout but the math is all human genius πŸŽ€


okay that's the whole page, bestie, you're officially caught up. go forth and invert responsibly πŸ’œ

LAPACK β€” Version 3.12.0 Β· SRC/sgetri.f(3) Β· mwah, thanks for reading, ily, bye 🫢✨

πŸ“¦ where this page comes from