      SUBROUTINE WPOFA (AR, AI, LDA, N, INFO)
      IMPLICIT NONE
C
      INTEGER LDA, N, INFO
      DOUBLE PRECISION AR(LDA,*), AI(LDA,*)
C
      INTEGER J, JM1, K
      DOUBLE PRECISION S, TR, TI
C
      DOUBLE PRECISION WDOTCR, WDOTCI
C
C
      DO 30 J = 1, N
        INFO = J
        S = 0.0D0
        JM1 = J-1
        IF (JM1.LT.1) GO TO 20
        DO 10 K = 1, JM1
          TR = AR(K,J)-WDOTCR (K-1, AR(1,K), AI(1,K),
     .                         1, AR(1,J), AI(1,J), 1)
          TI = AI(K,J)-WDOTCI (K-1, AR(1,K), AI(1,K),
     .                         1, AR(1,J), AI(1,J), 1)
          CALL WDIV (TR, TI, AR(K,K), AI(K,K), TR, TI)
          AR(K,J) = TR
          AI(K,J) = TI
          S = S+TR*TR+TI*TI
10      CONTINUE
C
20      CONTINUE
        S = AR(J,J)-S
        IF (S.LE.0.0D0 .OR. AI(J,J).NE.0.0D0) GO TO 40
        AR(J,J) = DSQRT (S)
30    CONTINUE
      INFO = 0
C
40    CONTINUE
      RETURN
      END
