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