You are on page 1of 11

Matrix b a n d w i d t h minimization

by R I C H A R D ROSEN
Mechanics Research, Inc.
Los Angeles, California

INTRODUCTION The program first determines the actual bandwidth


of the original system. The nodes that cause the actual
In the analysis of a structural problem by the finite
bandwith are inspected to see if a single interchange
element method, a large order stiffness matrix is created
between those nodes and any other nodes will serve to
which describes mathematically the inter-connectivity
reduce the bandwidth. When such a favorable inter-
of the system.
change is encountered, a row and column transforma-
The structure is defined in three dimensional space by
tion is effected and the particular interchange is re-
discrete points called nodes. Each node is represented
corded in the table. At this point, a new determination
by its coordinates in the space. The nodes are then
of the bandwidth is made and the search is repeated.
connected by the various finite elements that the par-
This reduction is made and the search is repeated.
ticular computer program may utilize. (i.e., bar mem-
This reduction is continued until there are no further
bers, rectangular or triangular panels, three dimen-
interchanges which will reduce the bandwidth. At this
sional tetrahedrons, etc.)
point the interchange table is inspected and the revised
The stiffness matrix which is formulated from this
numbering system is determined.
geometric arrangement provides a direct picture of
the nodal connectivity. Any pair of nodes which are Illustrative Example
tied together by a finite element will produce non-
zero terms in the off-diagonal elements representing To illustrate the concept consider the ring frame in
the interaction of these two nodes. The numbering Figure 1.
of these nodes is arbitrary although normally the
engineer should attempt to minimize the resulting
matrix bandwidth. This is done because matrix decom-
position routines consider only those portions of the
matrix that lie in the banded section. A reduction in
the matrix bandwidth will significantly decrease the
computational time for the matrix decomposition.
The use of the computer has permitted the solution
of problems involving matrices which are in the order
of thousands. The engineer modeling these very com-
plex three dimensional problems can not properly
arrive at the nodal numbering system which would
result in a matrix of minimum bandwidth. The com-
puter program presented in this paper will accept
as input data the original numbering system and will
compute a new nodal numbering scheme that will
reduce the matrix bandwidth. Figure l--Ring Frame Original Number System.

MATRIX BANDWIDTH MINIMIZATION


The nodal interconnectivity matrix is described as The frame is defined by nine nodes in space. The
a matrix of zeros and ones where one implies node interconnectivity as shown in Figure 1 is depicted
connectivity and zero implies no node connectivity. in matrix form as:
585
586 Proceedings--1968 ACM National Conference

® ® ® ® ® ® ® ® ® ® ® ® ® ® ® ® ® ®

® 1 1 1 ® 1 1 1

® 1 1 1 ® 1 1
ll
® 1 1 1 ® 1 1
II
® 1 1 1 ® 1
II I

® 1 1 I ® 1
II I

® 1 I I ®
II I I

® I I I ® II I I

® I I ® I I I

® I ® I I I

T H E ROW A N D C O L U M N I N T E R C H A N G E
The concept behind the matrix bandwidth minimi-
zation is the interchanging of any two nodes in the
The original bandwidth of this matrix is nine. Upon spacial configuration to achieve a reduction in the
applying the renumbering logic to this system the matrix bandwidth. The matrix in question is related
configuration in Figure 2 will be obtained with a to a system of simultaneous linear equations of the
final bandwidth of three. form
[K] {8} = IF} (0
where
[K ] = matrix whose bandwidth is to be reduced.
(this is an n × n matrix describing the
interconnectivity of n special nodes)
{8} = vector listing certain nodal properties
(these usually are displacements).
{F~ = vector listing other nodal properties
(these usually are applied forces).
When the node numbers of two nodes are to be in-
terchanged, this changes the order in which their
respective equatiorrs appear in the matrix as well as
interchanging columns defining the coefficient of the
variables in the { 8 ] matrix. The transformation may
be characterized by t h e [ C ] m a t r i x . If it is desired to
interchange the i th node with the j: n' node then the
Figure 2-Ring Frame Revised Number System. [ C ] matrix is defined by
Ckk = 1 k ~ i, j
Cij = 1 a n d Cji = 1
with all other elements equal to zero.
Hence
[ Clr = [ C l-' = [ C] (2)
The interconnectivity matrix for the revised numbering It is convenient to keep as a reference the original
scheme is: numbering system throughout the entire procedure
Matrix Bandwidth M i n i m i z a t i o n 587

and merely examine the changes in the[K]matrix as the


l "- V i*
transformations are performed. In terms of the original
numbering system, the reordered vectors may be repre- and ., ,
j = vy
sented as
thus Kij D Ki*j *
18}, = [ c], t8} Since the matrices considered here are symmetrical it
{F}, = [ C ], {F} (3) is desirable to only work with the upper or lower
A substitution of Equation (3) into equation (1)yields triangular portion rather than the full matrix. Hence
the reordered system when dealing with the lower (or upper) triangular
portion it should be remembered that there is a one-to-
IC], [K] [C]i {8}, = {F} (4) one correspondence between each element in the original
after n such transformations there will result triangle and each element in the transformed triangle.
[c]. ICI,[K] [Cl, ... Each element in the lower triangle may be inspected
for its i* and j* subscripts. When j * > i* the sub-
[c].tsI. = {Ft. (5) scripts are interchanged to locate the element in the
It is apparent that each single interchange merely lower triangular portion. In this way the correct trans-
performs a row and column interchange for the two formed lower triangle may be obtained without having
designated nodes. If{V}is a vector of the original nodal to manually permute the individual rows and columns.
numbering system, i.e., The question is not', " H o t ' does one determine
V~ = 1 those interchanges that will reduce the matrix band-
width", and also just as important, how is this done
v~ = 2 efficiently without merely seeking random interchanges.

THE D E T E R M I N A T I O N OF USEFUL INTER-


CHANGES
It has already been shown how the row and column
Vn ~ n interchange may be performed without the physical
action of transferring rows and columns in a matrix.
(assuming a contiguous nodal numbering system) then
Also it is noticed that each transformation maintains
the revised numbering system after the transformations
the matrix symmetry, hence, it is only necessary to
is represented by
know the locations of the non-zero elements in the
{vt* = [c].... tc], Iv} lower triangle nodal connectivity matrix. (The matrices
In tabular form this would appcar as: that are treated in actual problems are sparse. A ten
Node Number WAS is NOW percent populated matrix is considered an extremely
populated matrix.) It is not necessary to store the
~' ~P V! t, VI *
diagonal elements because they do not affect the prob-
. . . . v2 " v2* lem. Hence, it is only necessary to have a list con-
taining the locations of all the non-zero terms in the
lower triangular portion of the matrix. Two additional
lists are required; one containing the original node
numbering scheme and the other containing the revised
numbering pattern. (If the original numbering scheme
" " Vn " Vn* contains a contiguous list of numbers from one through
This " W A S - N O W " will yield that nodal numbering n, then only the revised list would be required.) The
system that will yield the transformed matrix logic for the bandwidth reduction is presented in the
[KI* = [C].... [Ch following flow chart.
The actual mechanics of the bandwidth reduction
[K] [C], ... [CI. (6) are shown in the accompanying subroutine listings.
directly if the nodal numbering scheme is numbered A few points concerning these operations will be stated
in the " N O W " configuration. This " W A S - N O W " here.
relationship has another very useful function which The "Phase 1" section seeks to affect an interchange
will be utilized later on. If Kij is an element of the of two nodes which will place the elements on the
original matrix[K ]then its position in the K * ma- current band inside the band. The program will per-
trix (defined by Equation (6) can be determined by form all possible interchanges of this type. When no
the subscripts i* and j* where: more of these interchanges exist, "Phase 2 " section
588 Proceedings--1968 ACM National Conference

is then entered. The purpose of "Phase 2" is to re- changes may be performed. The "Phase 2" section is
arrange the nodal pattern without increasing the band- provided with two different criteria to terminate the
width so that additional successful "Phase 1" inter- routine. The first is merely a maximum number of

Determine the maximum bandwidth and the


two nodes causing the maximum bandwidth

Can the higher numbered node be inter-

I changed with a lowered numbered one to re-


duce the bandwidth

Can the lowered numbered node be inter-


changed with a higher numbered one to re-
duce the bandwidth

|
Can the higher numbered node be inter- |
changed with a lower numbered node and still
maintain the same bandwidth
I

Can the lower numbered node be inter-


changed with a higher numbered node and
still maintain the same bandwidth

1
No further interchanges are possible
EXIT
I
I

I
+
Perform the indicated node interchange I

Modify the "IS table to reflect the current


interchange

,i I Go BACK To BEGINNING I

Flow Chart I.
Matrix Bandwidth Minimization 589

continuous operations in this section while the other gram before the mathematical operations for the phys-
does not permit two nodes which have already been ical problem are done. In the above systems there
interchanged to be interchanged again. may be as many as six equations governing each node,
hence the reduction of a few lines in the nodal net-
CONCLUSIONS work may have a six-fold effect in the final matrix
bandwidth.
A method has been presented which will reduce the The method presented is completely general for a
bandwidth of any symmetrical matrix. This method symmetrical system. In addition, it is not required
is especially appealing to problems where the original that the nodal numbering system to be a contiguous
numbering of a spacial system of nodes will determine one.
the bandwidth of the resulting equations describing Whether or not this method will yield the min-
this system. (i.e., finite element structural systems, imum possible bandwidth is a mathematical question
lumped nodal thermal networks, electrical networks, beyond the scope of this paper. However, from the
pipe flow conduit systems, finite difference grid net- point of view of the reduction in machine time achieved
works systems.) The renumbering of the nodal net- by renumbering the nodal configuration, these operations
work can be performed in the "Pre-Processor" pro- are mandatory for any large problems.

APPENDIX

S U B R O U T I N E N U M B E R LISTING (PAGE 1 OF 4)

C
C SUBROUTINE TO REDUCE THE BANDWIDTH OF A NODAL CONNECTIVITY
C MATRIX
C
C
C
C
C
C *******INPUT AND OUTPUT VARIABLES*******
C
C IROW(I) AND COL(I) ARE THE ROW AND COLUMN SUBSCRIPTS
C OF THE I-TH NON ZERO TERM IN, THE LOWER
C TRIANGULAR MATRIX EXCLUDING THE
C DIAGONAL
C NCP = NUMBER OF CROSS PRODUCT TERMS (I.E. THE NUMBER
C OF ELEMENTS DEFINED BY THE ABOVE LISTS).
C
C IS(I) AND IWAS(I) ARE LIST OF THE NODES COMPRISING THE
C SYSTEM. UPON ENTRY THEY ARE BOTH THE
C ORIGINAL NODAL NUMBERING SYSTEM. UPON
C EXIT IS(I) CONTAINS THE NODE NUMBER THAT
C HAS BEEN ASSIGNED TO IWAS(I).
CNSIZE THE MATRIX DIMENSION OF THE SYSTEM (OR THE
C NUMBER OF NODES CONTAINED IN THE SYSTEM.)
C MAXBND THE BANDWIDTH OF THE CURRENT SYSTEM
• 590 Proceedings--1968 A C M National Conference

C
C *******INTERNAL PROGRAM VARIABLES*******
C
C IRMXBD ROW LOCATION OF ELEMENT PRODUCING MAXIMUM
C BAND
C ICMXBD COLUMN LOCATION OF ELEMENT PRODUCING
C MAXIMUM BAND
C ISTART AND ISTOP= COMPUTED DO LOOP INDICES TO
C DETERMINE THE PERMISSABLE RANGE
C WHERE AN INTERCHANGE MAY BE
C FOUND.
C II AND JJ ARE THE TWO ROWS AND COLUMNS TO BE INTERCHANGED.
C NFOUND= I A SUCCESSFUL INTERCHANGE
C = 0 A BAD INTERCHANGE
C MI AND M2 ARE THE TWO PHYSICAL NODES BEING INTERCHANGED.
C J1 AND J2 ARE THE LOCATIONS IN THE IS ARRAY OF THE TWO NODES
C BEING INTERCHANGED.
C
C *************************
C

SUBROUTINE NUMBER LISTING (PAGE 2 OF 4)

C SEARCH---SEARCHES CURRENT TABLES TO DETERMINE IF THE


C TWO CURRENT ROWS OR COLUMNS WILL DECREASE
C THE BAND AFTER THEY ARE INTERCHANGED.
C P2SRCH --- PHASE 2 SEARCH. SEARCHES CURRENT TABLES TO
C DETERMINE IF THE TWO CURRENT ROWS OR COLUMNS
C WILL NOT INCREASE THE BAND AFTER THEY ARE
C INTERCHANGED.
C INTRCH ..... PERFORMS THE ROW AND COLUMN INTERCHANGE
C BY MODIFYING THE CURRENT TABLES.
C
SUBROUTINE NUMBER (IROW, ICOL, IS, IWAS, NCP, NSIZE,MAXBND )
INTEGER IROW (I), ICOL(1), IS (I), IWAS(1)
INTEGER INTPH2( 200 )
MBDPRV = NSIZE
MAXPH2 = NSIZE
C
C DETERMINE MAX BAND
1 MAXBND = 0
DO 2 I = 1 NCP
JDIFF = IROW(I)-ICOL(I)
iF ( JDIFF .LE. MAXBND) GO TO 2
MAXBND = JDIFF
IRMXBD = IROW (I)
ICMXBD = ICOL(I)
2 CONTINUE
Matrix Bandwidth Minimization 591 ~

IF (MAXBND .EQ. I) RETURN


C
C
C .............. PHASE I. PERFORM INTERCHANGES WHICH ..............
C DECREASE THE BANDWIDTH
C
C
C SEARCH FOR ROW INTERCHANGE
C
ISTART = MAX0 ( I, ( 2 ,,1 ICMXBD -IRMXBD + I ))
ISTOP = IRMXBD -- I
JJ = IRMXBD
DO 3 1 = ISTART, ISTOP
IF (I.EQ. ICMXBD) GO TO 3
II= I
CALL SEARCH (IROW, ICOL, IRMXBD, I, NCP, NFOUND, MAXBND)
IF ( NFOUND .EQ. I ) GO TO 6
CONTINUE
C
C SEARCH FOR COLUMN INTERCHANGE
C

S U B R O U T I N E N U M B E R L I S T I N G ( P A G E 3 OF 4)

ISTART = ICMXBD + 1
ISTOP= MIN0( NSIZE, (2~IRMXBD- ICMXBD- 1 ) )
JJ = ICMXBD
DO 4 I = ISTART, ISTOP
IF ( I .EQ. IRMXBD ) GO TO 4
II II = I
CALL SEARCH (IROW, ICOL, ICMXBD, I, NCP, NFOUND, MXBND )
IF ( NFOUND .EQ. 1 ) GO TO 6
4 CONTINUE
C
C NO SINGLE INTERCHANGES ARE AVAILABLE
C
C
C
C PHASE 2 SECTION. PERFORM INTERCHANGE WHICH DOESNT INCREASE
C BAND
C
C
C
C MBDPRV = THE BAND WIDTH FOR THE PREVIOUS TIME THRU
C PHASE 2.
C NTPHS2 = NUMBER OF TIMES PHASE 2 HAS BEEN ENTERED FOR
C THE SAME BAND.
592 Proceedings-1968 ACM National Conference

C INTPH2 = TABLE OF PREVIOUS PHASE 2 INTERCHANGES FOR


C CURRENT BAND.
C MAXPH2 = MAX NUMBER OF TIMES PHASE 2 WILL BE ENTERED
C FOR SAME BAND.
IF ( MAXPH2 .EQ. MBDPRV ) GO TO 7
C
C FIRST TIME THROUGH FOR CURRENT BAND.INITIALIZE.
C
IEND = 2 * MAXPH2
DO81 =I,IEND
B INTPH2 (I) = 0
NTPHS2 = 0
MBDPRV = MAXBND
GO TO 9
7 IF ( NTPHS2.EQ. MAXPH2) RETURN
9 CONTINUE
N21NT = 2 * NTPHS2
NTPHS2 = NTPHS2 + I
C SEARCH FOR ROW INTERCHANGE
C
ISTART = MAX0 ( I, ( 2 * ICMXBD- IRMXBD ) )
ISTOP = IRMXBD - I
JJ-- IRMXBD
DO 31 I= ISTART, ISTOP
IF (I .EQ. ICMXBD) GO TO 31

S U B R O U T I N E N U M B E R L I S T I N G (PAGE 4 OF 4)

I1=1
CALL P2SRCH (IROW, ICOL,IRMXBD,I,NCP, NFOUND MAXBND,
1 INTPH2, N21NT)
IF ( NFOUND .EQ. I ) GO TO 6
31 CONTINUE
C
C SEARCH FOR COLUMN INTERCHANGE
C
ISTART = ICMXBD 4.- 1
ISTOP = MIN0 ( NSIZE, (2 * IRMXBD-ICMXBD )
JJ = ICMXBD
DO 44 I = ISTART, ISTOP
IF (I .EQ. IRMXBD) GO TO 44
I1=1
CALL P2SRCH (IROW, ICOL, ICMXBD,I,NCP, NFOUND,MAXBND,
1 INTPH2, N21NT )
IF ( NFOUND .EQ. 1 ) GO TO 6
44 CONTINUE
RETURN
C
6 CALL INTRCH ( IROW, ICOL, JJ, II, NCP
Matrix Bandwidth Minimization 593

C
C
C
C
C RECORD INTERCHANGE IN TABLE
C
C
C
M1 : IWAS (JJ)
M2 = IWAS (II)
DO 37 1 = I, NSIZE
IF (IS (I).EQ. MI )J1 = I
IF (IS (I).EQ. M 2 ) J 2 = I
37 CONTINUE
IS (J l) = M2
IS (J2) = MI
GO TO I
END

S U B R O U T I N E SWITCH L I S T I N G

SUBROUTINE SWITCH ( ISW, ICH, JST, JHIGH, JLOW )


JSW = JST
C SWITCH PERFORMS THE ACTUAL INTERCHANGING OF THE ELEMENT
C COORDINATES
C THIS ROUTINE IS ONLY CALLED BY INTRCH.
C
C ISW = COORDINATE BEING CHANGED
C JSW: COORDINATE TO WHICH ISW IS CHANGED.
C ICH = NON CHANGING COORDINATE OF CURRENT ELEMENT
IF (ICH .EQ. JSW ) JSW = ISW
JHIGH = MAX0 (ICH, JSW)
JLOW-- MIN0 (ICH, JSW )
RETURN
END

S U B R O U T I N E SEARCH LISTING

SUBROUTINE SEARCH ( IROW, ICOL, IC, JC, NCP, NF, MAXBND)


C SEARCH FOR A SUCCESSFUL INTERCHANGE IN THE PHASE I SECTION
C
C SEARCH ALL INTERCHANGES FOR A NEW ELEMENT OUTSIDE OR ON
C CURRENT BAND
C NF=0 ELEMENT FALLS OUTSIDE OR ON BA.ND
C NF=I SUCCESS INTERCHANGES FOR A NEW ELEMENT OUTSIDE OR
C ON CURRENT BAND
594 Proceedings--1968 ACM National Conference

INTEGER IROW(1), ICOL(1}


NF=.0
DO 1 I='1, NCP
IF (IROW(I).NE. IC) GO TO 2'
IF (lABS(JC-ICOL(I) ) .GE. MAXBND ) RETURN
GO TO I
IF (ICOL(1).NE. JC) GO TO 3
IF (IABS(IC-IROW(1) ) .GE. MAXBND ) RETURN
GO TO I
IF (IROW(1).NE. JC ) GO TO 4
IF (IABS(IC-ICOL(1)) .GE. MAXBND ) RETURN
GO TO I
IF (ICOL(1).NE.IC ) GO TO I
IF (IABS(JC-IROW(1)) .GE. MAXBND ) RETURN
CONTINUE
NF=I
RETURN
END

SUBROUTINE P2SRCH

SUBROUTINE P2SRCH (IROW, ICOL, IC, JC , NCP, NF, MAXBND,


INTPH2, N21NT )
C SEARCH FOR A SUCCESSFUL INTERCHANGE IN THE PHASE 2 SECTION
C
C NF=I SUCCESS INTERCHANGE HAS BEEN FOUND
INTEGER IROW (1), ICOL (1)
INTEGER INTPH2 (1)
NF= 0
D O I I =1, NCP
IF (IROW (I).NE. IC)GO TO 2
IF (lABS (JC-ICOL (I)) .GT. MAXBND ) RETURN
G O TO I
2 IF (ICOL (I).NE. JC) GO TO 3
IF (IABS (IC-IROW (I)) .GT. MAXBND ) RETURN
GO TO I
3 IF (IROW (I).NE. JC) GO TO 4
IF (IABS (IC-ICOL(1)).GT. MAXBND ) RETURN
GO TO I
4 IF (ICOL(1).NE. IC) GO TO I
IF (IABS ( JC- IROW(1) ) .GT. MAXBND ) RETURN
! CONTINUE
C
C CHECK IF THIS IS A REPEATING INTERCHANGE.
C
IF ( N21NT.EQ. 0) GO TO 5
MTI = 0
MTJ : 0
Matrix Bandwidth Minimization 595

DO 6 1 : I, N21NT
IF (INTPH2 (I).EQ. IC) MTI : I
6 IF (INTPH2(1). EQ. JC) MTJ : I
IF (MTI + MTJ). EQ. 2 ) RETURN
5 CONTINUE
NF:I
INTPH2(N21NT + I) : IC
INTPH2(N21NT + 2) : JC
RETURN
END

SUBROUTINE INTRCH LISTING

C PERFORM ROW AND COLUMN INTERCHANGE


C IIS, IWAS ARE THE 2 NODES BEING SHIFTED
C NCP = NUMBER OF CROSS PRODUCTS
C
C
INTEGER I ROW (I), ICOL (I)

C INTERCHANGE 2 ROWS AND 2 COLUMNS


C*****
DO1 I : I, NCP
IF (IROW (I).NE.IIS ) GO TO 2
CALL SWITCH (IROW (I) ICOL (I), IWAS, JH, JL )
IROW (I)= JH
ICOL(1) : JL
GO TO I
IF(IROW(1).NE. IWAS GO TO 3
CALL SWITCH (IROW (I), IIS, JH, JL )
IROW(1) = JH
ICOL (I): JL
GO TO I
IF (ICOL(1) .HE. IIS ) GO TO 4
CALL SWITCH (ICOL(1), IROW(1), IWAS, JH, JL )
IROW(1) = JH
ICOL(1) = JL
GO TO I
IF (ICOL(1).NE. IWAS) GO TO I
CALL SWITCH (ICOL(1), IROW(1), IIS, JH, JL )
IROW(1) : JH
ICOL(1) : JL
CONTINUE
RETURN
END

You might also like