QR decomposition of a matrix A using various methods This subroutine performs QR decomposition of a given matrix A using the specified method (Householder, Givens, Classical Gram-Schmidt, or Modified Gram-Schmidt). The output matrices Q is an orthogonal matrix and R is an upper triangular matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A | ||
| character(len=*), | intent(in), | optional | :: | method | ||
| real(kind=dp), | intent(out), | dimension(size(A, 1), size(A, 2)) | :: | Q | ||
| real(kind=dp), | intent(out), | dimension(size(A, 1), size(A, 2)) | :: | R |
subroutine QR_decomposition(A, method, Q, R) real(dp), dimension(:, :), intent(in) :: A character(LEN=*), optional, intent(in) :: method real(dp), dimension(size(A, 1), size(A, 2)), intent(out) :: Q, R if (method == "QR_Householder") then call QR_Householder_decomposition(A, Q, R) else if (method == "QR_Givens") then call QR_Givens_decomposition(A, Q, R) else if (method == "QR_Gram_Schmidt_Classical") then call QR_Gram_Schmidt_Classical_decomposition(A, Q, R) else if (method == "QR_Gram_Schmidt_Modified") then call QR_Gram_Schmidt_Modified_decomposition(A, Q, R) end if end subroutine QR_decomposition