LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
ssysv_rook.f
Go to the documentation of this file.
1*> \brief <b> SSYSV_ROOK 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 SSYSV_ROOK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssysv_rook.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssysv_rook.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssysv_rook.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SSYSV_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* REAL A( LDA, * ), B( LDB, * ), WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> SSYSV_ROOK computes the solution to a real system of linear
38*> equations
39*> A * X = B,
40*> where A is an N-by-N symmetric matrix and X and B are N-by-NRHS
41*> matrices.
42*>
43*> The diagonal pivoting method is used 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 symmetric and block diagonal with
48*> 1-by-1 and 2-by-2 diagonal blocks.
49*>
50*> SSYTRF_ROOK is called to compute the factorization of a real
51*> symmetric 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 SSYTRS_ROOK.
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 REAL array, dimension (LDA,N)
85*> On entry, the symmetric 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**T or A = L*D*L**T as computed by
96*> SSYTRF_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*> as determined by SSYTRF_ROOK.
110*>
111*> If UPLO = 'U':
112*> If IPIV(k) > 0, then rows and columns k and IPIV(k)
113*> were interchanged and D(k,k) is a 1-by-1 diagonal block.
114*>
115*> If IPIV(k) < 0 and IPIV(k-1) < 0, then rows and
116*> columns k and -IPIV(k) were interchanged and rows and
117*> columns k-1 and -IPIV(k-1) were inerchaged,
118*> D(k-1:k,k-1:k) is a 2-by-2 diagonal block.
119*>
120*> If UPLO = 'L':
121*> If IPIV(k) > 0, then rows and columns k and IPIV(k)
122*> were interchanged and D(k,k) is a 1-by-1 diagonal block.
123*>
124*> If IPIV(k) < 0 and IPIV(k+1) < 0, then rows and
125*> columns k and -IPIV(k) were interchanged and rows and
126*> columns k+1 and -IPIV(k+1) were inerchaged,
127*> D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
128*> \endverbatim
129*>
130*> \param[in,out] B
131*> \verbatim
132*> B is REAL array, dimension (LDB,NRHS)
133*> On entry, the N-by-NRHS right hand side matrix B.
134*> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
135*> \endverbatim
136*>
137*> \param[in] LDB
138*> \verbatim
139*> LDB is INTEGER
140*> The leading dimension of the array B. LDB >= max(1,N).
141*> \endverbatim
142*>
143*> \param[out] WORK
144*> \verbatim
145*> WORK is REAL array, dimension (MAX(1,LWORK))
146*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
147*> \endverbatim
148*>
149*> \param[in] LWORK
150*> \verbatim
151*> LWORK is INTEGER
152*> The length of WORK. LWORK >= 1, and for best performance
153*> LWORK >= max(1,N*NB), where NB is the optimal blocksize for
154*> SSYTRF_ROOK.
155*>
156*> TRS will be done with Level 2 BLAS
157*>
158*> If LWORK = -1, then a workspace query is assumed; the routine
159*> only calculates the optimal size of the WORK array, returns
160*> this value as the first entry of the WORK array, and no error
161*> message related to LWORK is issued by XERBLA.
162*> \endverbatim
163*>
164*> \param[out] INFO
165*> \verbatim
166*> INFO is INTEGER
167*> = 0: successful exit
168*> < 0: if INFO = -i, the i-th argument had an illegal value
169*> > 0: if INFO = i, D(i,i) is exactly zero. The factorization
170*> has been completed, but the block diagonal matrix D is
171*> exactly singular, so the solution could not be computed.
172*> \endverbatim
173*
174* Authors:
175* ========
176*
177*> \author Univ. of Tennessee
178*> \author Univ. of California Berkeley
179*> \author Univ. of Colorado Denver
180*> \author NAG Ltd.
181*
182*> \ingroup hesv_rook
183*
184*> \par Contributors:
185* ==================
186*>
187*> \verbatim
188*>
189*> April 2012, 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 SUBROUTINE ssysv_rook( UPLO, N, NRHS, A, LDA, IPIV, B, LDB,
201 $ WORK,
202 $ LWORK, INFO )
203*
204* -- LAPACK driver routine --
205* -- LAPACK is a software package provided by Univ. of Tennessee, --
206* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
207*
208* .. Scalar Arguments ..
209 CHARACTER UPLO
210 INTEGER INFO, LDA, LDB, LWORK, N, NRHS
211* ..
212* .. Array Arguments ..
213 INTEGER IPIV( * )
214 REAL A( LDA, * ), B( LDB, * ), WORK( * )
215* ..
216*
217* =====================================================================
218*
219* .. Local Scalars ..
220 LOGICAL LQUERY
221 INTEGER LWKOPT
222* ..
223* .. External Functions ..
224 LOGICAL LSAME
225 REAL SROUNDUP_LWORK
226 EXTERNAL lsame, sroundup_lwork
227* ..
228* .. External Subroutines ..
230* ..
231* .. Intrinsic Functions ..
232 INTRINSIC max
233* ..
234* .. Executable Statements ..
235*
236* Test the input parameters.
237*
238 info = 0
239 lquery = ( lwork.EQ.-1 )
240 IF( .NOT.lsame( uplo, 'U' ) .AND.
241 $ .NOT.lsame( uplo, 'L' ) ) THEN
242 info = -1
243 ELSE IF( n.LT.0 ) THEN
244 info = -2
245 ELSE IF( nrhs.LT.0 ) THEN
246 info = -3
247 ELSE IF( lda.LT.max( 1, n ) ) THEN
248 info = -5
249 ELSE IF( ldb.LT.max( 1, n ) ) THEN
250 info = -8
251 ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
252 info = -10
253 END IF
254*
255 IF( info.EQ.0 ) THEN
256 IF( n.EQ.0 ) THEN
257 lwkopt = 1
258 ELSE
259 CALL ssytrf_rook( uplo, n, a, lda, ipiv, work, -1, info )
260 lwkopt = int( work( 1 ) )
261 END IF
262 work( 1 ) = sroundup_lwork(lwkopt)
263 END IF
264*
265 IF( info.NE.0 ) THEN
266 CALL xerbla( 'SSYSV_ROOK ', -info )
267 RETURN
268 ELSE IF( lquery ) THEN
269 RETURN
270 END IF
271*
272* Compute the factorization A = U*D*U**T or A = L*D*L**T.
273*
274 CALL ssytrf_rook( uplo, n, a, lda, ipiv, work, lwork, info )
275 IF( info.EQ.0 ) THEN
276*
277* Solve the system A*X = B, overwriting B with X.
278*
279* Solve with TRS_ROOK ( Use Level 2 BLAS)
280*
281 CALL ssytrs_rook( uplo, n, nrhs, a, lda, ipiv, b, ldb,
282 $ info )
283*
284 END IF
285*
286 work( 1 ) = sroundup_lwork(lwkopt)
287*
288 RETURN
289*
290* End of SSYSV_ROOK
291*
292 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ssysv_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, work, lwork, info)
SSYSV_ROOK computes the solution to system of linear equations A * X = B for SY matrices
Definition ssysv_rook.f:203
subroutine ssytrf_rook(uplo, n, a, lda, ipiv, work, lwork, info)
SSYTRF_ROOK
subroutine ssytrs_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
SSYTRS_ROOK