LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ ctptrs()

subroutine ctptrs ( character  UPLO,
character  TRANS,
character  DIAG,
integer  N,
integer  NRHS,
complex, dimension( * )  AP,
complex, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

CTPTRS

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

Purpose:
 CTPTRS solves a triangular system of the form

    A * X = B,  A**T * X = B,  or  A**H * X = B,

 where A is a triangular matrix of order N stored in packed format,
 and B is an N-by-NRHS matrix.  A check is made to verify that A is
 nonsingular.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  A is upper triangular;
          = 'L':  A is lower triangular.
[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]DIAG
          DIAG is CHARACTER*1
          = 'N':  A is non-unit triangular;
          = 'U':  A is unit triangular.
[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]AP
          AP is COMPLEX array, dimension (N*(N+1)/2)
          The upper or lower triangular matrix A, packed columnwise in
          a linear array.  The j-th column of A is stored in the array
          AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side matrix B.
          On exit, if INFO = 0, 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
          > 0:  if INFO = i, the i-th diagonal element of A is zero,
                indicating that the matrix is singular and the
                solutions X have not been computed.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 129 of file ctptrs.f.

130 *
131 * -- LAPACK computational routine --
132 * -- LAPACK is a software package provided by Univ. of Tennessee, --
133 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 *
135 * .. Scalar Arguments ..
136  CHARACTER DIAG, TRANS, UPLO
137  INTEGER INFO, LDB, N, NRHS
138 * ..
139 * .. Array Arguments ..
140  COMPLEX AP( * ), B( LDB, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  COMPLEX ZERO
147  parameter( zero = ( 0.0e+0, 0.0e+0 ) )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL NOUNIT, UPPER
151  INTEGER J, JC
152 * ..
153 * .. External Functions ..
154  LOGICAL LSAME
155  EXTERNAL lsame
156 * ..
157 * .. External Subroutines ..
158  EXTERNAL ctpsv, xerbla
159 * ..
160 * .. Intrinsic Functions ..
161  INTRINSIC max
162 * ..
163 * .. Executable Statements ..
164 *
165 * Test the input parameters.
166 *
167  info = 0
168  upper = lsame( uplo, 'U' )
169  nounit = lsame( diag, 'N' )
170  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
171  info = -1
172  ELSE IF( .NOT.lsame( trans, 'N' ) .AND. .NOT.
173  $ lsame( trans, 'T' ) .AND. .NOT.lsame( trans, 'C' ) ) THEN
174  info = -2
175  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
176  info = -3
177  ELSE IF( n.LT.0 ) THEN
178  info = -4
179  ELSE IF( nrhs.LT.0 ) THEN
180  info = -5
181  ELSE IF( ldb.LT.max( 1, n ) ) THEN
182  info = -8
183  END IF
184  IF( info.NE.0 ) THEN
185  CALL xerbla( 'CTPTRS', -info )
186  RETURN
187  END IF
188 *
189 * Quick return if possible
190 *
191  IF( n.EQ.0 )
192  $ RETURN
193 *
194 * Check for singularity.
195 *
196  IF( nounit ) THEN
197  IF( upper ) THEN
198  jc = 1
199  DO 10 info = 1, n
200  IF( ap( jc+info-1 ).EQ.zero )
201  $ RETURN
202  jc = jc + info
203  10 CONTINUE
204  ELSE
205  jc = 1
206  DO 20 info = 1, n
207  IF( ap( jc ).EQ.zero )
208  $ RETURN
209  jc = jc + n - info + 1
210  20 CONTINUE
211  END IF
212  END IF
213  info = 0
214 *
215 * Solve A * x = b, A**T * x = b, or A**H * x = b.
216 *
217  DO 30 j = 1, nrhs
218  CALL ctpsv( uplo, trans, diag, n, ap, b( 1, j ), 1 )
219  30 CONTINUE
220 *
221  RETURN
222 *
223 * End of CTPTRS
224 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine ctpsv(UPLO, TRANS, DIAG, N, AP, X, INCX)
CTPSV
Definition: ctpsv.f:144
Here is the call graph for this function:
Here is the caller graph for this function: