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