1 *> \brief \b ZHETRS_AASEN
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZHETRS_AASEN + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhetrs_aasen.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhetrs_aasen.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhetrs_aasen.f">
21 * SUBROUTINE ZHETRS_AASEN( UPLO, N, NRHS, A, LDA, IPIV, B, LDB,
24 * .. Scalar Arguments ..
26 * INTEGER N, NRHS, LDA, LDB, LWORK, INFO
28 * .. Array Arguments ..
30 * COMPLEX*16 A( LDA, * ), B( LDB, * ), WORK( * )
39 *> ZHETRS_AASEN solves a system of linear equations A*X = B with a real
40 *> hermitian matrix A using the factorization A = U*T*U**T or
41 *> A = L*T*L**T computed by ZHETRF_AASEN.
49 *> UPLO is CHARACTER*1
50 *> Specifies whether the details of the factorization are stored
51 *> as an upper or lower triangular matrix.
52 *> = 'U': Upper triangular, form is A = U*T*U**T;
53 *> = 'L': Lower triangular, form is A = L*T*L**T.
59 *> The order of the matrix A. N >= 0.
65 *> The number of right hand sides, i.e., the number of columns
66 *> of the matrix B. NRHS >= 0.
71 *> A is COMPLEX*16 array, dimension (LDA,N)
72 *> Details of factors computed by ZHETRF_AASEN.
78 *> The leading dimension of the array A. LDA >= max(1,N).
83 *> IPIV is INTEGER array, dimension (N)
84 *> Details of the interchanges as computed by ZHETRF_AASEN.
89 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
90 *> On entry, the right hand side matrix B.
91 *> On exit, the solution matrix X.
97 *> The leading dimension of the array B. LDB >= max(1,N).
102 *> WORK is DOUBLE array, dimension (MAX(1,LWORK))
107 *> LWORK is INTEGER, LWORK >= 3*N-2.
112 *> = 0: successful exit
113 *> < 0: if INFO = -i, the i-th argument had an illegal value
119 *> \author Univ. of Tennessee
120 *> \author Univ. of California Berkeley
121 *> \author Univ. of Colorado Denver
124 *> \date November 2016
126 *> \ingroup complex16SYcomputational
128 * @precisions fortran z -> c
130 * =====================================================================
131 SUBROUTINE ZHETRS_AASEN( UPLO, N, NRHS, A, LDA, IPIV, B, LDB,
132 $ WORK, LWORK, INFO )
134 * -- LAPACK computational routine (version 3.4.0) --
135 * -- LAPACK is a software package provided by Univ. of Tennessee, --
136 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141 * .. Scalar Arguments ..
143 INTEGER N, NRHS, LDA, LDB, LWORK, INFO
145 * .. Array Arguments ..
147 COMPLEX*16 A( LDA, * ), B( LDB, * ), WORK( * )
150 * =====================================================================
153 PARAMETER ( ONE = 1.0D+0 )
155 * .. Local Scalars ..
159 * .. External Functions ..
163 * .. External Subroutines ..
164 EXTERNAL ZGTSV, ZSWAP, ZTRSM, XERBLA
166 * .. Intrinsic Functions ..
169 * .. Executable Statements ..
172 UPPER = LSAME( UPLO, 'U' )
173 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
175 ELSE IF( N.LT.0 ) THEN
177 ELSE IF( NRHS.LT.0 ) THEN
179 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
181 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
183 ELSE IF( LWORK.LT.(3*N-2) ) THEN
187 CALL XERBLA( 'ZHETRS_AASEN', -INFO )
191 * Quick return if possible
193 IF( N.EQ.0 .OR. NRHS.EQ.0 )
198 * Solve A*X = B, where A = U*T*U**T.
205 $ CALL ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
208 * Compute (U \P**T * B) -> B [ (U \P**T * B) ]
210 CALL ZTRSM('L', 'U', 'C', 'U', N-1, NRHS, ONE, A( 1, 2 ), LDA,
213 * Compute T \ B -> B [ T \ (U \P**T * B) ]
215 CALL ZLACPY( 'F', 1, N, A(1, 1), LDA+1, WORK(N), 1)
217 CALL ZLACPY( 'F', 1, N-1, A( 1, 2 ), LDA+1, WORK( 2*N ), 1)
218 CALL ZLACPY( 'F', 1, N-1, A( 1, 2 ), LDA+1, WORK( 1 ), 1)
219 CALL ZLACGV( N-1, WORK( 1 ), 1 )
221 CALL ZGTSV(N, NRHS, WORK(1), WORK(N), WORK(2*N), B, LDB,
224 * Compute (U**T \ B) -> B [ U**T \ (T \ (U \P**T * B) ) ]
226 CALL ZTRSM( 'L', 'U', 'N', 'U', N-1, NRHS, ONE, A( 1, 2 ), LDA,
229 * Pivot, P * B [ P * (U**T \ (T \ (U \P**T * B) )) ]
234 $ CALL ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
239 * Solve A*X = B, where A = L*T*L**T.
246 $ CALL ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
249 * Compute (L \P**T * B) -> B [ (L \P**T * B) ]
251 CALL ZTRSM( 'L', 'L', 'N', 'U', N-1, NRHS, ONE, A( 2, 1 ), LDA,
254 * Compute T \ B -> B [ T \ (L \P**T * B) ]
256 CALL ZLACPY( 'F', 1, N, A(1, 1), LDA+1, WORK(N), 1)
258 CALL ZLACPY( 'F', 1, N-1, A( 2, 1 ), LDA+1, WORK( 1 ), 1)
259 CALL ZLACPY( 'F', 1, N-1, A( 2, 1 ), LDA+1, WORK( 2*N ), 1)
260 CALL ZLACGV( N-1, WORK( 2*N ), 1 )
262 CALL ZGTSV(N, NRHS, WORK(1), WORK(N), WORK(2*N), B, LDB,
265 * Compute (L**T \ B) -> B [ L**T \ (T \ (L \P**T * B) ) ]
267 CALL ZTRSM( 'L', 'L', 'C', 'U', N-1, NRHS, ONE, A( 2, 1 ), LDA,
270 * Pivot, P * B [ P * (L**T \ (T \ (L \P**T * B) )) ]
275 $ CALL ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
282 * End of ZHETRS_AASEN