solve Interface

public interface solve

This interface overloads the solve interface from stdlib_linalg for solving a linear system where is a Diagonal matrix. It also enables to solve a linear system with multiple right-hand sides.

Syntax

   x = solve(A, b)

Arguments

  • A : Matrix of Diagonal type. It is an intent(in) argument.

  • b : Rank-1 or rank-2 array defining the right-hand side(s). It is an intent(in) argument.

  • x : Solution of the linear system. It has the same type and shape as b.


Functions

private pure module function solve_multi_rhs(A, B) result(X)

Solve the linear system where is of type Diagonal and B a standard rank-2 array. The solution matrix X has the same dimensions and kind as the right-hand side matrix B.

Arguments

Type IntentOptional Attributes Name
type(Diagonal), intent(in) :: A

Coefficient matrix.

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

Right-hand side vectors.

Return Value real(kind=dp), allocatable, (:,:)

Solution vectors.

private pure module function solve_single_rhs(A, b) result(x)

Solve the linear system where is of type Diagonal and b a standard rank-1 array. The solution vector x has the same dimension and kind as the right-hand side vector b.

Arguments

Type IntentOptional Attributes Name
type(Diagonal), intent(in) :: A

Coefficient matrix.

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

Right-hand side vector.

Return Value real(kind=dp), allocatable, (:)

Solution vector.