![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CTRTRS 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CTRTRS + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctrtrs.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctrtrs.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctrtrs.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE CTRTRS( UPLO, TRANS, DIAG, N, NRHS, A, LDA, B, LDB, 00022 * INFO ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER DIAG, TRANS, UPLO 00026 * INTEGER INFO, LDA, LDB, N, NRHS 00027 * .. 00028 * .. Array Arguments .. 00029 * COMPLEX A( LDA, * ), B( LDB, * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> CTRTRS solves a triangular system of the form 00039 *> 00040 *> A * X = B, A**T * X = B, or A**H * X = B, 00041 *> 00042 *> where A is a triangular matrix of order N, and B is an N-by-NRHS 00043 *> matrix. A check is made to verify that A is nonsingular. 00044 *> \endverbatim 00045 * 00046 * Arguments: 00047 * ========== 00048 * 00049 *> \param[in] UPLO 00050 *> \verbatim 00051 *> UPLO is CHARACTER*1 00052 *> = 'U': A is upper triangular; 00053 *> = 'L': A is lower triangular. 00054 *> \endverbatim 00055 *> 00056 *> \param[in] TRANS 00057 *> \verbatim 00058 *> TRANS is CHARACTER*1 00059 *> Specifies the form of the system of equations: 00060 *> = 'N': A * X = B (No transpose) 00061 *> = 'T': A**T * X = B (Transpose) 00062 *> = 'C': A**H * X = B (Conjugate transpose) 00063 *> \endverbatim 00064 *> 00065 *> \param[in] DIAG 00066 *> \verbatim 00067 *> DIAG is CHARACTER*1 00068 *> = 'N': A is non-unit triangular; 00069 *> = 'U': A is unit triangular. 00070 *> \endverbatim 00071 *> 00072 *> \param[in] N 00073 *> \verbatim 00074 *> N is INTEGER 00075 *> The order of the matrix A. N >= 0. 00076 *> \endverbatim 00077 *> 00078 *> \param[in] NRHS 00079 *> \verbatim 00080 *> NRHS is INTEGER 00081 *> The number of right hand sides, i.e., the number of columns 00082 *> of the matrix B. NRHS >= 0. 00083 *> \endverbatim 00084 *> 00085 *> \param[in] A 00086 *> \verbatim 00087 *> A is COMPLEX array, dimension (LDA,N) 00088 *> The triangular matrix A. If UPLO = 'U', the leading N-by-N 00089 *> upper triangular part of the array A contains the upper 00090 *> triangular matrix, and the strictly lower triangular part of 00091 *> A is not referenced. If UPLO = 'L', the leading N-by-N lower 00092 *> triangular part of the array A contains the lower triangular 00093 *> matrix, and the strictly upper triangular part of A is not 00094 *> referenced. If DIAG = 'U', the diagonal elements of A are 00095 *> also not referenced and are assumed to be 1. 00096 *> \endverbatim 00097 *> 00098 *> \param[in] LDA 00099 *> \verbatim 00100 *> LDA is INTEGER 00101 *> The leading dimension of the array A. LDA >= max(1,N). 00102 *> \endverbatim 00103 *> 00104 *> \param[in,out] B 00105 *> \verbatim 00106 *> B is COMPLEX array, dimension (LDB,NRHS) 00107 *> On entry, the right hand side matrix B. 00108 *> On exit, if INFO = 0, the solution matrix X. 00109 *> \endverbatim 00110 *> 00111 *> \param[in] LDB 00112 *> \verbatim 00113 *> LDB is INTEGER 00114 *> The leading dimension of the array B. LDB >= max(1,N). 00115 *> \endverbatim 00116 *> 00117 *> \param[out] INFO 00118 *> \verbatim 00119 *> INFO is INTEGER 00120 *> = 0: successful exit 00121 *> < 0: if INFO = -i, the i-th argument had an illegal value 00122 *> > 0: if INFO = i, the i-th diagonal element of A is zero, 00123 *> indicating that the matrix is singular and the solutions 00124 *> X have not been computed. 00125 *> \endverbatim 00126 * 00127 * Authors: 00128 * ======== 00129 * 00130 *> \author Univ. of Tennessee 00131 *> \author Univ. of California Berkeley 00132 *> \author Univ. of Colorado Denver 00133 *> \author NAG Ltd. 00134 * 00135 *> \date November 2011 00136 * 00137 *> \ingroup complexOTHERcomputational 00138 * 00139 * ===================================================================== 00140 SUBROUTINE CTRTRS( UPLO, TRANS, DIAG, N, NRHS, A, LDA, B, LDB, 00141 $ INFO ) 00142 * 00143 * -- LAPACK computational routine (version 3.4.0) -- 00144 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00145 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00146 * November 2011 00147 * 00148 * .. Scalar Arguments .. 00149 CHARACTER DIAG, TRANS, UPLO 00150 INTEGER INFO, LDA, LDB, N, NRHS 00151 * .. 00152 * .. Array Arguments .. 00153 COMPLEX A( LDA, * ), B( LDB, * ) 00154 * .. 00155 * 00156 * ===================================================================== 00157 * 00158 * .. Parameters .. 00159 COMPLEX ZERO, ONE 00160 PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ), 00161 $ ONE = ( 1.0E+0, 0.0E+0 ) ) 00162 * .. 00163 * .. Local Scalars .. 00164 LOGICAL NOUNIT 00165 * .. 00166 * .. External Functions .. 00167 LOGICAL LSAME 00168 EXTERNAL LSAME 00169 * .. 00170 * .. External Subroutines .. 00171 EXTERNAL CTRSM, XERBLA 00172 * .. 00173 * .. Intrinsic Functions .. 00174 INTRINSIC MAX 00175 * .. 00176 * .. Executable Statements .. 00177 * 00178 * Test the input parameters. 00179 * 00180 INFO = 0 00181 NOUNIT = LSAME( DIAG, 'N' ) 00182 IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00183 INFO = -1 00184 ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT. 00185 $ LSAME( TRANS, 'T' ) .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN 00186 INFO = -2 00187 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN 00188 INFO = -3 00189 ELSE IF( N.LT.0 ) THEN 00190 INFO = -4 00191 ELSE IF( NRHS.LT.0 ) THEN 00192 INFO = -5 00193 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00194 INFO = -7 00195 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN 00196 INFO = -9 00197 END IF 00198 IF( INFO.NE.0 ) THEN 00199 CALL XERBLA( 'CTRTRS', -INFO ) 00200 RETURN 00201 END IF 00202 * 00203 * Quick return if possible 00204 * 00205 IF( N.EQ.0 ) 00206 $ RETURN 00207 * 00208 * Check for singularity. 00209 * 00210 IF( NOUNIT ) THEN 00211 DO 10 INFO = 1, N 00212 IF( A( INFO, INFO ).EQ.ZERO ) 00213 $ RETURN 00214 10 CONTINUE 00215 END IF 00216 INFO = 0 00217 * 00218 * Solve A * x = b, A**T * x = b, or A**H * x = b. 00219 * 00220 CALL CTRSM( 'Left', UPLO, TRANS, DIAG, N, NRHS, ONE, A, LDA, B, 00221 $ LDB ) 00222 * 00223 RETURN 00224 * 00225 * End of CTRTRS 00226 * 00227 END