1
SUBROUTINE SB04QR( M, D, IPR, INFO )
3
C RELEASE 4.0, WGS COPYRIGHT 2000.
7
C To solve a linear algebraic system of order M whose coefficient
8
C matrix has zeros below the third subdiagonal and zero elements on
9
C the third subdiagonal with even column indices. The matrix is
10
C stored compactly, row-wise.
14
C Input/Output Parameters
17
C The order of the system. M >= 0, M even.
18
C Note that parameter M should have twice the value in the
19
C original problem (see SLICOT Library routine SB04QU).
21
C D (input/output) DOUBLE PRECISION array, dimension
23
C On entry, the first M*M/2 + 3*M elements of this array
24
C must contain the coefficient matrix, stored compactly,
25
C row-wise, and the next M elements must contain the right
26
C hand side of the linear system, as set by SLICOT Library
28
C On exit, the content of this array is updated, the last M
29
C elements containing the solution with components
30
C interchanged (see IPR).
32
C IPR (output) INTEGER array, dimension (2*M)
33
C The leading M elements contain information about the
34
C row interchanges performed for solving the system.
35
C Specifically, the i-th component of the solution is
36
C specified by IPR(i).
41
C = 0: successful exit;
42
C = 1: if a singular matrix was encountered.
46
C Gaussian elimination with partial pivoting is used. The rows of
47
C the matrix are not actually permuted, only their indices are
48
C interchanged in array IPR.
52
C [1] Golub, G.H., Nash, S. and Van Loan, C.F.
53
C A Hessenberg-Schur method for the problem AX + XB = C.
54
C IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.
57
C Algorithms for Linear-quadratic Optimization.
58
C Marcel Dekker, Inc., New York, 1996.
66
C D. Sima, University of Bucharest, May 2000.
74
C Hessenberg form, orthogonal transformation, real Schur form,
77
C ******************************************************************
80
PARAMETER ( ZERO = 0.0D0 )
81
C .. Scalar Arguments ..
83
C .. Array Arguments ..
87
INTEGER I, I1, I2, IPRM, IPRM1, J, K, L, M1, MPI, MPI1,
89
DOUBLE PRECISION D1, D2, D3, DMAX
90
C .. External Subroutines ..
92
C .. Intrinsic Functions ..
94
C .. Executable Statements ..
109
IF ( I.GE.4 .AND. MOD( I, 2 ).EQ.0 ) M1 = M1 - 2
115
C Reduce to upper triangular form.
123
IF ( MOD( I, 2 ).EQ.0 ) I1 = 2
124
IF ( I.EQ.M1 ) I1 = 1
132
IF ( D3.GT.DMAX ) THEN
141
IF ( DMAX.EQ.ZERO ) THEN
148
C Permute the row indices.
162
C Annihilate the subdiagonal elements of the matrix.
171
D(IPR(I2)) = D(IPR(I2)) + DMAX*D3
172
CALL DAXPY( M-I, DMAX, D(IPRM), 1, D(IPRM1+1), 1 )
183
IF ( D(IPRM).EQ.ZERO ) THEN
190
D(IPR(M)) = D(IPR(M))/D(IPRM)
200
DMAX = DMAX + D(IPR(K))*D(IPRM1)
203
D(IPR(I)) = ( D(IPR(I)) - DMAX )/D(IPRM)
207
C *** Last line of SB04QR ***