LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cspsv.f
Go to the documentation of this file.
1*> \brief <b> CSPSV computes the solution to system of linear equations A * X = B for OTHER matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download CSPSV + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cspsv.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cspsv.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cspsv.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE CSPSV( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER UPLO
25* INTEGER INFO, LDB, N, NRHS
26* ..
27* .. Array Arguments ..
28* INTEGER IPIV( * )
29* COMPLEX AP( * ), B( LDB, * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> CSPSV computes the solution to a complex system of linear equations
39*> A * X = B,
40*> where A is an N-by-N symmetric matrix stored in packed format and X
41*> and B are N-by-NRHS 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, D is symmetric and block diagonal with 1-by-1
48*> and 2-by-2 diagonal blocks. The factored form of A is then used to
49*> solve the system of equations A * X = B.
50*> \endverbatim
51*
52* Arguments:
53* ==========
54*
55*> \param[in] UPLO
56*> \verbatim
57*> UPLO is CHARACTER*1
58*> = 'U': Upper triangle of A is stored;
59*> = 'L': Lower triangle of A is stored.
60*> \endverbatim
61*>
62*> \param[in] N
63*> \verbatim
64*> N is INTEGER
65*> The number of linear equations, i.e., the order of the
66*> matrix A. N >= 0.
67*> \endverbatim
68*>
69*> \param[in] NRHS
70*> \verbatim
71*> NRHS is INTEGER
72*> The number of right hand sides, i.e., the number of columns
73*> of the matrix B. NRHS >= 0.
74*> \endverbatim
75*>
76*> \param[in,out] AP
77*> \verbatim
78*> AP is COMPLEX array, dimension (N*(N+1)/2)
79*> On entry, the upper or lower triangle of the symmetric matrix
80*> A, packed columnwise in a linear array. The j-th column of A
81*> is stored in the array AP as follows:
82*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
83*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
84*> See below for further details.
85*>
86*> On exit, the block diagonal matrix D and the multipliers used
87*> to obtain the factor U or L from the factorization
88*> A = U*D*U**T or A = L*D*L**T as computed by CSPTRF, stored as
89*> a packed triangular matrix in the same storage format as A.
90*> \endverbatim
91*>
92*> \param[out] IPIV
93*> \verbatim
94*> IPIV is INTEGER array, dimension (N)
95*> Details of the interchanges and the block structure of D, as
96*> determined by CSPTRF. If IPIV(k) > 0, then rows and columns
97*> k and IPIV(k) were interchanged, and D(k,k) is a 1-by-1
98*> diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0,
99*> then rows and columns k-1 and -IPIV(k) were interchanged and
100*> D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and
101*> IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and
102*> -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2
103*> diagonal block.
104*> \endverbatim
105*>
106*> \param[in,out] B
107*> \verbatim
108*> B is COMPLEX array, dimension (LDB,NRHS)
109*> On entry, the N-by-NRHS right hand side matrix B.
110*> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
111*> \endverbatim
112*>
113*> \param[in] LDB
114*> \verbatim
115*> LDB is INTEGER
116*> The leading dimension of the array B. LDB >= max(1,N).
117*> \endverbatim
118*>
119*> \param[out] INFO
120*> \verbatim
121*> INFO is INTEGER
122*> = 0: successful exit
123*> < 0: if INFO = -i, the i-th argument had an illegal value
124*> > 0: if INFO = i, D(i,i) is exactly zero. The factorization
125*> has been completed, but the block diagonal matrix D is
126*> exactly singular, so the solution could not be
127*> computed.
128*> \endverbatim
129*
130* Authors:
131* ========
132*
133*> \author Univ. of Tennessee
134*> \author Univ. of California Berkeley
135*> \author Univ. of Colorado Denver
136*> \author NAG Ltd.
137*
138*> \ingroup hpsv
139*
140*> \par Further Details:
141* =====================
142*>
143*> \verbatim
144*>
145*> The packed storage scheme is illustrated by the following example
146*> when N = 4, UPLO = 'U':
147*>
148*> Two-dimensional storage of the symmetric matrix A:
149*>
150*> a11 a12 a13 a14
151*> a22 a23 a24
152*> a33 a34 (aij = aji)
153*> a44
154*>
155*> Packed storage of the upper triangle of A:
156*>
157*> AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
158*> \endverbatim
159*>
160* =====================================================================
161 SUBROUTINE cspsv( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
162*
163* -- LAPACK driver routine --
164* -- LAPACK is a software package provided by Univ. of Tennessee, --
165* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
166*
167* .. Scalar Arguments ..
168 CHARACTER UPLO
169 INTEGER INFO, LDB, N, NRHS
170* ..
171* .. Array Arguments ..
172 INTEGER IPIV( * )
173 COMPLEX AP( * ), B( LDB, * )
174* ..
175*
176* =====================================================================
177*
178* .. External Functions ..
179 LOGICAL LSAME
180 EXTERNAL lsame
181* ..
182* .. External Subroutines ..
183 EXTERNAL csptrf, csptrs, xerbla
184* ..
185* .. Intrinsic Functions ..
186 INTRINSIC max
187* ..
188* .. Executable Statements ..
189*
190* Test the input parameters.
191*
192 info = 0
193 IF( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
194 info = -1
195 ELSE IF( n.LT.0 ) THEN
196 info = -2
197 ELSE IF( nrhs.LT.0 ) THEN
198 info = -3
199 ELSE IF( ldb.LT.max( 1, n ) ) THEN
200 info = -7
201 END IF
202 IF( info.NE.0 ) THEN
203 CALL xerbla( 'CSPSV ', -info )
204 RETURN
205 END IF
206*
207* Compute the factorization A = U*D*U**T or A = L*D*L**T.
208*
209 CALL csptrf( uplo, n, ap, ipiv, info )
210 IF( info.EQ.0 ) THEN
211*
212* Solve the system A*X = B, overwriting B with X.
213*
214 CALL csptrs( uplo, n, nrhs, ap, ipiv, b, ldb, info )
215*
216 END IF
217 RETURN
218*
219* End of CSPSV
220*
221 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cspsv(uplo, n, nrhs, ap, ipiv, b, ldb, info)
CSPSV computes the solution to system of linear equations A * X = B for OTHER matrices
Definition cspsv.f:162
subroutine csptrf(uplo, n, ap, ipiv, info)
CSPTRF
Definition csptrf.f:158
subroutine csptrs(uplo, n, nrhs, ap, ipiv, b, ldb, info)
CSPTRS
Definition csptrs.f:115