LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dsysv_rk.f
Go to the documentation of this file.
1*> \brief <b> DSYSV_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 DSYSV_RK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dsysv_rk.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dsysv_rk.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dsysv_rk.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DSYSV_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* DOUBLE PRECISION A( LDA, * ), B( LDB, * ), E( * ), WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*> DSYSV_RK computes the solution to a real system of linear
37*> equations A * X = B, where A is an N-by-N symmetric 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**T)*(P**T), if UPLO = 'U', or
43*> A = P*L*D*(L**T)*(P**T), if UPLO = 'L',
44*> where U (or L) is unit upper (or lower) triangular matrix,
45*> U**T (or L**T) is the transpose of U (or L), P is a permutation
46*> matrix, P**T is the transpose of P, and D is symmetric and block
47*> diagonal with 1-by-1 and 2-by-2 diagonal blocks.
48*>
49*> DSYTRF_RK is called to compute the factorization of a real
50*> symmetric matrix. The factored form of A is then used to solve
51*> the system of equations A * X = B by calling BLAS3 routine DSYTRS_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*> symmetric 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 DOUBLE PRECISION array, dimension (LDA,N)
83*> On entry, the symmetric 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 DSYTRF_RK:
96*> a) ONLY diagonal elements of the symmetric 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 DSYTRF_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 DOUBLE PRECISION array, dimension (N)
115*> On exit, contains the output computed by the factorization
116*> routine DSYTRF_RK, i.e. the superdiagonal (or subdiagonal)
117*> elements of the symmetric 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 DSYTRF_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 DSYTRF_RK.
134*>
135*> For more info see the description of DSYTRF_RK routine.
136*> \endverbatim
137*>
138*> \param[in,out] B
139*> \verbatim
140*> B is DOUBLE PRECISION 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 DOUBLE PRECISION 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 DSYTRF_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 dsysv_rk( UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB,
225 $ WORK, LWORK, INFO )
226*
227* -- LAPACK driver routine --
228* -- LAPACK is a software package provided by Univ. of Tennessee, --
229* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
230*
231* .. Scalar Arguments ..
232 CHARACTER UPLO
233 INTEGER INFO, LDA, LDB, LWORK, N, NRHS
234* ..
235* .. Array Arguments ..
236 INTEGER IPIV( * )
237 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), E( * ), WORK( * )
238* ..
239*
240* =====================================================================
241*
242* .. Local Scalars ..
243 LOGICAL LQUERY
244 INTEGER LWKOPT
245* ..
246* .. External Functions ..
247 LOGICAL LSAME
248 EXTERNAL lsame
249* ..
250* .. External Subroutines ..
251 EXTERNAL xerbla, dsytrf_rk, dsytrs_3
252* ..
253* .. Intrinsic Functions ..
254 INTRINSIC max
255* ..
256* .. Executable Statements ..
257*
258* Test the input parameters.
259*
260 info = 0
261 lquery = ( lwork.EQ.-1 )
262 IF( .NOT.lsame( uplo, 'U' ) .AND.
263 $ .NOT.lsame( uplo, 'L' ) ) THEN
264 info = -1
265 ELSE IF( n.LT.0 ) THEN
266 info = -2
267 ELSE IF( nrhs.LT.0 ) THEN
268 info = -3
269 ELSE IF( lda.LT.max( 1, n ) ) THEN
270 info = -5
271 ELSE IF( ldb.LT.max( 1, n ) ) THEN
272 info = -9
273 ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
274 info = -11
275 END IF
276*
277 IF( info.EQ.0 ) THEN
278 IF( n.EQ.0 ) THEN
279 lwkopt = 1
280 ELSE
281 CALL dsytrf_rk( uplo, n, a, lda, e, ipiv, work, -1,
282 $ info )
283 lwkopt = int( work( 1 ) )
284 END IF
285 work( 1 ) = lwkopt
286 END IF
287*
288 IF( info.NE.0 ) THEN
289 CALL xerbla( 'DSYSV_RK ', -info )
290 RETURN
291 ELSE IF( lquery ) THEN
292 RETURN
293 END IF
294*
295* Compute the factorization A = P*U*D*(U**T)*(P**T) or
296* A = P*U*D*(U**T)*(P**T).
297*
298 CALL dsytrf_rk( uplo, n, a, lda, e, ipiv, work, lwork, info )
299*
300 IF( info.EQ.0 ) THEN
301*
302* Solve the system A*X = B with BLAS3 solver, overwriting B with X.
303*
304 CALL dsytrs_3( uplo, n, nrhs, a, lda, e, ipiv, b, ldb,
305 $ info )
306*
307 END IF
308*
309 work( 1 ) = lwkopt
310*
311 RETURN
312*
313* End of DSYSV_RK
314*
315 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dsysv_rk(uplo, n, nrhs, a, lda, e, ipiv, b, ldb, work, lwork, info)
DSYSV_RK computes the solution to system of linear equations A * X = B for SY matrices
Definition dsysv_rk.f:226
subroutine dsytrf_rk(uplo, n, a, lda, e, ipiv, work, lwork, info)
DSYTRF_RK computes the factorization of a real symmetric indefinite matrix using the bounded Bunch-Ka...
Definition dsytrf_rk.f:257
subroutine dsytrs_3(uplo, n, nrhs, a, lda, e, ipiv, b, ldb, info)
DSYTRS_3
Definition dsytrs_3.f:163