SRC/slaqp2rk.f(3)
π NAME π
SRC/slaqp2rk.f β okay bestie, this is a <pink>Library Functions Manual</pink> situation, and the star of the show is literally a Fortran subroutine living its best life in SRC/slaqp2rk.f. Periodt.
β¨ SYNOPSIS β¨
π¦ Functions/Subroutines
subroutine slaqp2rk (m, n, nrhs, ioffset, kmax, abstol, reltol, kp1,
maxc2nrm, a, lda, k, maxc2nrmk, relmaxc2nrmk, jpiv, tau, vn1, vn2,
work, info)
So what does it do? SLAQP2RK computes a truncated QR factorization with column pivoting of a real matrix block using Level 2 BLAS, and overwrites a real m-by-nrhs matrix B with Q**T * B. That's the whole vibe. π«Ά
π Function/Subroutine Documentation π
subroutine slaqp2rk (integer m, integer n, integer nrhs, integer ioffset,
integer kmax, real abstol, real reltol, integer kp1, real maxc2nrm,
real, dimension( lda, * ) a, integer lda, integer k, real maxc2nrmk,
real relmaxc2nrmk, integer, dimension( * ) jpiv, real, dimension( * )
tau, real, dimension( * ) vn1, real, dimension( * ) vn2, real,
dimension( * ) work, integer info)
SLAQP2RK computes truncated QR factorization with column pivoting of a real matrix block using Level 2 BLAS and overwrites a real m-by-nrhs matrix B with Q**T * B. Same energy as the synopsis, just wearing its full signature. π
πΈ Purpose
Okay so, the actual purpose β she's computing a truncated (rank K) or full rank Householder QR factorization with column pivoting of a real matrix block A(IOFFSET+1:M,1:N) like this:
A * P(K) = Q(K) * R(K).
The routine uses Level 2 BLAS. The block A(1:IOFFSET,1:N) is accordingly pivoted, but not factorized. Lowkey important distinction, don't skip it. π
The routine also overwrites the right-hand-sides matrix block B stored in A(IOFFSET+1:M,N+1:N+NRHS) with Q(K)**T * B. Slay.
π Parameters π
π M
M is INTEGER. The number of rows of the matrix A. M >= 0. That's it, that's the whole job.
π N
N is INTEGER. The number of columns of the matrix A. N >= 0. Iconic, no notes.
π NRHS
NRHS is INTEGER. The number of right hand sides β i.e., the number of columns of the matrix B. NRHS >= 0.
π IOFFSET
IOFFSET is INTEGER. The number of rows of the matrix A that must be pivoted but not factorized. IOFFSET >= 0.
IOFFSET also represents the number of columns of the whole original matrix A_orig that have been factorized in the previous steps. So she's carrying history, main character energy fr. π
π KMAX
KMAX is INTEGER.
The first factorization stopping criterion. KMAX >= 0.
It's the maximum number of columns of the matrix A to factorize β i.e., the maximum factorization rank.
- a) If
KMAX >= min(M-IOFFSET,N), then this stopping criterion is not used, and you factorize columns depending onABSTOLandRELTOL. - b) If
KMAX = 0, then this stopping criterion is satisfied on input and the routine exits immediately. That means the factorization is not performed, and the matricesAandBand the arraysTAU,IPIVare not modified.
Like, she literally leaves without touching anything. Respect the boundaries. π
π ABSTOL
ABSTOL is DOUBLE PRECISION, and cannot be NaN.
The second factorization stopping criterion. It's the absolute tolerance (stopping threshold) for the maximum column 2-norm of the residual matrix. The algorithm converges (stops the factorization) when the maximum column 2-norm of the residual matrix is less than or equal to ABSTOL.
- a) If
ABSTOL < 0.0, then this stopping criterion is not used, and the routine factorizes columns depending onKMAXandRELTOL. This includes the caseABSTOL = -Inf. - b) If
0.0 <= ABSTOL, then the input value ofABSTOLis used.
π RELTOL
RELTOL is DOUBLE PRECISION, and cannot be NaN.
The third factorization stopping criterion. It's the tolerance (stopping threshold) for the ratio of the maximum column 2-norm of the residual matrix to the maximum column 2-norm of the original matrix A_orig. The algorithm converges (stops the factorization) when this ratio is less than or equal to RELTOL.
- a) If
RELTOL < 0.0, then this stopping criterion is not used, and the routine factorizes columns depending onKMAXandABSTOL. This includes the caseRELTOL = -Inf. - d) If
0.0 <= RELTOL, then the input value ofRELTOLis used.
Yes, the list goes a) then d). She skipped the middle letters, we don't ask questions, we just vibe. π§
π KP1
KP1 is INTEGER. The index of the column with the maximum 2-norm in the whole original matrix A_orig, determined in the main routine SGEQP3RK. 1 <= KP1 <= N_orig_mat.
π MAXC2NRM
MAXC2NRM is DOUBLE PRECISION. The maximum column 2-norm of the whole original matrix A_orig, computed in the main routine SGEQP3RK. MAXC2NRM >= 0.
π A
A is REAL array, dimension (LDA,N+NRHS).
On entry, it's the M-by-N matrix A and M-by-NRHS matrix B, as in:
N NRHS
array_A = M [ mat_A, mat_B ]
On exit, bestie, it's a whole situation:
- The elements in block
A(IOFFSET+1:M,1:K)below the diagonal together with the arrayTAUrepresent the orthogonal matrixQ(K)as a product of elementary reflectors. - The upper triangular block of the matrix
Astored inA(IOFFSET+1:M,1:K)is the triangular factor obtained. - The block of the matrix
Astored inA(1:IOFFSET,1:N)has been accordingly pivoted, but not factorized. - The rest of the array
A, blockA(IOFFSET+1:M,K+1:N+NRHS). The left partA(IOFFSET+1:M,K+1:N)of this block contains the residual of the matrixA, and, ifNRHS > 0, the right part of the blockA(IOFFSET+1:M,N+1:N+NRHS)contains the block of the right-hand-side matrixB. Both these blocks have been updated by multiplication from the left byQ(K)**T.
π LDA
LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
π K
K is INTEGER. Factorization rank of the matrix A β i.e., the rank of the factor R, which is the same as the number of non-zero rows of the factor R. 0 <= K <= min(M-IOFFSET,KMAX,N).
K also represents the number of non-zero Householder vectors. Multi-tasking queen. β¨
π MAXC2NRMK
MAXC2NRMK is DOUBLE PRECISION. The maximum column 2-norm of the residual matrix, when the factorization stopped at rank K. MAXC2NRMK >= 0.
π RELMAXC2NRMK
RELMAXC2NRMK is DOUBLE PRECISION. The ratio MAXC2NRMK / MAXC2NRM of the maximum column 2-norm of the residual matrix (when the factorization stopped at rank K) to the maximum column 2-norm of the whole original matrix A. RELMAXC2NRMK >= 0.
π JPIV
JPIV is INTEGER array, dimension (N). Column pivot indices β for 1 <= j <= N, column j of the matrix A was interchanged with column JPIV(j).
π TAU
TAU is REAL array, dimension (min(M-IOFFSET,N)). The scalar factors of the elementary reflectors.
π VN1
VN1 is REAL array, dimension (N). The vector with the partial column norms.
π VN2
VN2 is REAL array, dimension (N). The vector with the exact column norms. (Yes, she's the precise one. We stan. π)
π WORK
WORK is REAL array, dimension (N-1). Used in the SLARF1F subroutine to apply an elementary reflector from the left.
π INFO
INFO is INTEGER, and she has lore:
INFO = 0: successful exit. π- If
INFO = j_1, where1 <= j_1 <= N, thenNaNwas detected and the routine stops the computation. Thej_1-th column of the matrixAor thej_1-th element of arrayTAUcontains the first occurrence ofNaNin the factorization stepK+1(whenKcolumns have been factorized).
On exit:
Kis set to the number of factorized columns without exception.MAXC2NRMKis set toNaN.RELMAXC2NRMKis set toNaN.TAU(K+1:min(M,N))is not set and contains undefined elements. Ifj_1=K+1,TAU(K+1)may containNaN.
- If
INFO = j_2, whereN+1 <= j_2 <= 2*N, then noNaNwas detected, but+Inf(or-Inf) was detected and the routine continues the computation until completion. The(j_2-N)-th column of the matrixAcontains the first occurrence of+Inf(or-Inf) in the factorization stepK+1(whenKcolumns have been factorized).
Case 2 is giving "we found a NaN and we're stopping right here", case 3 is giving "we found an infinity but we're seeing this through". Both are valid. π
<!-- part 1 continues in part 2, no sign-off, keep reading bestie -->
Okay so reference [2] is the receipts moment for the partial column norm updating strategy: A partial column norm updating strategy developed in 2006. By Z. Drmac and Z. Bujanovic, Dept. of Math., University of Zagreb, Croatia. The paper title is On the failure of rank revealing QR factorization software β a case study. Itβs LAPACK Working Note 176. and in ACM Trans. Math. Softw. 35, 2, Article 12 (July 2008), 28 pages. No cap, that citation is doing the most and we respect it π
β¨
π«Ά Contributors π«Ά
These are the literal source-comment lines, kept exactly as they appear:
!>
!> November 2023, Igor Kozachenko, James Demmel,
!> EECS Department,
!> University of California, Berkeley, USA.
!>
!>
And the page pins it down right here: Definition at line 340 of file slaqp2rk.f.
π Author π
This page? Generated automatically by Doxygen for LAPACK from the source code. Iconic automated behavior, honestly π
And thatβs the whole page, bestie: source SRC/slaqp2rk.f(3), LAPACK Version 3.12.0. The footer doesnβt hand us a date, so no invented timestamp β we stay accurate, 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