SUBROUTINE PIVOT (N)
C
PURPOSE
- TO
PERFORM
tHE
PIVOI
OPEIxATION BY
UPDATING ]HE
C
INVERSE OF THE BASIS AND
0
VECTOR.
C
COMMON AM, O*LI,B,
NLI,NL2,A*NEIsNE2,
I~JMBASIS,~,Z
DIMENSION AMCSO*SO), OCbO),
BC50*50),
ACbO)
DIMENSION W(50)J
Z(SO)* MBASIS(IOO)
DO I I=I,N
I
B(IR, I)=B(IR*I)/A(IR)
Q(IR)=Q(IR)/A(IR)
D0
3
I=I~N
IF {I.EO.IR} GO 70 3
Q(1):Q(1)-O(IR)*A(1)
DO 2 J=I*N
B(I~J)=B(I,J)-B(IR*J)*A(1)
0
CONTINUE
3
CONTINUE
C UPDATE THE INDICATOR VECTOR
OF
BASIC VARIABLES
NLI=MBASIS(IK)
L=N+IR
NL2=MBASIS(L)
MBASISIIR)=NEI
MBASIS(L)=NE2
LIfLI÷I
RETURN
END
SUBROUTINE PPRINT (N)
C PURPOSE - TO PRINT THE CURRENT SOLUTION TO COMPLEMENTARY
C
PROBLEM AND THE ITERATION NUMBER.
O
COMMON AM*OnLI,B*NLI*NL2,AsNEI*NE2*II(~MBASIS*~*Z
DIMENSION AM(SO~bO)s O(SO)*
B(50,5O)* A(50)
DIMENSION ~(50}* Z(50)* NBASIS(IOO)
~RITE(6*I)
LI
1
FORMAT
(10X*I3RITERATION
NO.~I4)
I=N+I
d=l
2 KI=MBASIS(1)
KO=MBASIS(J)
IF (O(J)*GE-O.O) GO TO
3
O(J)=O.O
3
IF
(R2.EO.l)
GO TO
5
WRITE(6~4)
KI,O(J)
A
FORMAT
(IOXt~HZ(JI4,2H)=JFI5°5)
GO
TO
7
5
WRITE(6*6'
KI*Q(J)
6
FORMAT (IOXt2HW(~I4~OH)=~FISoS)
7
I=I+l
J=J+l
IF (J*LE.N) GO
TO 2
RETURN
END
Editor's note:
Algorithm 432 described here is available on magnetic
tape from
the Department of Computer Science,
University
of
Colorado, Boulder, CO 80302. The cost for the tape is $16.00 (U.S.
and Canada) or $18.00 (elsewhere). If the user sends a small tape
(wt. less than 1 lb.) the algorithm will be copied on it and returned
to him at a charge of $10.O0 ( U.S. only). All orders are to be prepaid
with checks payable to ACM Algorithms. The algorithm is re corded
as one file of BCD 80 character card images at 556 B.P.I., even
parity, on seven ~rack tape.
We will supply the algorithm at a
density of 800 B.P.I. if requested. The cards for the algorithm are
sequenced starting at 10 and incremented by 10. The sequence number
is right justified in colums 80. Although we will make every attempt
to insure that the algorithm conforms to the description printed here,
we cannot guarantee it, nor can we guarantee that the algorithm is
correct.--L.D.F.
Algorithm 432
Solution of the Matrix
Equation AX + XB = C [F4]
R.H. Bartels and G.W. Stewart [Recd. 21 Oct. 1970
and 7 March 1971]
Center for Numerical Analysis, The University of Texas
at Austin, Austin, TX 78712
Key Words and Phrases: linear algebra, matrices, linear equa-
tions
CR Categories: 5.14
Language: Fortran
Descdption
The following programs are a collection of Fortran IV sub-
routines to solve the matrix equation
AX -.}- XB = C
(1)
where A, B, and C are real matrices of dimensions m X m, n X n,
and m X n, respectively. Additional subroutines permit the efficient
solution of the equation
ArX + xa
= C,
(2)
where C is symmetric. Equation (1) has applications to the direct
solution of discrete Poisson equations [2].
It is well known that (1) has a unique solution if and only if the
eigenvalues al , a2
....
, a,~ of A and ~l , ~2 , • . • , ~, of B satisfy
ai + ~
# 0
(i = 1, 2, . . . , m;j = 1,2,...,11).