LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cgetrs()

subroutine cgetrs ( character  TRANS,
integer  N,
integer  NRHS,
complex, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
complex, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

CGETRS

Download CGETRS + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CGETRS solves a system of linear equations
    A * X = B,  A**T * X = B,  or  A**H * X = B
 with a general N-by-N matrix A using the LU factorization computed
 by CGETRF.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the form of the system of equations:
          = 'N':  A * X = B     (No transpose)
          = 'T':  A**T * X = B  (Transpose)
          = 'C':  A**H * X = B  (Conjugate transpose)
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrix B.  NRHS >= 0.
[in]A
          A is COMPLEX array, dimension (LDA,N)
          The factors L and U from the factorization A = P*L*U
          as computed by CGETRF.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from CGETRF; for 1<=i<=N, row i of the
          matrix was interchanged with row IPIV(i).
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side matrix B.
          On exit, the solution matrix X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 123 of file cgetrs.f.

123 *
124 * -- LAPACK computational routine (version 3.7.0) --
125 * -- LAPACK is a software package provided by Univ. of Tennessee, --
126 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127 * December 2016
128 *
129 * .. Scalar Arguments ..
130  CHARACTER trans
131  INTEGER info, lda, ldb, n, nrhs
132 * ..
133 * .. Array Arguments ..
134  INTEGER ipiv( * )
135  COMPLEX a( lda, * ), b( ldb, * )
136 * ..
137 *
138 * =====================================================================
139 *
140 * .. Parameters ..
141  COMPLEX one
142  parameter( one = ( 1.0e+0, 0.0e+0 ) )
143 * ..
144 * .. Local Scalars ..
145  LOGICAL notran
146 * ..
147 * .. External Functions ..
148  LOGICAL lsame
149  EXTERNAL lsame
150 * ..
151 * .. External Subroutines ..
152  EXTERNAL claswp, ctrsm, xerbla
153 * ..
154 * .. Intrinsic Functions ..
155  INTRINSIC max
156 * ..
157 * .. Executable Statements ..
158 *
159 * Test the input parameters.
160 *
161  info = 0
162  notran = lsame( trans, 'N' )
163  IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
164  $ lsame( trans, 'C' ) ) THEN
165  info = -1
166  ELSE IF( n.LT.0 ) THEN
167  info = -2
168  ELSE IF( nrhs.LT.0 ) THEN
169  info = -3
170  ELSE IF( lda.LT.max( 1, n ) ) THEN
171  info = -5
172  ELSE IF( ldb.LT.max( 1, n ) ) THEN
173  info = -8
174  END IF
175  IF( info.NE.0 ) THEN
176  CALL xerbla( 'CGETRS', -info )
177  RETURN
178  END IF
179 *
180 * Quick return if possible
181 *
182  IF( n.EQ.0 .OR. nrhs.EQ.0 )
183  $ RETURN
184 *
185  IF( notran ) THEN
186 *
187 * Solve A * X = B.
188 *
189 * Apply row interchanges to the right hand sides.
190 *
191  CALL claswp( nrhs, b, ldb, 1, n, ipiv, 1 )
192 *
193 * Solve L*X = B, overwriting B with X.
194 *
195  CALL ctrsm( 'Left', 'Lower', 'No transpose', 'Unit', n, nrhs,
196  $ one, a, lda, b, ldb )
197 *
198 * Solve U*X = B, overwriting B with X.
199 *
200  CALL ctrsm( 'Left', 'Upper', 'No transpose', 'Non-unit', n,
201  $ nrhs, one, a, lda, b, ldb )
202  ELSE
203 *
204 * Solve A**T * X = B or A**H * X = B.
205 *
206 * Solve U**T *X = B or U**H *X = B, overwriting B with X.
207 *
208  CALL ctrsm( 'Left', 'Upper', trans, 'Non-unit', n, nrhs, one,
209  $ a, lda, b, ldb )
210 *
211 * Solve L**T *X = B, or L**H *X = B overwriting B with X.
212 *
213  CALL ctrsm( 'Left', 'Lower', trans, 'Unit', n, nrhs, one, a,
214  $ lda, b, ldb )
215 *
216 * Apply row interchanges to the solution vectors.
217 *
218  CALL claswp( nrhs, b, ldb, 1, n, ipiv, -1 )
219  END IF
220 *
221  RETURN
222 *
223 * End of CGETRS
224 *
subroutine claswp(N, A, LDA, K1, K2, IPIV, INCX)
CLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: claswp.f:117
subroutine ctrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
CTRSM
Definition: ctrsm.f:182
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: