\documentclass[]{article} \usepackage{html} \title{LA_GESV} \begin{document} \maketitle \section{Purpose} {\bf LA\_GESV} computes the solution to either a real or complex system of linear equations $AX=B$, where $A$ is a square matrix and $B$ and $X$ are either rectangular matrices or vectors. The $LU$ decomposition with partial pivoting and row interchanges is used to factor $A$ as $A=P L U$, where $P$ is a permutation matrix, $L$ is unit lower triangular, and $U$ is upper triangular. The factored form of $A$ is then used to solve the system of equations $A X=B$. \section{Specification} \vbox{ \begin{tabbing} SUB\= ROUTINE LA\_GESV( A, B, IPIV, INFO ) \\ \> {\it type}({\it wp}), INTENT(INOUT) :: A(:,:), {\it rhs} \\ \> INTEGER, INTENT(OUT), OPTIONAL :: IPIV(:) \\ \> INTEGER, INTENT(OUT), OPTIONAL :: INFO \\ \> where \\ \> {\it type} ::= REAL $\mid$ COMPLEX \\ \> {\it wp} ::= KIND(1.0) $\mid$ KIND(1.0D0) \\ \> {\it rhs} ::= B(:,:) $\mid$ B(:) \\ \end{tabbing}} \section{Arguments} \begin{description} \item[A --] ({\em input/output}) either {\bf REAL} or {\bf COMPLEX} square array, shape $(:,:)$, $size(A,1)=size(A,2)$. \begin{itemize} \item On entry, the matrix $A$. \item On exit, the factors $L$ and $U$ from the factorization $A=P L U$; the unit diagonal elements of $L$ are not stored. \end{itemize} \item[B --] ({\em input/output}) either {\bf REAL} or {\bf COMPLEX} rectangular array, shape either $(:,:)$ or $(:)$, $size(B,1)$ or $size(B)=size(A,1)$. \begin{itemize} \item On entry, the right hand side vector(s) of matrix $B$ for the system of equations $A X=B$. \item On exit, if there is no error, the matrix of solution vector(s) $X$. \end{itemize} \item[IPIV --] {\em Optional} ({\em output}) {\bf INTEGER} array, shape $(:)$, $size(IPIV)=size(A,1)$. If $IPIV$ is present, it contains indices that define the permutation matrix $P$; row $i$ of the matrix was interchanged with row $IPIV(i)$. \item[INFO --] {\em Optional} ({\em output}) {\bf INTEGER}. \begin{itemize} \item If $INFO$ is present \begin{description} \item[$= 0$]: successful exit \item[$< 0$]: if $INFO=-i$, the $i$-th argument had an illegal value \item[$ \geq 0$]: if $INFO=k$, $U(k,k)$ is exactly zero. The factorization has been completed, but the factor $U$ is exactly singular, so the solution could not be computed. \end{description} \item If $INFO$ is not present and an error occurs, then the program is terminated with an error message. \end{itemize} \end{description} \section{Additional Interfaces} There are two further interfaces for LA\_GESV that may be useful if the user's computer causes additional copies of $A$ and $B$ to be made internally. The first is useful if the declared array sizes correspond to the actual sizes for the problem to be solved, and the second if the declared sizes may be longer than the actual problem to be solved. \begin{itemize} \item The declared array sizes correspond to the actual sizes for the problem to be solved: \vbox{ \begin{tabbing} SUB\= ROUTINE LA\_GESV( A, B, IPIV, INFO, N{\it nrhs} ) \\ \> INTEGER, INTENT(IN) :: N{\it nrhs} ) \\ \> {\it type}({\it wp}), DIMENSION(N,N) :: A \\ \> {\it type}({\it wp}), DIMENSION(shapeb) :: B \\ \> INTEGER, DIMENSION(N), OPTIONAL :: IPIV \\ \> INTEGER, INTENT(OUT), OPTIONAL :: INFO \\ \> where \\ \> {\it type} ::= REAL $\mid$ COMPLEX \\ \> {\it wp} ::= KIND(1.0) $\mid$ KIND(1.0D0) \\ \> {\it shapeb} ::= N,N $\mid$ N \\ \> {\it nrhs} ::= \= , NRHS if {\it shapeb} = N,N $\mid$ \\ \> \> dummy if {\it shapeb} = N \\ \end{tabbing}} \item The declared array sizes may be longer than the actual sizes for the problem to be solved: \vbox{ \begin{tabbing} SUB\= ROUTINE LA\_GESV ( A, B, IPIV, INFO, N, {\it more\_arg} ) \\ \> INTEGER, INTENT(IN) :: {\it more\_arg} ) \\ \> {\it type}({\it wp}), DIMENSION(LDA,N) :: A \\ \> {\it type}({\it wp}), DIMENSION({\it shapeb}) :: B \\ \> INTEGER, DIMENSION(N), OPTIONAL :: IPIV \\ \> INTEGER, INTENT(OUT), OPTIONAL :: INFO \\ \> where \\ \> {\it type} ::= REAL $\mid$ COMPLEX \\ \> {\it wp} ::= KIND(1.0) $\mid$ KIND(1.0D0) \\ \> {\it shapeb} ::= LDB,N $\mid$ N \\ \> {\it more\_arg} ::= \= NRHS, LDA, LDB if {\it shapeb} = LDB,N $\mid$ \\ \> \> LDA if {\it shapeb} = N \\ \end{tabbing}} \end{itemize} .