      SUBROUTINE  CMATR(M,C,NX,Y,IPO)                                           
CCC       ESTIMATION OF THE EIGENVALUES OF THE SPHEROIDAL FUNCTIONS             
CCC       BY THE MATRIX METHOD OF D.B. HODGE (1970)                             
CCC       COMPLEX VARIABLE 'C'                                                  
CCC       REQUIRED SUBROUTINE  -  CEIGEN
CCC                                                                               
      IMPLICIT COMPLEX *16 (A-H,O-Z)                                            
      DIMENSION Y(1),D(60),E(60),F(60),AMT(1860)                                
      A(M,NR,C)=(2*M+NR+2.)*(2*M+NR+1.)/(2*M+2*NR+3.)/(2*M+2*NR+5.)*C           
      B(M,NR,C)=(2*(M+NR)*(M+NR+1.)-2*M*M-1.)*C/(2*M+2*NR-1.)/                  
     +          (2*M+2*NR+3.)+(M+NR)*(M+NR+1.)                                  
      CN(M,NR,C)=NR*(NR-1.)*C/(2*M+2*NR-3.)/(2*M+2*NR-1.)                       
C                                                                               
      N=NX+CDABS(C)                                                             
      NL=(N+2)/2                                                                
      CC=C*C*IPO                                                                
      IS=0                                                                      
      IF (NL.LE.60) GO TO 5                                                     
      PRINT 100                                                                 
      RETURN                                                                    
  100 FORMAT ('SUBROUTINE <CMATR> RETURNED WITH NO CALCULATIONS')               
    5 CONTINUE                                                                  
      DO 10 I=1,NL                                                              
      I2=2*(I-1)+IS                                                             
      D(I)=CN(M,I2,CC)                                                          
      E(I)=B(M,I2,CC)                                                           
      F(I)=A(M,I2,CC)                                                           
   10 CONTINUE                                                                  
      MX=NL*(NL+1)/2                                                            
      DO 15 K=1,MX                                                              
      AMT(K)=0.                                                                 
   15 CONTINUE                                                                  
      AMT(1)=E(1)                                                               
      L=1                                                                       
      DO 20 K=2,NL                                                              
      L=L+K                                                                     
      AMT(L-1)=CDSQRT(D(K)*F(K-1))                                              
      AMT(L)=E(K)                                                               
   20 CONTINUE                                                                  
        CALL CEIGEN (AMT,R,NL,1)                                                
      L=MX                                                                      
      LL=1+IS                                                                   
      DO 30 I=1,NL                                                              
      IF (LL.GT.NX+1) GO TO 35                                                  
      Y(LL)=AMT(L)                                                              
      LL=LL+2                                                                   
      L=L-NL+I-1                                                                
   30 CONTINUE                                                                  
   35 CONTINUE                                                                  
      IF (IS.EQ.1) GO TO 40                                                     
      IS=1                                                                      
      GO TO 5                                                                   
   40 CONTINUE                                                                  
      RETURN                                                                    
      END                                                                       
