|
| real(sp) function, dimension(:,:), allocatable | la_inverse_s (a, err) |
| |
| real(dp) function, dimension(:,:), allocatable | la_inverse_d (a, err) |
| |
| real(qp) function, dimension(:,:), allocatable | la_inverse_q (a, err) |
| |
| complex(sp) function, dimension(:,:), allocatable | la_inverse_c (a, err) |
| |
| complex(dp) function, dimension(:,:), allocatable | la_inverse_z (a, err) |
| |
| complex(qp) function, dimension(:,:), allocatable | la_inverse_w (a, err) |
| |
Compute the inverse of a square matrix.
This function computes the inverse of a real or complex square matrix \( A \). The inverse is computed using an LU decomposition with partial pivoting.
- Parameters
-
| [in] | A | The input square matrix of size \( [n, n] \). |
| [out] | err | (Optional) A state return flag. If an error occurs and err is not provided, the function will stop execution. |
- Returns
- The inverse matrix \( A^{-1} \) of size \( [n, n] \).
- Note
- This function relies on LAPACK's LU decomposition routines (GETRF and GETRI).
- Warning
- The matrix \( A \) must be non-singular. If it is singular or nearly singular, the function will fail.
Compute the inverse of a square matrix in-place.
This subroutine computes the inverse of a real or complex square matrix \( A \) in-place. The inverse is computed using an LU decomposition with partial pivoting.
- Parameters
-
| [in,out] | A | The input square matrix of size \( [n, n] \). It is replaced by its inverse \( A^{-1} \). |
| [out] | err | (Optional) A state return flag. If an error occurs and err is not provided, the function will stop execution. |
- Note
- This subroutine is useful when memory efficiency is a priority, as it avoids additional allocations.
- Warning
- The matrix \( A \) must be non-singular. If it is singular or nearly singular, the computation will fail.
Compute the inverse of a square matrix using the .inv. operator.
This operator computes the inverse of a real or complex square matrix \( A \) using an LU decomposition with partial pivoting.
- Parameters
-
| [in] | A | The input square matrix of size \( [n, n] \). |
- Returns
- The inverse matrix \( A^{-1} \) of size \( [n, n] \).
- Note
- This operator is a shorthand for calling
inv(A), allowing expressions such as: \( X = .inv.A \)
- Warning
- The matrix \( A \) must be non-singular. If it is singular or nearly singular, the computation will fail.