
PROGRAM TEST

IMPLICIT NONE

C

INTEGER IDOB, IDORSD, IDOXB, LDA, N, NCOLA, NOPIV

INTEGER NROWA

PARAMETER (IDOB = 100)

PARAMETER (IDORSD = 10)

PARAMETER (IDOXB = 1)

PARAMETER (N = 3)

PARAMETER (LDA = N)

PARAMETER (NCOLA = 2)

PARAMETER (NOPIV = 0)

PARAMETER (NROWA = N)

C

DOUBLE PRECISION A(LDA,NCOLA), B(NCOLA), NULL(N), QRAUX(N)

DOUBLE PRECISION RESID(N), WORK(N), Y(N)

INTEGER ICOL, INFO, IROW, JOB, JPIVOT

C

EXTERNAL DQRDC, DQRSL

C

C Initialize the array A to store the matrix A shown below.

C Initialize the array Y to store the vector y shown below.

C

C 1 1 1

C A = 1 0 y = 0

C 0 1 5

C

DATA A / 1.0D0, 1.0D0, 0.0D0, 1.0D0, 0.0D0, 1.0D0 /

DATA Y / 1.0D0, 0.0D0, 5.0D0 /

C

PRINT 1000

PRINT 1010, ((A(IROW,ICOL), ICOL = 1, NCOLA), IROW = 1,

$ NROWA)

PRINT 1020

PRINT 1030, Y

JOB = NOPIV

CALL DQRDC (A, LDA, NROWA, NCOLA, QRAUX, JPIVOT, WORK, JOB)

JOB = IDOB + IDORSD + IDOXB

CALL DQRSL (A, LDA, NROWA, NCOLA, QRAUX, Y, NULL, NULL, B,

$ RESID, NULL, JOB, INFO)

IF (INFO .EQ. 0) THEN

PRINT 1040

PRINT 1050, B

PRINT 1060

PRINT 1050, RESID

ELSE

PRINT 1070

END IF

C

1000 FORMAT (1X, 'A:')

1010 FORMAT (2(3X, F4.1))

1020 FORMAT (/1X, 'y:')

1030 FORMAT (3X, F4.1)

1040 FORMAT (/1X, 'Least squares solution:')

1050 FORMAT (3X, F4.1)

1060 FORMAT (/1X, 'Residual:')

1070 FORMAT (1X, 'A is singular.')

C

END

