This kind of task can also be done by ChatGPT4.
To demonstrate it, I gave this code as input:
SUBROUTINE RCKELI(N,A,Y,X)
PARAMETER (IA=50)
REAL A(IA,IA), Y(IA), X(IA)
INTEGER N
X(N)=Y(N)/A(N,N)
DO 10 K=N-1,1,-1
S=0.
DO 20 J=K+1,N
20 S=S+A(K,J)*X(J)
10 X(K)=(Y(K)-S)/A(K,K)
RETURN
END
After a few (not many) tries, ChatGPT made this:
module back_substitution_module
implicit none
integer, parameter :: dp = kind(1.d0)
contains
subroutine back_substitution(a, y, x)
integer :: n
real(dp), intent(in) :: a(:,:), y(:)
real(dp), intent(out) :: x(size(y))
real(dp) :: s
integer :: k
n = size(y)
x(n) = y(n) / a(n, n)
do k = n-1, 1, -1
s = dot_product(a(k, k+1:n), x(k+1:n))
x(k) = (y(k) - s) / a(k, k)
end do
end subroutine back_substitution
end module back_substitution_module
Unfortunately, ChatGPT isn’t as good in Fortran programming compared to Python programming, but giving some hints it’s possible to get good results.
I used ChatGPT to modernize an old FORTRAN routine (horizontal diffusion) at work and AFAIK ChatGPT makes fewer mistakes than a human translating the code manually would make.