Calculates the singular value decomposition (SVD) of a matrix A.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in), | dimension(:, :), contiguous | :: | A | ||
real(kind=rk), | intent(out), | dimension(:,:) | :: | U | ||
real(kind=rk), | intent(out), | dimension(:) | :: | S | ||
real(kind=rk), | intent(out), | dimension(:,:) | :: | VT | ||
character(len=*), | intent(in), | optional | :: | method |
pure subroutine svd_rel(A, U,S,VT, method) ! Inputs: real(rk), dimension(:, :), contiguous, intent(in) :: A ! Input matrix A ! Outputs: real(rk), dimension(:,:), intent(out) :: U ! Left singular vectors real(rk), dimension(:,:), intent(out) :: VT ! Right singular vectors real(rk), dimension(:), intent(out) :: S ! Singular values character(*), intent(in), optional :: method if (.not. present(method)) then call gesvd_rel(A, U,S,VT) else select case (method) case ('gesvd') call gesvd_rel(A, U,S,VT) case( 'gesdd') call gesdd_rel(A, U,S,VT) end select end if end subroutine svd_rel