! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 5.23. Compute exponential of a matrix.
  program F23
    use F23M
    implicit none
    integer :: A_Dim
    real (kind = K), dimension(:, :), allocatable :: Array, X
! start program F23
    open (unit = 1, file = "x.txt", status = "old", action = "read", position = "rewind")
    read (unit = 1, fmt = *) A_Dim
    allocate( Array(A_Dim, A_Dim), X(A_Dim, A_Dim) )
    read (unit = 1, fmt = *) Array
    X = Mat_Exp( Array )
    write (unit = *, fmt = *) X
    stop
  end program F23
