ggbal(3)
π NAME π
ggbal β balance matrix
β¨ SYNOPSIS β¨
Functions
subroutine cggbal (job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)β CGGBALsubroutine dggbal (job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)β DGGBALsubroutine sggbal (job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)β SGGBALsubroutine zggbal (job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)β ZGGBAL
π Detailed Description π
okay so this page is literally the glow-up guide for balancing a pair of general matrices β the routines are cggbal, dggbal, sggbal, and zggbal, and they live in the Function Documentation section below. β¨
πΈ Function Documentation πΈ
π¦ subroutine cggbal (character job, integer n, complex, dimension( lda, * ) a, integer lda, complex, dimension( ldb, * ) b, integer ldb, integer ilo, integer ihi, real, dimension( * ) lscale, real, dimension( * ) rscale, real, dimension( * ) work, integer info) π¦
CGGBAL
Purpose
okay so CGGBAL balances a pair of general complex matrices (A,B). First it permutes A and B by similarity transformations to isolate eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements on the diagonal; then it applies a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional, bestie. β¨ Balancing may reduce the 1-norm of the matrices and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x. π
Parameters
JOBβJOBisCHARACTER*1. Specifies the operations to be performed onAandB:= 'N': none: simply set ILO = 1, IHI = N, LSCALE(I) = 1.0 and RSCALE(I) = 1.0 for i=1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβNisINTEGER. The order of the matricesAandB.N >= 0.AβAisCOMPLEX array, dimension (LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβBisCOMPLEX array, dimension (LDB,N). On entry, the input matrixB. On exit,Bis overwritten by the balanced matrix. IfJOB = 'N',Bis not referenced.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).ILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.LSCALEβLSCALEisREAL array, dimension (N). Details of the permutations and scaling factors applied to the left side ofAandB. IfP(j)is the index of the row interchanged with rowj, andD(j)is the scaling factor applied to rowj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
RSCALEβRSCALEisREAL array, dimension (N). Details of the permutations and scaling factors applied to the right side ofAandB. IfP(j)is the index of the column interchanged with columnj, andD(j)is the scaling factor applied to columnj, then:
RSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
WORKβWORKisREAL array, dimension (lwork).lworkmust be at leastmax(1,6*N)whenJOB = 'S'or'B', and at least1whenJOB = 'N'or'P'.INFOβINFOisINTEGER.= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
See R.C. WARD, Balancing the generalized eigenvalue problem, SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
Definition at line 175 of file cggbal.f.
π¦ subroutine dggbal (character job, integer n, double precision, dimension( lda, * ) a, integer lda, double precision, dimension( ldb, * ) b, integer ldb, integer ilo, integer ihi, double precision, dimension( * ) lscale, double precision, dimension( * ) rscale, double precision, dimension( * ) work, integer info) π¦
DGGBAL
Purpose
okay so DGGBAL balances a pair of general real matrices (A,B). First it permutes A and B by similarity transformations to isolate eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements on the diagonal; then it applies a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional, bestie. β¨ Balancing may reduce the 1-norm of the matrices and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x. π
Parameters
JOBβJOBisCHARACTER*1. Specifies the operations to be performed onAandB:= 'N': none: simply set ILO = 1, IHI = N, LSCALE(I) = 1.0 and RSCALE(I) = 1.0 for i = 1,...,N.= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβNisINTEGER. The order of the matricesAandB.N >= 0.AβAisDOUBLE PRECISION array, dimension (LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced.LDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβBisDOUBLE PRECISION array, dimension (LDB,N). On entry, the input matrixB. On exit,Bis overwritten by the balanced matrix. IfJOB = 'N',Bis not referenced.LDBβLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).ILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.LSCALEβLSCALEisDOUBLE PRECISION array, dimension (N). Details of the permutations and scaling factors applied to the left side ofAandB. IfP(j)is the index of the row interchanged with rowj, andD(j)is the scaling factor applied to rowj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
RSCALEβRSCALEisDOUBLE PRECISION array, dimension (N). Details of the permutations and scaling factors applied to the right side ofAandB. IfP(j)is the index of the column interchanged with columnj, andD(j)is the scaling factor applied to columnj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
WORKβWORKisDOUBLE PRECISION array, dimension (lwork).lworkmust be at leastmax(1,6*N)whenJOB = 'S'or'B', and at least1whenJOB = 'N'or'P'.INFOβINFOisINTEGER.= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details
See R.C. WARD, Balancing the generalized eigenvalue problem, SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
Definition at line 175 of file dggbal.f.
π¦ subroutine sggbal (character job, integer n, real, dimension( lda, * ) a, integer lda, real, dimension( ldb, * ) b, integer ldb, integer ilo, integer ihi, real, dimension( * ) lscale, real, dimension( * ) rscale, real, dimension( * ) work, integer info) π¦
SGGBAL
Purpose
(SGGBAL's purpose and parameters continue in part 2 β stay tuned, bestie! π)
...and that's the why, bestie. Let me hit you with the payoff: balancing may reduce the 1-norm of the matrices, and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x. β¨ Like, that's the whole point. That's the glow-up. π
π Parameters π
JOBβCHARACTER*1. Specifies the operations to be performed onAandB:= 'N': none: simply setILO = 1,IHI = N,LSCALE(I) = 1.0andRSCALE(I) = 1.0fori = 1,...,N.= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβINTEGER. The order of the matricesAandB.N >= 0. (Yes, zero is allowed, she's chill like that. π«Ά)AβREAL array, dimension (LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced. π«LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβREAL array, dimension (LDB,N). On entry, the input matrixB. On exit,Bis overwritten by the balanced matrix. IfJOB = 'N',Bis not referenced. π«LDBβINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).ILOβINTEGER. (she's an output girlie, just vibing until the routine fills her in π)IHIβINTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.LSCALEβREAL array, dimension (N). Details of the permutations and scaling factors applied to the left side ofAandB. IfP(j)is the index of the row interchanged with rowj, andD(j)is the scaling factor applied to rowj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1. π (order matters, don't @ me)
RSCALEβREAL array, dimension (N). Details of the permutations and scaling factors applied to the right side ofAandB. IfP(j)is the index of the column interchanged with columnj, andD(j)is the scaling factor applied to columnj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1. π
Ok real talk β yes, that second block literally saysLSCALE(j)in the docs even though it's theRSCALEsection. That's how it's written in the source page, so I'm not touching it. Not my typo, not my problem, we reproduce faithfully in this house. π
WORKβREAL array, dimension (lwork).lworkmust be at leastmax(1,6*N)whenJOB = 'S'or'B', and at least1whenJOB = 'N'or'P'. Size your scratch space accordingly, she is not flexible about this. π€INFOβINTEGER:= 0: successful exit π< 0: ifINFO = -i, thei-th argument had an illegal value. π¨
πΈ Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ Further Details π¦
See R.C. WARD, Balancing the generalized eigenvalue problem, SIAM J. Sci. Stat. Comp. 2 (1981), 141-152. π
Definition at line 175 of file sggbal.f.
π ZGGBAL π
Ok so now the complex version, and honestly she ate. Same energy, fancy numbers. Here's the signature in all her glory:
subroutine zggbal (character job, integer n, complex*16, dimension( lda, * )
a, integer lda, complex*16, dimension( ldb, * ) b, integer ldb, integer
ilo, integer ihi, double precision, dimension( * ) lscale, double
precision, dimension( * ) rscale, double precision, dimension( * ) work,
integer info)
β¨ Purpose β¨
ZGGBAL balances a pair of general complex matrices (A,B). This involves, first, permuting A and B by similarity transformations to isolate eigenvalues in the first 1 to ILO$-$1 and last IHI+1 to N elements on the diagonal; and second, applying a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional. π
Balancing may reduce the 1-norm of the matrices, and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x. Same deal as her real sister, just with COMPLEX*16 energy. π
π Parameters π
JOBβCHARACTER*1. Specifies the operations to be performed onAandB:= 'N': none: simply setILO = 1,IHI = N,LSCALE(I) = 1.0andRSCALE(I) = 1.0fori=1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβINTEGER. The order of the matricesAandB.N >= 0.AβCOMPLEX*16 array, dimension (LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced.LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβCOMPLEX*16 array, dimension (LDB,N). On entry, the input matrixB. On exit,Bis overwritten by the balanced matrix. IfJOB = 'N',Bis not referenced.LDBβINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).ILOβINTEGER.IHIβINTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.LSCALEβDOUBLE PRECISION array, dimension (N). Details of the permutations and scaling factors applied to the left side ofAandB. IfP(j)is the index of the row interchanged with rowj, andD(j)is the scaling factor applied to rowj, then:
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
RSCALEβDOUBLE PRECISION array, dimension (N). Details of the permutations and scaling factors applied to the right side ofAandB. IfP(j)is the index of the column interchanged with columnj, andD(j)is the scaling factor applied to columnj, then:
RSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1. (And yes, this one says RSCALE(j) properly β the complex girlie got it right. π)
WORKβDOUBLE PRECISION array, dimension (lwork).lworkmust be at leastmax(1,6*N)whenJOB = 'S'or'B', and at least1whenJOB = 'N'or'P'.INFOβINTEGER:= 0: successful exit β¨< 0: ifINFO = -i, thei-th argument had an illegal value. π¨
πΈ Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π¦ Further Details π¦
See R.C. WARD, Balancing the generalized eigenvalue problem, SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
Definition at line 175 of file zggbal.f.
π Author π
Generated automatically by Doxygen for LAPACK from the source code. π€ (the robots did the paperwork, we just vibe)
aaand that's the whole page, bestie, you made it to the end!! π₯³π This was ggbal(3) from LAPACK, Version 3.12.0 β go balance something iconic, mwah π
β¨π¦
π¦ 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