Pseudo-inverse of a matrix (Specification)
This interface provides methods for computing the Moore-Penrose pseudo-inverse of a matrix. The pseudo-inverse is a generalization of the matrix inverse, computed for square, singular, or rectangular matrices. It is defined such that it satisfies the conditions: - - - -
This function interface provides methods that return the Moore-Penrose pseudo-inverse of a matrix.
Supported data types include real
and complex
.
The pseudo-inverse is returned as a function result. The computation is based on the
singular value decomposition (SVD). An optional relative tolerance rtol
is provided to control the
inclusion of singular values during inversion. Singular values below
are treated as zero, where is the largest singular value. If rtol
is not provided,
a default threshold is applied.
Exceptions are raised in case of computational errors or invalid input, and trigger an error stop
if the state flag err
is not provided.
Note
The provided functions are intended for both rectangular and square matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=sp), | intent(in), | target | :: | a(:,:) |
Input matrix a[m,n] |
|
real(kind=sp), | intent(in), | optional | :: | rtol |
[optional] Relative tolerance for singular value cutoff |
|
type(linalg_state_type), | intent(out), | optional | :: | err |
[optional] State return flag. On error if not requested, the code will stop |
Output matrix pseudo-inverse [n,m]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in), | target | :: | a(:,:) |
Input matrix a[m,n] |
|
real(kind=dp), | intent(in), | optional | :: | rtol |
[optional] Relative tolerance for singular value cutoff |
|
type(linalg_state_type), | intent(out), | optional | :: | err |
[optional] State return flag. On error if not requested, the code will stop |
Output matrix pseudo-inverse [n,m]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=sp), | intent(in), | target | :: | a(:,:) |
Input matrix a[m,n] |
|
real(kind=sp), | intent(in), | optional | :: | rtol |
[optional] Relative tolerance for singular value cutoff |
|
type(linalg_state_type), | intent(out), | optional | :: | err |
[optional] State return flag. On error if not requested, the code will stop |
Output matrix pseudo-inverse [n,m]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=dp), | intent(in), | target | :: | a(:,:) |
Input matrix a[m,n] |
|
real(kind=dp), | intent(in), | optional | :: | rtol |
[optional] Relative tolerance for singular value cutoff |
|
type(linalg_state_type), | intent(out), | optional | :: | err |
[optional] State return flag. On error if not requested, the code will stop |
Output matrix pseudo-inverse [n,m]