Calculates the pseudoinverse of a matrix A.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in), | dimension(:, :), contiguous | :: | A | ||
character(len=*), | intent(in), | optional | :: | method | ||
real(kind=rk), | intent(in), | optional | :: | tol |
pure function pinv_rel(A, method, tol) result(Apinv) #elif defined (IMPURE) impure function pinv_rel(A, method, tol) result(Apinv) #endif ! Inputs: real(rk), dimension(:, :), contiguous, intent(in) :: A real(rk), intent(in), optional :: tol character(*), intent(in), optional :: method ! Outputs: real(rk), dimension(size(A,2), size(A,1)) :: Apinv ! Pseudoinverse of A if (present(method)) then select case (method) case('gesvd','gesdd') Apinv = pinvSVD_rel(A, method, tol) case('getrf') Apinv = pinvLU_rel(A) case default error stop 'method is not valid.' end select else Apinv = pinvSVD_rel(A, tol=tol) end if end function pinv_rel