C...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
C     File:        CCUBSOLVDRV.F (Fortran 77 source)
C     Author:      Fredrik Jonsson <fj@phys.soton.ac.uk>
C     Date:        December 29, 2005
C     Last change: December 29, 2006
C     Description: Driver for the CCUBSOLV soutine for solving complex-
C                  valued cubic polynomial equations of the form
C
C                        z^3+c[2]*z^2+c[1]*z^2+c[0]=0
C
C                  for general complex coefficients c[k], which here taken
C                  as conforming to the convention
C
C                        A(1)=c[0],  A(2)=c[1],  A(3)=c[2].
C
C                  See the documentation of the CCUBSOLV routine, enclosed
C                  in file CCUBSOLV.F, for further information.
C
C     Copyright (C) 2006, Fredrik Jonsson
C...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
C     PROGRAM MAIN
      IMPLICIT LOGICAL (A-Z)
      EXTERNAL ccubsolv
      INTEGER K
      COMPLEX*8 A(3),Z(3)

      A(1)=CMPLX(1.23d0,-1.44d0)
      A(2)=CMPLX(-2.18d0,3.97d0)
      A(3)=CMPLX(1.91d0,0.97d0)

      CALL ccubsolv(A,Z)

      DO 10,K=1,3
         WRITE(6,20) 'Z(',K,'): ',Z(K)
 10   CONTINUE
 20   FORMAT(2X,A2,I1,A3,'(',F12.9,',',F12.9,')')

      DO 30,K=1,3
         WRITE(6,40) 'P(Z(',K,')): ',((Z(K)+A(3))*Z(K)+A(2))*Z(K)+A(1)
 30   CONTINUE
 40   FORMAT(2X,A4,I1,A4,'(',F12.9,',',F12.9,')')

      STOP
      END
