|
| 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.
This subroutine computes the inverse of a real or complex square matrix \( A \), either in-place or into a second matrix inva of the same shape. The inverse is computed using an LU decomposition with partial pivoting. Storage for the pivot indices may be provided, so that a repeated call performs no internal allocation of the pivot array.
- Parameters
-
| [in,out] | A | The input square matrix of size \( [n, n] \). In the in-place form it is replaced by its inverse \( A^{-1} \); in the split form it is read only. |
| [out] | inva | (Split form only) The inverse matrix \( A^{-1} \), of size \( [n, n] \). |
| [in,out] | pivot | (Optional) Storage array for the n diagonal pivot indices. |
| [out] | err | (Optional) A state return flag. If an error occurs and err is not provided, the function will stop execution. |
- Note
- The in-place form 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.