LAPACK  3.4.2 LAPACK: Linear Algebra PACKage
spotrs.f
Go to the documentation of this file.
1 *> \brief \b SPOTRS
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spotrs.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spotrs.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spotrs.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE SPOTRS( UPLO, N, NRHS, A, LDA, B, LDB, INFO )
22 *
23 * .. Scalar Arguments ..
24 * CHARACTER UPLO
25 * INTEGER INFO, LDA, LDB, N, NRHS
26 * ..
27 * .. Array Arguments ..
28 * REAL A( LDA, * ), B( LDB, * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> SPOTRS solves a system of linear equations A*X = B with a symmetric
38 *> positive definite matrix A using the Cholesky factorization
39 *> A = U**T*U or A = L*L**T computed by SPOTRF.
40 *> \endverbatim
41 *
42 * Arguments:
43 * ==========
44 *
45 *> \param[in] UPLO
46 *> \verbatim
47 *> UPLO is CHARACTER*1
48 *> = 'U': Upper triangle of A is stored;
49 *> = 'L': Lower triangle of A is stored.
50 *> \endverbatim
51 *>
52 *> \param[in] N
53 *> \verbatim
54 *> N is INTEGER
55 *> The order of the matrix A. N >= 0.
56 *> \endverbatim
57 *>
58 *> \param[in] NRHS
59 *> \verbatim
60 *> NRHS is INTEGER
61 *> The number of right hand sides, i.e., the number of columns
62 *> of the matrix B. NRHS >= 0.
63 *> \endverbatim
64 *>
65 *> \param[in] A
66 *> \verbatim
67 *> A is REAL array, dimension (LDA,N)
68 *> The triangular factor U or L from the Cholesky factorization
69 *> A = U**T*U or A = L*L**T, as computed by SPOTRF.
70 *> \endverbatim
71 *>
72 *> \param[in] LDA
73 *> \verbatim
74 *> LDA is INTEGER
75 *> The leading dimension of the array A. LDA >= max(1,N).
76 *> \endverbatim
77 *>
78 *> \param[in,out] B
79 *> \verbatim
80 *> B is REAL array, dimension (LDB,NRHS)
81 *> On entry, the right hand side matrix B.
82 *> On exit, the solution matrix X.
83 *> \endverbatim
84 *>
85 *> \param[in] LDB
86 *> \verbatim
87 *> LDB is INTEGER
88 *> The leading dimension of the array B. LDB >= max(1,N).
89 *> \endverbatim
90 *>
91 *> \param[out] INFO
92 *> \verbatim
93 *> INFO is INTEGER
94 *> = 0: successful exit
95 *> < 0: if INFO = -i, the i-th argument had an illegal value
96 *> \endverbatim
97 *
98 * Authors:
99 * ========
100 *
101 *> \author Univ. of Tennessee
102 *> \author Univ. of California Berkeley
103 *> \author Univ. of Colorado Denver
104 *> \author NAG Ltd.
105 *
106 *> \date November 2011
107 *
108 *> \ingroup realPOcomputational
109 *
110 * =====================================================================
111  SUBROUTINE spotrs( UPLO, N, NRHS, A, LDA, B, LDB, INFO )
112 *
113 * -- LAPACK computational routine (version 3.4.0) --
114 * -- LAPACK is a software package provided by Univ. of Tennessee, --
115 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * November 2011
117 *
118 * .. Scalar Arguments ..
119  CHARACTER uplo
120  INTEGER info, lda, ldb, n, nrhs
121 * ..
122 * .. Array Arguments ..
123  REAL a( lda, * ), b( ldb, * )
124 * ..
125 *
126 * =====================================================================
127 *
128 * .. Parameters ..
129  REAL one
130  parameter( one = 1.0e+0 )
131 * ..
132 * .. Local Scalars ..
133  LOGICAL upper
134 * ..
135 * .. External Functions ..
136  LOGICAL lsame
137  EXTERNAL lsame
138 * ..
139 * .. External Subroutines ..
140  EXTERNAL strsm, xerbla
141 * ..
142 * .. Intrinsic Functions ..
143  INTRINSIC max
144 * ..
145 * .. Executable Statements ..
146 *
147 * Test the input parameters.
148 *
149  info = 0
150  upper = lsame( uplo, 'U' )
151  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
152  info = -1
153  ELSE IF( n.LT.0 ) THEN
154  info = -2
155  ELSE IF( nrhs.LT.0 ) THEN
156  info = -3
157  ELSE IF( lda.LT.max( 1, n ) ) THEN
158  info = -5
159  ELSE IF( ldb.LT.max( 1, n ) ) THEN
160  info = -7
161  END IF
162  IF( info.NE.0 ) THEN
163  CALL xerbla( 'SPOTRS', -info )
164  return
165  END IF
166 *
167 * Quick return if possible
168 *
169  IF( n.EQ.0 .OR. nrhs.EQ.0 )
170  \$ return
171 *
172  IF( upper ) THEN
173 *
174 * Solve A*X = B where A = U**T *U.
175 *
176 * Solve U**T *X = B, overwriting B with X.
177 *
178  CALL strsm( 'Left', 'Upper', 'Transpose', 'Non-unit', n, nrhs,
179  \$ one, a, lda, b, ldb )
180 *
181 * Solve U*X = B, overwriting B with X.
182 *
183  CALL strsm( 'Left', 'Upper', 'No transpose', 'Non-unit', n,
184  \$ nrhs, one, a, lda, b, ldb )
185  ELSE
186 *
187 * Solve A*X = B where A = L*L**T.
188 *
189 * Solve L*X = B, overwriting B with X.
190 *
191  CALL strsm( 'Left', 'Lower', 'No transpose', 'Non-unit', n,
192  \$ nrhs, one, a, lda, b, ldb )
193 *
194 * Solve L**T *X = B, overwriting B with X.
195 *
196  CALL strsm( 'Left', 'Lower', 'Transpose', 'Non-unit', n, nrhs,
197  \$ one, a, lda, b, ldb )
198  END IF
199 *
200  return
201 *
202 * End of SPOTRS
203 *
204  END