gebal(3)
π gebal(3) β the balance-your-matrix glow-up π
okay so bestie, welcome to gebal from the Library Functions Manual. this is the page where a general matrix gets its whole life together: eigenvalues isolated, rows and columns brought into harmony, the works. it's giving makeover montage but for linear algebra β¨
π NAME π
gebal β gebal: balance matrix. that's it, that's the whole name section. short, sweet, iconic.
β¨ SYNOPSIS β¨
π«Ά Functions
subroutine cgebal (job, n, a, lda, ilo, ihi, scale, info)β CGEBALsubroutine dgebal (job, n, a, lda, ilo, ihi, scale, info)β DGEBALsubroutine sgebal (job, n, a, lda, ilo, ihi, scale, info)β SGEBALsubroutine zgebal (job, n, a, lda, ilo, ihi, scale, info)β ZGEBAL
four flavors, same vibe. one for each of your favorite precisions/types, no cap π¦
π¦ Detailed Description π¦
so like, the headline: balancing a matrix can reduce the 1-norm of that matrix, and it can also improve the accuracy of the eigenvalues and/or eigenvectors you compute from it. that's the whole point, that's the moment, that's the arc π«Ά
π₯ Function Documentation π₯
π©· subroutine cgebal (character job, integer n, complex, dimension( lda, * ) a, integer lda, integer ilo, integer ihi, real, dimension( * ) scale, integer info)
π CGEBAL π
Purpose:
bestie, CGEBAL balances a general complex matrix A. and it does it in two whole steps, both of which are optional, because options are everything π
- permuting
Aby a similarity transformation, so the eigenvalues get isolated in the first1toILO-1and the lastIHI+1toNelements on the diagonal. - scaling β applying a diagonal similarity transformation to rows and columns
ILOtoIHI, to make the rows and columns as close in norm as possible. the way it just evens everything out, honestly obsessed β¨
and yeah β Balancing may reduce the 1-norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors. both of those, at the same time. main character behavior fr fr.
Parameters
JOBβJOBisCHARACTER*1. it picks which operations get performed onA:= 'N': none: simply setILO = 1,IHI = N,SCALE(I) = 1.0fori = 1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβNisINTEGER. the order of the matrixA. and it has to beN >= 0. yes, zero counts, she's inclusive πAβAisCOMPLEXarray, dimension(LDA,N). on entry, the input matrixA. on exit,Ais overwritten by the balanced matrix. ifJOB = 'N', thenAis literally not referenced at all. check Further Details below for the full tea πLDAβLDAisINTEGER. the leading dimension of the arrayA. requirement:LDA >= max(1,N). don't skip this, it will matter πILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHIget set to integers such that on exit,A(i,j) = 0ifi > jandj = 1,...,ILO-1orI = IHI+1,...,N. and ifJOB = 'N'or'S', thenILO = 1andIHI = N. noted π«‘SCALEβSCALEisREALarray, dimension(N). all the details of the permutations and scaling factors that got applied toA. so ifP(j)is the index of the row and column interchanged with row and columnj, andD(j)is the scaling factor applied to row and columnj, then:
SCALE(j) = P(j) for j = 1,...,ILO-1
= D(j) for j = ILO,...,IHI
= P(j) for j = IHI+1,...,N.
also, the order in which the interchanges are made is N to IHI+1, and then 1 to ILO-1. order matters, bestie, it always does π
INFOβINFOisINTEGER:= 0: successful exit. slay π< 0: ifINFO = -i, thei-th argument had an illegal value. not slay π
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
okay so the permutations are row and column interchanges that put the matrix into this exact shape:
( T1 X Y )
P A P = ( 0 B Z )
( 0 0 T2 )
where T1 and T2 are upper triangular matrices whose eigenvalues lie right along the diagonal. and the column indices ILO and IHI mark the starting and ending columns of the submatrix B. π
Balancing itself consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1-norms of each row of B and its corresponding column nearly equal. so the output matrix is literally:
( T1 X*D Y )
( 0 inv(D)*B*D inv(D)*Z )
( 0 0 T2 )
and all the info about the permutations P and the diagonal matrix D comes back to you in the vector SCALE. cute, right? π¦
This subroutine is based on the EISPACK routine CBAL.
Modified by Tzu-Yi Chen, Computer Science Division, University of California at Berkeley, USA
Refactored by Evert Provoost, Department of Computer Science, KU Leuven, Belgium
Definition at line 164 of file cgebal.f.
π subroutine dgebal (character job, integer n, double precision, dimension( lda, * ) a, integer lda, integer ilo, integer ihi, double precision, dimension( * ) scale, integer info)
π DGEBAL π
Purpose:
DGEBAL balances a general real matrix A. same two-step routine as always, bestie:
- permuting
Aby a similarity transformation to isolate eigenvalues in the first1toILO-1and lastIHI+1toNelements on the diagonal. - applying a diagonal similarity transformation to rows and columns
ILOtoIHIto make the rows and columns as close in norm as possible.
Both steps are optional β again, options are the moment β¨
Balancing may reduce the 1-norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors. same iconic promise, real-number edition.
Parameters
JOBβJOBisCHARACTER*1. specifies which operations happen toA:= 'N': none: simply setILO = 1,IHI = N,SCALE(I) = 1.0fori = 1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβNisINTEGER. the order of the matrixA.N >= 0.AβAisDOUBLE PRECISIONarray, dimension(LDA,N). on entry, the input matrixA. on exit,Ais overwritten by the balanced matrix. ifJOB = 'N',Ais not referenced. See Further Details πLDAβLDAisINTEGER. the leading dimension of the arrayA.LDA >= max(1,N).ILOβILOisINTEGER.IHIβIHIisINTEGER.ILOandIHIare set to integers such that on exitA(i,j) = 0ifi > jandj = 1,...,ILO-1orI = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.SCALEβSCALEisDOUBLE PRECISIONarray, dimension(N). details of the permutations and scaling factors applied toA. IfP(j)is the index of the row and column interchanged with row and columnjandD(j)is the scaling factor applied to row and columnj, then:
SCALE(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 <blue>N to IHI+1, then <blue>1 to ILO-1. keep that order, i'm begging π₯Ί
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:
the permutations consist of row and column interchanges which put the matrix in the form:
( T1 X Y )
P A P = ( 0 B Z )
( 0 0 T2 )
where T1 and T2 are upper triangular matrices whose eigenvalues lie along the diagonal. the column indices ILO and IHI mark the starting and ending columns of the submatrix B. Balancing consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1-norms of each row of B and its corresponding column nearly equal. and the output matrix is:
( T1 X*D Y )
( 0 inv(D)*B*D inv(D)*Z )
( 0 0 T2 )
information about the permutations P and the diagonal matrix D is returned in the vector SCALE. π«Ά
This subroutine is based on the EISPACK routine BALANC. (note: BALANC, not CBAL β different ancestor, different lore, iykyk)
Modified by Tzu-Yi Chen, Computer Science Division, University of California at Berkeley, USA
Refactored by Evert Provoost, Department of Computer Science, KU Leuven, Belgium
Definition at line 162 of file dgebal.f.
π©΅ subroutine sgebal (character job, integer n, real, dimension( lda, * ) a, integer lda, integer ilo, integer ihi, real, dimension( * ) scale, integer info)
π©΅ SGEBAL π©΅
Purpose:
SGEBAL balances a general real matrix A. you already know the drill, but here it is again because consistency is queen π
- permuting
Aby a similarity transformation to isolate eigenvalues in the first1toILO-1and lastIHI+1toNelements on the diagonal; - and second, applying a diagonal similarity transformation to rows and columns
ILOtoIHIto make the rows and columns as close in norm as possible.
Both steps are optional. Both. Steps. Optional. π
Balancing may reduce the 1-norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors. yes bestie, it really said that.
Parameters
JOBβJOBisCHARACTER*1. specifies the operations to be performed onA:= 'N': none: simply setILO = 1,IHI = N,SCALE(I) = 1.0fori = 1,...,N;= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβNisINTEGER. The order of the matrixA.N >= 0.AβAisREALarray, dimension(LDA,N). On entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced. See Further Details πΈLDAβLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).ILOβILOisINTEGER.
β¦and this is exactly the spot where part 2 swoops in, so don't you dare close the tab π§ββοΈπ
ILOisINTEGERβ that's the whole note, bestie: it's an integer πIHIisINTEGERβILOandIHIare set to integers such that on exitA(i,j) = 0ifi > jandj = 1,...,ILO-1orI = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = Nβ¨SCALEisREALarray, dimension(N)β this is where the deets of the permutations and scaling factors applied toAlive. IfP(j)is the index of the row and column interchanged with row and columnj, andD(j)is the scaling factor applied to row and columnj, then:
SCALE(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 π
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:
The permutations consist of row and column interchanges which put the matrix in the form
( T1 X Y )
P A P = ( 0 B Z )
( 0 0 T2 )
where T1 and T2 are upper triangular matrices whose eigenvalues lie along the diagonal. The column indices ILO and IHI mark the starting and ending columns of the submatrix B. Balancing consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1-norms of each row of B and its corresponding column nearly equal. The output matrix is
( T1 X*D Y )
( 0 inv(D)*B*D inv(D)*Z ).
( 0 0 T2 )
Information about the permutations P and the diagonal matrix D is returned in the vector SCALE π«Ά
This subroutine is based on the EISPACK routine BALANC.
Modified by Tzu-Yi Chen, Computer Science Division, University of California at Berkeley, USA
Refactored by Evert Provoost, Department of Computer Science, KU Leuven, Belgium
Definition at line 162 of file sgebal.f.
π subroutine zgebal β the complex*16 edition, bestie β¨
subroutine zgebal (character job, integer n, complex*16, dimension( lda, * )
a, integer lda, integer ilo, integer ihi, double precision, dimension( *
) scale, integer info)
ZGEBAL
π― Purpose:
ZGEBAL balances a general complex matrix A. This involves, first, permuting A by a similarity transformation 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 matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors. iconic behavior, honestly π
π§© Parameters
JOBisCHARACTER*1β specifies the operations to be performed onA:'N': none: simply setILO = 1,IHI = N,SCALE(I) = 1.0fori = 1,...,N;'P': permute only;'S': scale only;'B': both permute and scale.
NisINTEGERβ the order of the matrixA.N >= 0.AisCOMPLEX*16array, dimension(LDA,N)β on entry, the input matrixA. On exit,Ais overwritten by the balanced matrix. IfJOB = 'N',Ais not referenced. See Further Details πLDAisINTEGERβ the leading dimension of the arrayA.LDA >= max(1,N).ILOisINTEGERβ yes bestie, an integer πIHIisINTEGERβILOandIHIare set to integers such that on exitA(i,j) = 0ifi > jandj = 1,...,ILO-1orI = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = Nβ¨SCALEisDOUBLE PRECISIONarray, dimension(N)β details of the permutations and scaling factors applied toA. IfP(j)is the index of the row and column interchanged with row and columnj, andD(j)is the scaling factor applied to row and columnj, then:
SCALE(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 π
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:
The permutations consist of row and column interchanges which put the matrix in the form
( T1 X Y )
P A P = ( 0 B Z )
( 0 0 T2 )
where T1 and T2 are upper triangular matrices whose eigenvalues lie along the diagonal. The column indices ILO and IHI mark the starting and ending columns of the submatrix B. Balancing consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1-norms of each row of B and its corresponding column nearly equal. The output matrix is
( T1 X*D Y )
( 0 inv(D)*B*D inv(D)*Z ).
( 0 0 T2 )
Information about the permutations P and the diagonal matrix D is returned in the vector SCALE π«Ά
This subroutine is based on the EISPACK routine CBAL.
Modified by Tzu-Yi Chen, Computer Science Division, University of California at Berkeley, USA
Refactored by Evert Provoost, Department of Computer Science, KU Leuven, Belgium
Definition at line 164 of file zgebal.f.
π§ Author
Generated automatically by Doxygen for LAPACK from the source code.
okay that's a wrap on gebal(3), bestie π the footer credits LAPACK Version 3.12.0 and this page is gebal(3); the date slot is literally not in that footer line, so no made-up date from me π«Άβ¨
π¦ 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