LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
chesv_rk.f
Go to the documentation of this file.
1*> \brief <b> CHESV_RK computes the solution to system of linear equations A * X = B for SY matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CHESV_RK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/chesv_rk.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/chesv_rk.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/chesv_rk.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CHESV_RK( UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB,
20* WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER UPLO
24* INTEGER INFO, LDA, LDB, LWORK, N, NRHS
25* ..
26* .. Array Arguments ..
27* INTEGER IPIV( * )
28* COMPLEX A( LDA, * ), B( LDB, * ), E( * ), WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*> CHESV_RK computes the solution to a complex system of linear
37*> equations A * X = B, where A is an N-by-N Hermitian matrix
38*> and X and B are N-by-NRHS matrices.
39*>
40*> The bounded Bunch-Kaufman (rook) diagonal pivoting method is used
41*> to factor A as
42*> A = P*U*D*(U**H)*(P**T), if UPLO = 'U', or
43*> A = P*L*D*(L**H)*(P**T), if UPLO = 'L',
44*> where U (or L) is unit upper (or lower) triangular matrix,
45*> U**H (or L**H) is the conjugate of U (or L), P is a permutation
46*> matrix, P**T is the transpose of P, and D is Hermitian and block
47*> diagonal with 1-by-1 and 2-by-2 diagonal blocks.
48*>
49*> CHETRF_RK is called to compute the factorization of a complex
50*> Hermitian matrix. The factored form of A is then used to solve
51*> the system of equations A * X = B by calling BLAS3 routine CHETRS_3.
52*> \endverbatim
53*
54* Arguments:
55* ==========
56*
57*> \param[in] UPLO
58*> \verbatim
59*> UPLO is CHARACTER*1
60*> Specifies whether the upper or lower triangular part of the
61*> Hermitian matrix A is stored:
62*> = 'U': Upper triangle of A is stored;
63*> = 'L': Lower triangle of A is stored.
64*> \endverbatim
65*>
66*> \param[in] N
67*> \verbatim
68*> N is INTEGER
69*> The number of linear equations, i.e., the order of the
70*> matrix A. N >= 0.
71*> \endverbatim
72*>
73*> \param[in] NRHS
74*> \verbatim
75*> NRHS is INTEGER
76*> The number of right hand sides, i.e., the number of columns
77*> of the matrix B. NRHS >= 0.
78*> \endverbatim
79*>
80*> \param[in,out] A
81*> \verbatim
82*> A is COMPLEX array, dimension (LDA,N)
83*> On entry, the Hermitian matrix A.
84*> If UPLO = 'U': the leading N-by-N upper triangular part
85*> of A contains the upper triangular part of the matrix A,
86*> and the strictly lower triangular part of A is not
87*> referenced.
88*>
89*> If UPLO = 'L': the leading N-by-N lower triangular part
90*> of A contains the lower triangular part of the matrix A,
91*> and the strictly upper triangular part of A is not
92*> referenced.
93*>
94*> On exit, if INFO = 0, diagonal of the block diagonal
95*> matrix D and factors U or L as computed by CHETRF_RK:
96*> a) ONLY diagonal elements of the Hermitian block diagonal
97*> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
98*> (superdiagonal (or subdiagonal) elements of D
99*> are stored on exit in array E), and
100*> b) If UPLO = 'U': factor U in the superdiagonal part of A.
101*> If UPLO = 'L': factor L in the subdiagonal part of A.
102*>
103*> For more info see the description of CHETRF_RK routine.
104*> \endverbatim
105*>
106*> \param[in] LDA
107*> \verbatim
108*> LDA is INTEGER
109*> The leading dimension of the array A. LDA >= max(1,N).
110*> \endverbatim
111*>
112*> \param[out] E
113*> \verbatim
114*> E is COMPLEX array, dimension (N)
115*> On exit, contains the output computed by the factorization
116*> routine CHETRF_RK, i.e. the superdiagonal (or subdiagonal)
117*> elements of the Hermitian block diagonal matrix D
118*> with 1-by-1 or 2-by-2 diagonal blocks, where
119*> If UPLO = 'U': E(i) = D(i-1,i), i=2:N, E(1) is set to 0;
120*> If UPLO = 'L': E(i) = D(i+1,i), i=1:N-1, E(N) is set to 0.
121*>
122*> NOTE: For 1-by-1 diagonal block D(k), where
123*> 1 <= k <= N, the element E(k) is set to 0 in both
124*> UPLO = 'U' or UPLO = 'L' cases.
125*>
126*> For more info see the description of CHETRF_RK routine.
127*> \endverbatim
128*>
129*> \param[out] IPIV
130*> \verbatim
131*> IPIV is INTEGER array, dimension (N)
132*> Details of the interchanges and the block structure of D,
133*> as determined by CHETRF_RK.
134*>
135*> For more info see the description of CHETRF_RK routine.
136*> \endverbatim
137*>
138*> \param[in,out] B
139*> \verbatim
140*> B is COMPLEX array, dimension (LDB,NRHS)
141*> On entry, the N-by-NRHS right hand side matrix B.
142*> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
143*> \endverbatim
144*>
145*> \param[in] LDB
146*> \verbatim
147*> LDB is INTEGER
148*> The leading dimension of the array B. LDB >= max(1,N).
149*> \endverbatim
150*>
151*> \param[out] WORK
152*> \verbatim
153*> WORK is COMPLEX array, dimension ( MAX(1,LWORK) ).
154*> Work array used in the factorization stage.
155*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
156*> \endverbatim
157*>
158*> \param[in] LWORK
159*> \verbatim
160*> LWORK is INTEGER
161*> The length of WORK. LWORK >= 1. For best performance
162*> of factorization stage LWORK >= max(1,N*NB), where NB is
163*> the optimal blocksize for CHETRF_RK.
164*>
165*> If LWORK = -1, then a workspace query is assumed;
166*> the routine only calculates the optimal size of the WORK
167*> array for factorization stage, returns this value as
168*> the first entry of the WORK array, and no error message
169*> related to LWORK is issued by XERBLA.
170*> \endverbatim
171*>
172*> \param[out] INFO
173*> \verbatim
174*> INFO is INTEGER
175*> = 0: successful exit
176*>
177*> < 0: If INFO = -k, the k-th argument had an illegal value
178*>
179*> > 0: If INFO = k, the matrix A is singular, because:
180*> If UPLO = 'U': column k in the upper
181*> triangular part of A contains all zeros.
182*> If UPLO = 'L': column k in the lower
183*> triangular part of A contains all zeros.
184*>
185*> Therefore D(k,k) is exactly zero, and superdiagonal
186*> elements of column k of U (or subdiagonal elements of
187*> column k of L ) are all zeros. The factorization has
188*> been completed, but the block diagonal matrix D is
189*> exactly singular, and division by zero will occur if
190*> it is used to solve a system of equations.
191*>
192*> NOTE: INFO only stores the first occurrence of
193*> a singularity, any subsequent occurrence of singularity
194*> is not stored in INFO even though the factorization
195*> always completes.
196*> \endverbatim
197*
198* Authors:
199* ========
200*
201*> \author Univ. of Tennessee
202*> \author Univ. of California Berkeley
203*> \author Univ. of Colorado Denver
204*> \author NAG Ltd.
205*
206*> \ingroup hesv_rk
207*
208*> \par Contributors:
209* ==================
210*>
211*> \verbatim
212*>
213*> December 2016, Igor Kozachenko,
214*> Computer Science Division,
215*> University of California, Berkeley
216*>
217*> September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas,
218*> School of Mathematics,
219*> University of Manchester
220*>
221*> \endverbatim
222*
223* =====================================================================
224 SUBROUTINE chesv_rk( UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB,
225 $ WORK,
226 $ LWORK, INFO )
227*
228* -- LAPACK driver routine --
229* -- LAPACK is a software package provided by Univ. of Tennessee, --
230* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
231*
232* .. Scalar Arguments ..
233 CHARACTER UPLO
234 INTEGER INFO, LDA, LDB, LWORK, N, NRHS
235* ..
236* .. Array Arguments ..
237 INTEGER IPIV( * )
238 COMPLEX A( LDA, * ), B( LDB, * ), E( * ), WORK( * )
239* ..
240*
241* =====================================================================
242*
243* .. Local Scalars ..
244 LOGICAL LQUERY
245 INTEGER LWKOPT
246* ..
247* .. External Functions ..
248 LOGICAL LSAME
249 REAL SROUNDUP_LWORK
250 EXTERNAL lsame, sroundup_lwork
251* ..
252* .. External Subroutines ..
253 EXTERNAL xerbla, chetrf_rk, chetrs_3
254* ..
255* .. Intrinsic Functions ..
256 INTRINSIC max
257* ..
258* .. Executable Statements ..
259*
260* Test the input parameters.
261*
262 info = 0
263 lquery = ( lwork.EQ.-1 )
264 IF( .NOT.lsame( uplo, 'U' ) .AND.
265 $ .NOT.lsame( uplo, 'L' ) ) THEN
266 info = -1
267 ELSE IF( n.LT.0 ) THEN
268 info = -2
269 ELSE IF( nrhs.LT.0 ) THEN
270 info = -3
271 ELSE IF( lda.LT.max( 1, n ) ) THEN
272 info = -5
273 ELSE IF( ldb.LT.max( 1, n ) ) THEN
274 info = -9
275 ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
276 info = -11
277 END IF
278*
279 IF( info.EQ.0 ) THEN
280 IF( n.EQ.0 ) THEN
281 lwkopt = 1
282 ELSE
283 CALL chetrf_rk( uplo, n, a, lda, e, ipiv, work, -1,
284 $ info )
285 lwkopt = int( work( 1 ) )
286 END IF
287 work( 1 ) = sroundup_lwork(lwkopt)
288 END IF
289*
290 IF( info.NE.0 ) THEN
291 CALL xerbla( 'CHESV_RK ', -info )
292 RETURN
293 ELSE IF( lquery ) THEN
294 RETURN
295 END IF
296*
297* Compute the factorization A = U*D*U**T or A = L*D*L**T.
298*
299 CALL chetrf_rk( uplo, n, a, lda, e, ipiv, work, lwork, info )
300*
301 IF( info.EQ.0 ) THEN
302*
303* Solve the system A*X = B with BLAS3 solver, overwriting B with X.
304*
305 CALL chetrs_3( uplo, n, nrhs, a, lda, e, ipiv, b, ldb,
306 $ info )
307*
308 END IF
309*
310 work( 1 ) = sroundup_lwork(lwkopt)
311*
312 RETURN
313*
314* End of CHESV_RK
315*
316 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine chesv_rk(uplo, n, nrhs, a, lda, e, ipiv, b, ldb, work, lwork, info)
CHESV_RK computes the solution to system of linear equations A * X = B for SY matrices
Definition chesv_rk.f:227
subroutine chetrf_rk(uplo, n, a, lda, e, ipiv, work, lwork, info)
CHETRF_RK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bunch...
Definition chetrf_rk.f:257
subroutine chetrs_3(uplo, n, nrhs, a, lda, e, ipiv, b, ldb, info)
CHETRS_3
Definition chetrs_3.f:163