solve_lu Interface

public interface solve_lu

Solves the linear system for the unknown vector from a square matrix . (Specification)

Summary

Subroutine interface for solving a linear system using LU decomposition.

Description

This interface provides methods for computing the solution of a linear matrix system using a subroutine. Supported data types include real and complex. No assumption is made on the matrix structure. Preallocated space for the solution vector x is user-provided, and it may be provided for the array of pivot indices, pivot. If all pre-allocated work spaces are provided, no internal memory allocations take place when using this interface.
The function can solve simultaneously either one (from a 1-d right-hand-side vector b(:)) or several (from a 2-d right-hand-side vector b(:,:)) systems.

Note

The solution is based on LAPACK's generic LU decomposition based solvers *GESV.


Subroutines

private pure module subroutine stdlib_linalg_c_solve_lu_many(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

complex(kind=sp), intent(in) :: b(:,:)

Right hand side vector or array, b[n] or b[n,nrhs]

complex(kind=sp), intent(inout), contiguous, target :: x(:,:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_c_solve_lu_one(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

complex(kind=sp), intent(in) :: b(:)

Right hand side vector or array, b[n] or b[n,nrhs]

complex(kind=sp), intent(inout), contiguous, target :: x(:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_d_solve_lu_many(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

real(kind=dp), intent(in) :: b(:,:)

Right hand side vector or array, b[n] or b[n,nrhs]

real(kind=dp), intent(inout), contiguous, target :: x(:,:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_d_solve_lu_one(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

real(kind=dp), intent(in) :: b(:)

Right hand side vector or array, b[n] or b[n,nrhs]

real(kind=dp), intent(inout), contiguous, target :: x(:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_s_solve_lu_many(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

real(kind=sp), intent(in) :: b(:,:)

Right hand side vector or array, b[n] or b[n,nrhs]

real(kind=sp), intent(inout), contiguous, target :: x(:,:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_s_solve_lu_one(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

real(kind=sp), intent(in) :: b(:)

Right hand side vector or array, b[n] or b[n,nrhs]

real(kind=sp), intent(inout), contiguous, target :: x(:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_z_solve_lu_many(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

complex(kind=dp), intent(in) :: b(:,:)

Right hand side vector or array, b[n] or b[n,nrhs]

complex(kind=dp), intent(inout), contiguous, target :: x(:,:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

private pure module subroutine stdlib_linalg_z_solve_lu_one(a, b, x, pivot, overwrite_a, err)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(inout), target :: a(:,:)

Input matrix a[n,n]

complex(kind=dp), intent(in) :: b(:)

Right hand side vector or array, b[n] or b[n,nrhs]

complex(kind=dp), intent(inout), contiguous, target :: x(:)

Result array/matrix x[n] or x[n,nrhs]

integer(kind=ilp), intent(inout), optional, target :: pivot(:)

[optional] Storage array for the diagonal pivot indices

logical(kind=lk), intent(in), optional :: overwrite_a

[optional] Can A data be overwritten and destroyed?

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop