HP MLIB User's Guide Vol. 1 7th Ed.

126 HP MLIB User’s Guide
SROTM/DROTM Apply modified Givens rotation
Example 2 Reduce 10-by-10 matrix a stored in two-dimensional array A of dimension
20-by-21 to upper-triangular form via modified Givens rotations (compare with
“Example 2” on page 117 in the description of SROT and DROT).
INTEGER*4 INCA,I,J,N
REAL*8 A(20,21),D(20),PARAM(5)
INCA = 20
DO 10 I = 1, 10
D(I) = 1.0D0
10 CONTINUE
DO 30 I = 1, 9
N = 10 - I
DO 20 J = I+1, 10
CALL DROTMG (D(I),D(J),A(I,I),A(J,I),PARAM)
CALL DROTM (N,A(I,I+1),INCA,A(J,I+1),INCA,PARAM)
20 CONTINUE
30 CONTINUE
DO 40 I = 1, 10
N = 11 - I
CALL DSCAL (N,SQRT(D(I)),A(I,I),INCA)
40 CONTINUE