linear_solvers Module

Module for computing solutions to linear systems of the form:


Used by

  • module~~linear_solvers~~UsedByGraph module~linear_solvers linear_solvers module~eigenvectors eigenvectors module~eigenvectors->module~linear_solvers module~non_linear_solvers non_linear_solvers module~non_linear_solvers->module~linear_solvers program~test_linear_solvers test_linear_solvers program~test_linear_solvers->module~linear_solvers program~test_eigenvectors test_eigenvectors program~test_eigenvectors->module~eigenvectors program~test_non_linear_solvers test_non_linear_solvers program~test_non_linear_solvers->module~non_linear_solvers

Functions

public function solve_U(U, b) result(x)

Computes the solution of an upper triangular system:

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: U(:,:)

Upper triangular matrix

real, intent(in) :: b(:)

Right hand side vector

Return Value real, (size(U,2))

Solution vector x

public function solve_L(L, b) result(x)

Computes the solution of a lower triangular system:

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: L(:,:)

Lower triangular matrix

real, intent(in) :: b(:)

Right hand side vector

Return Value real, (size(L,2))

Solution vector x

public function gauss_solve(A, b) result(x)

Computes the solution of the system: where A is a non-singular matrix.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: A(:,:)

Non-singular matrix

real, intent(in) :: b(:)

Right hand side vector

Return Value real, (size(A,2))

Solution vector x

public function solve_LU(L, U, b) result(x)

Computes the solution to the system: where L and U are the matrices obtained from a LU factorization.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: L(:,:)

Lower triangular matrix

real, intent(in) :: U(:,:)

Upper triangular matrix

real, intent(in) :: b(:)

Right hand side vector

Return Value real, (size(b))

Solution vector x

public function solve(A, b) result(x)

Computes the solution to the system: using LU factorization.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: A(:,:)

Non-singular matrix

real, intent(in) :: b(:)

Right hand side vector

Return Value real, (size(b))

Solution vector x

public function Jacobi(A, b, x_0, maxIter, err_x) result(x)

Computes the solution to the system using the Jacobi iterative method.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: A(:,:)

Non-singular matrix

real, intent(in) :: b(:)

Right hand side vector

real, intent(in) :: x_0(:)

Initial approximation for the iteration

integer, intent(in) :: maxIter

Maximum number of iterations

real, intent(in) :: err_x

Precision for the stop criterion

Return Value real, (size(A,2))

Solution vector x

public function GaussSeidel(A, b, x_0, maxIter, err_x) result(x)

Computes the solution to the system using the Gauss-Seidel iterative method.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: A(:,:)

Non-singular matrix

real, intent(in) :: b(:)

Right hand side vector

real, intent(in) :: x_0(:)

Initial approximation for the iteration

integer, intent(in) :: maxIter

Maximum number of iterations

real, intent(in) :: err_x

Precision for the stop criterion

Return Value real, (size(A,2))

Solution vector x


Subroutines

public subroutine make_U(M)

Makes the matrix M upper triangular

Arguments

Type IntentOptional Attributes Name
real, intent(inout) :: M(:,:)

Matrix M with maximum range

public subroutine factor_LU(A, L, U)

Computes de LU factorization of a non-singular matrix A

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: A(:,:)

Non-singular matrix

real, intent(out) :: L(size(A,1),size(A,2))

Lower triangular matrix

real, intent(out) :: U(size(A,1),size(A,2))

Upper triangular matrix