Jacobi Method Implementation in Fortran
Classified in Computers
Written on in
English with a size of 3.12 KB
This section details the implementation of the Jacobi method in Fortran for solving a system of linear equations. The subroutine solucion_Jacobi takes a matrix A, a vector b, and an initial guess X as input, and returns the solution vector X.
Subroutine: solucion_Jacobi(A, b, X)
The subroutine begins with the following declarations and initializations:
use normasinteger, parameter :: Kx = 100real(8), parameter :: tolerancia = 1E-6real(8), allocatable :: X0(:), ERROR(:)real(8), intent(in) :: A(:,:), b(:)real(8), allocatable, intent(out) :: X(:)integer :: i, j, k, nreal(8) :: sum, zero, ek
Where:
Kxis the maximum number of iterations.toleranciais the error tolerance.X0is the previous iteration's solution vector.ERRORis the error vector.Ais the