LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cptts2()

subroutine cptts2 ( integer  iuplo,
integer  n,
integer  nrhs,
real, dimension( * )  d,
complex, dimension( * )  e,
complex, dimension( ldb, * )  b,
integer  ldb 
)

CPTTS2 solves a tridiagonal system of the form AX=B using the L D LH factorization computed by spttrf.

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

Purpose:
 CPTTS2 solves a tridiagonal system of the form
    A * X = B
 using the factorization A = U**H*D*U or A = L*D*L**H computed by CPTTRF.
 D is a diagonal matrix specified in the vector D, U (or L) is a unit
 bidiagonal matrix whose superdiagonal (subdiagonal) is specified in
 the vector E, and X and B are N by NRHS matrices.
Parameters
[in]IUPLO
          IUPLO is INTEGER
          Specifies the form of the factorization and whether the
          vector E is the superdiagonal of the upper bidiagonal factor
          U or the subdiagonal of the lower bidiagonal factor L.
          = 1:  A = U**H *D*U, E is the superdiagonal of U
          = 0:  A = L*D*L**H, E is the subdiagonal of L
[in]N
          N is INTEGER
          The order of the tridiagonal 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]D
          D is REAL array, dimension (N)
          The n diagonal elements of the diagonal matrix D from the
          factorization A = U**H *D*U or A = L*D*L**H.
[in]E
          E is COMPLEX array, dimension (N-1)
          If IUPLO = 1, the (n-1) superdiagonal elements of the unit
          bidiagonal factor U from the factorization A = U**H*D*U.
          If IUPLO = 0, the (n-1) subdiagonal elements of the unit
          bidiagonal factor L from the factorization A = L*D*L**H.
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side vectors B for the system of
          linear equations.
          On exit, the solution vectors, X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 112 of file cptts2.f.

113*
114* -- LAPACK computational routine --
115* -- LAPACK is a software package provided by Univ. of Tennessee, --
116* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117*
118* .. Scalar Arguments ..
119 INTEGER IUPLO, LDB, N, NRHS
120* ..
121* .. Array Arguments ..
122 REAL D( * )
123 COMPLEX B( LDB, * ), E( * )
124* ..
125*
126* =====================================================================
127*
128* .. Local Scalars ..
129 INTEGER I, J
130* ..
131* .. External Subroutines ..
132 EXTERNAL csscal
133* ..
134* .. Intrinsic Functions ..
135 INTRINSIC conjg
136* ..
137* .. Executable Statements ..
138*
139* Quick return if possible
140*
141 IF( n.LE.1 ) THEN
142 IF( n.EQ.1 )
143 $ CALL csscal( nrhs, 1. / d( 1 ), b, ldb )
144 RETURN
145 END IF
146*
147 IF( iuplo.EQ.1 ) THEN
148*
149* Solve A * X = B using the factorization A = U**H *D*U,
150* overwriting each right hand side vector with its solution.
151*
152 IF( nrhs.LE.2 ) THEN
153 j = 1
154 5 CONTINUE
155*
156* Solve U**H * x = b.
157*
158 DO 10 i = 2, n
159 b( i, j ) = b( i, j ) - b( i-1, j )*conjg( e( i-1 ) )
160 10 CONTINUE
161*
162* Solve D * U * x = b.
163*
164 DO 20 i = 1, n
165 b( i, j ) = b( i, j ) / d( i )
166 20 CONTINUE
167 DO 30 i = n - 1, 1, -1
168 b( i, j ) = b( i, j ) - b( i+1, j )*e( i )
169 30 CONTINUE
170 IF( j.LT.nrhs ) THEN
171 j = j + 1
172 GO TO 5
173 END IF
174 ELSE
175 DO 60 j = 1, nrhs
176*
177* Solve U**H * x = b.
178*
179 DO 40 i = 2, n
180 b( i, j ) = b( i, j ) - b( i-1, j )*conjg( e( i-1 ) )
181 40 CONTINUE
182*
183* Solve D * U * x = b.
184*
185 b( n, j ) = b( n, j ) / d( n )
186 DO 50 i = n - 1, 1, -1
187 b( i, j ) = b( i, j ) / d( i ) - b( i+1, j )*e( i )
188 50 CONTINUE
189 60 CONTINUE
190 END IF
191 ELSE
192*
193* Solve A * X = B using the factorization A = L*D*L**H,
194* overwriting each right hand side vector with its solution.
195*
196 IF( nrhs.LE.2 ) THEN
197 j = 1
198 65 CONTINUE
199*
200* Solve L * x = b.
201*
202 DO 70 i = 2, n
203 b( i, j ) = b( i, j ) - b( i-1, j )*e( i-1 )
204 70 CONTINUE
205*
206* Solve D * L**H * x = b.
207*
208 DO 80 i = 1, n
209 b( i, j ) = b( i, j ) / d( i )
210 80 CONTINUE
211 DO 90 i = n - 1, 1, -1
212 b( i, j ) = b( i, j ) - b( i+1, j )*conjg( e( i ) )
213 90 CONTINUE
214 IF( j.LT.nrhs ) THEN
215 j = j + 1
216 GO TO 65
217 END IF
218 ELSE
219 DO 120 j = 1, nrhs
220*
221* Solve L * x = b.
222*
223 DO 100 i = 2, n
224 b( i, j ) = b( i, j ) - b( i-1, j )*e( i-1 )
225 100 CONTINUE
226*
227* Solve D * L**H * x = b.
228*
229 b( n, j ) = b( n, j ) / d( n )
230 DO 110 i = n - 1, 1, -1
231 b( i, j ) = b( i, j ) / d( i ) -
232 $ b( i+1, j )*conjg( e( i ) )
233 110 CONTINUE
234 120 CONTINUE
235 END IF
236 END IF
237*
238 RETURN
239*
240* End of CPTTS2
241*
subroutine csscal(n, sa, cx, incx)
CSSCAL
Definition csscal.f:78
Here is the call graph for this function:
Here is the caller graph for this function: