* TEST PROGRAM DEIGNT " deigen テスト
***********************************************************************
      PROGRAM DEIGNT
*
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" 
      INCLUDE   (ZLDIM)                      !" 格子点数, 波数
#else
#include        "zcdim.F"                    !" 
#include        "zldim.F"                    !" 係数行列の大きさ
#endif
*
      REAL      A  ( MATDMX, MATDMX )        !" 係数行列
c$$$      COMPLEX   EIGVAL( MATDMX )             !" 固有値
c$$$      COMPLEX   EIGVEC( MATDMX, MATDMX )     !" 固有ベクトル
      REAL      EIGVLR( MATDMX )             !" 固有値
      REAL      EIGVLI( MATDMX )             !" 固有値
      REAL      EIGVCR( MATDMX, MATDMX )     !" 固有ベクトル
      REAL      EIGVCI( MATDMX, MATDMX )     !" 固有ベクトル
      INTEGER   MATDIM                       !" 計算する次元
*
      INTEGER   IS, J, K , NUMEIG
*
      IS=0
  100 CONTINUE
*
*  < 1. 行列設定 >
*
      IF (IS .EQ. 0) THEN
c$$$         MATDIM = 3
c$$$         A(1,1)=33.0D0
c$$$         A(2,1)=-24.0D0
c$$$         A(3,1)=-8.0D0
c$$$         A(1,2)=16.0D0
c$$$         A(2,2)=-10.0D0
c$$$         A(3,2)=-4.0D0
c$$$         A(1,3)=72.0D0
c$$$         A(2,3)=-57.0D0
c$$$         A(3,3)=-17.0D0
         MATDIM = 4
         A(1,1)= 0.0D0
         A(2,1)= 1.0D0
         A(3,1)= 0.0D0
         A(4,1)= 0.0D0
         A(1,2)= -1.0D0
         A(2,2)= 0.0D0
         A(3,2)= 0.0D0
         A(4,2)= 0.0D0
         A(1,3)= 0.0D0
         A(2,3)= 0.0D0
         A(3,3)= 0.0D0
         A(4,3)= 2.0D0
         A(1,4)= 0.0D0
         A(2,4)= 0.0D0
         A(3,4)= -2.0D0
         A(4,4)= 0.0D0
C
C  VALUE = 1, 2, 3
C  VECTOR = (-15,12,4), (-16,13,4), (-4,3,1)
      ELSE
         MATDIM = 4
         A(1,1)=4.
         A(2,1)=0.
         A(3,1)=5.
         A(4,1)=3.
         A(1,2)=-5.
         A(2,2)=4.
         A(3,2)=-3.
         A(4,2)=0.
         A(1,3)=0.
         A(2,3)=-3.
         A(3,3)= 4.
         A(4,3)=5.
         A(1,4)=3.
         A(2,4)=-5.
         A(3,4)=0.
         A(4,4)=4.
      ENDIF
C  VALUE = 12, 1+5I, 1-5i, 2
C  VECTOR = (1,-1,1,1), (1,-i,-i,-1), (1,i,i,-1), (1,1,-1,1)
*
*"  < 2. 固有値計算 >
*
      CALL LEIGEN
     M        ( A      , 
     O          EIGVLR , EIGVLI , 
     O          EIGVCR , EIGVCI , 
     O          IERR   , 
     I          MATDIM              )
c$$$      CALL LSLFRQ
c$$$     M           (  EIGVLR , EIGVLI ,
c$$$     M              EIGVCR , EIGVCI ,
c$$$     O              NUMEIG ,
c$$$     I              MATDIM              )
      NUMEIG = MATDIM
*
*"  < 3. 出力 >
*
      WRITE ( 6, * )
      WRITE ( 6, * )' CASE ', IS+1 
      WRITE ( 6, * )
      WRITE ( 6, * ) ' Eigen values'
      WRITE ( 6, * ) (EIGVLR(J), EIGVLI(J), J = 1, NUMEIG)
      WRITE ( 6, * ) ' Eigen vectors'
      DO 3100 J = 1, MATDIM
         WRITE ( 6, * ) ( EIGVCR(J,K), EIGVCI(J,K), K = 1, NUMEIG )
 3100 CONTINUE 
*
*"  < 4. 再度挑戦 ?? > 
*
      CALL CLCOUT                      !" CPU時間出力
      IF (IS .NE. 1) THEN
       IS=IS+1
       GO TO 100
      ENDIF
*
      STOP
      END
