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