      PROGRAM cmmathde
      INCLUDE 'STDHDR.FOR'
      COMPLEX mat1(0:maxr, 0:maxc), mat2(0:maxr, 0:maxc)
      COMPLEX mat3(0:maxr, 0:maxc), vm
      CHARACTER * 80 message


      !!!!  cmatmath demo main

      mat1(0, 0) = CMPLX(13.0, 1.0 )
      mat1(0, 1) = CMPLX(-8.0, 2.0 )
      mat1(0, 2) = CMPLX(-3.0, 3.0 )
      mat1(1, 0) = CMPLX(-8.0, 2.0 )
      mat1(1, 1) = CMPLX(10.0, 2.0 )
      mat1(1, 2) = CMPLX(-1.0, 2.0 )
      mat1(2, 0) = CMPLX(-3.0, 3.0 )
      mat1(2, 1) = CMPLX(-1.0, 2.0)
      mat1(2, 2) = CMPLX(11.0, 3.0)


      mat2(0, 0) = CMPLX(1.0, 4.0 )
      mat2(0, 1) = CMPLX(5.0, 2.0 )
      mat2(0, 2) = CMPLX(1.0, 3.0 )
      mat2(1, 0) = CMPLX(3.0, 4.0 )
      mat2(1, 1) = CMPLX(6.0, 3.0 )
      mat2(1, 2) = CMPLX(3.0, 1.0 )
      mat2(2, 0) = CMPLX(0.0, 0.0 )
      mat2(2, 1) = CMPLX(1.0, 3.0 )
      mat2(2, 2) = CMPLX(-9.0, -6.0)


      message = 'Original mat1 = '
      CALL CMatPrint(mat1, 3, 3, message)
      message = 'Original mat2 = '
      CALL CMatPrint(mat2, 3, 3, message)
      READ (*,*)

      CALL CMatProd(mat1, mat2, 3, 3, 3, mat3)
      message = 'matrix product mat1 x mat2 = '
      CALL CMatPrint(mat3, 3, 3, message)
      PRINT *, 'press carriage return to advance to next procedure '
      READ (*,*)

      vm = CMPLX(11.0, 0.0)
      CALL CMatScalarProd(mat1, vm, 3, 3, mat3)
      message = 'matrix scalar product mat1 x 11.0  = '
      CALL CMatPrint(mat3, 3, 3, message)
      PRINT *, 'press carriage return to advance to next procedure '
      READ (*,*)


      CALL CMatAdd(mat1, mat2, 3, 3, mat3)
      message = 'matrix add mat1 + mat2 = '
      CALL CMatPrint(mat3, 3, 3, message)
      PRINT *, 'press carriage return to advance to next procedure '
      READ (*,*)


      CALL CMatTranspose(mat1, 3, 3, mat3)
      message = 'matrix transpose of mat1  = '
      CALL CMatPrint(mat3, 3, 3, message)
      PRINT *, 'press carriage return to advance to next procedure '
      READ (*,*)


      CALL CMatInvert(mat1, 3, det, mat3)
      message = 'inverse of matrix mat1  = '
      CALL CMatPrint(mat3, 3, 3, message)
      READ (*,*)

      CALL CMatProd(mat1, mat3, 3, 3, 3, mat2)
      message = 'matrix product mat1 x inverse(mat1) = '

      CALL CMatPrint(mat2, 3, 3, message)
      PRINT *, 'press carriage return to END Program '
      READ (*,*)

      end



