LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cspt01()

subroutine cspt01 ( character  UPLO,
integer  N,
complex, dimension( * )  A,
complex, dimension( * )  AFAC,
integer, dimension( * )  IPIV,
complex, dimension( ldc, * )  C,
integer  LDC,
real, dimension( * )  RWORK,
real  RESID 
)

CSPT01

Purpose:
 CSPT01 reconstructs a symmetric indefinite packed matrix A from its
 diagonal pivoting factorization A = U*D*U' or A = L*D*L' and computes
 the residual
    norm( C - A ) / ( N * norm(A) * EPS ),
 where C is the reconstructed matrix and EPS is the machine epsilon.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          Hermitian matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]A
          A is COMPLEX array, dimension (N*(N+1)/2)
          The original symmetric matrix A, stored as a packed
          triangular matrix.
[in]AFAC
          AFAC is COMPLEX array, dimension (N*(N+1)/2)
          The factored form of the matrix A, stored as a packed
          triangular matrix.  AFAC contains the block diagonal matrix D
          and the multipliers used to obtain the factor L or U from the
          L*D*L' or U*D*U' factorization as computed by CSPTRF.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from CSPTRF.
[out]C
          C is COMPLEX array, dimension (LDC,N)
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C.  LDC >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESID
          RESID is REAL
          If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 114 of file cspt01.f.

114 *
115 * -- LAPACK test routine (version 3.7.0) --
116 * -- LAPACK is a software package provided by Univ. of Tennessee, --
117 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
118 * December 2016
119 *
120 * .. Scalar Arguments ..
121  CHARACTER uplo
122  INTEGER ldc, n
123  REAL resid
124 * ..
125 * .. Array Arguments ..
126  INTEGER ipiv( * )
127  REAL rwork( * )
128  COMPLEX a( * ), afac( * ), c( ldc, * )
129 * ..
130 *
131 * =====================================================================
132 *
133 * .. Parameters ..
134  REAL zero, one
135  parameter( zero = 0.0e+0, one = 1.0e+0 )
136  COMPLEX czero, cone
137  parameter( czero = ( 0.0e+0, 0.0e+0 ),
138  $ cone = ( 1.0e+0, 0.0e+0 ) )
139 * ..
140 * .. Local Scalars ..
141  INTEGER i, info, j, jc
142  REAL anorm, eps
143 * ..
144 * .. External Functions ..
145  LOGICAL lsame
146  REAL clansp, clansy, slamch
147  EXTERNAL lsame, clansp, clansy, slamch
148 * ..
149 * .. External Subroutines ..
150  EXTERNAL clavsp, claset
151 * ..
152 * .. Intrinsic Functions ..
153  INTRINSIC real
154 * ..
155 * .. Executable Statements ..
156 *
157 * Quick exit if N = 0.
158 *
159  IF( n.LE.0 ) THEN
160  resid = zero
161  RETURN
162  END IF
163 *
164 * Determine EPS and the norm of A.
165 *
166  eps = slamch( 'Epsilon' )
167  anorm = clansp( '1', uplo, n, a, rwork )
168 *
169 * Initialize C to the identity matrix.
170 *
171  CALL claset( 'Full', n, n, czero, cone, c, ldc )
172 *
173 * Call CLAVSP to form the product D * U' (or D * L' ).
174 *
175  CALL clavsp( uplo, 'Transpose', 'Non-unit', n, n, afac, ipiv, c,
176  $ ldc, info )
177 *
178 * Call CLAVSP again to multiply by U ( or L ).
179 *
180  CALL clavsp( uplo, 'No transpose', 'Unit', n, n, afac, ipiv, c,
181  $ ldc, info )
182 *
183 * Compute the difference C - A .
184 *
185  IF( lsame( uplo, 'U' ) ) THEN
186  jc = 0
187  DO 20 j = 1, n
188  DO 10 i = 1, j
189  c( i, j ) = c( i, j ) - a( jc+i )
190  10 CONTINUE
191  jc = jc + j
192  20 CONTINUE
193  ELSE
194  jc = 1
195  DO 40 j = 1, n
196  DO 30 i = j, n
197  c( i, j ) = c( i, j ) - a( jc+i-j )
198  30 CONTINUE
199  jc = jc + n - j + 1
200  40 CONTINUE
201  END IF
202 *
203 * Compute norm( C - A ) / ( N * norm(A) * EPS )
204 *
205  resid = clansy( '1', uplo, n, c, ldc, rwork )
206 *
207  IF( anorm.LE.zero ) THEN
208  IF( resid.NE.zero )
209  $ resid = one / eps
210  ELSE
211  resid = ( ( resid/REAL( N ) )/anorm ) / eps
212  END IF
213 *
214  RETURN
215 *
216 * End of CSPT01
217 *
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: claset.f:108
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.
Definition: clansy.f:125
real function clansp(NORM, UPLO, N, AP, WORK)
CLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.
Definition: clansp.f:117
subroutine clavsp(UPLO, TRANS, DIAG, N, NRHS, A, IPIV, B, LDB, INFO)
CLAVSP
Definition: clavsp.f:133
Here is the call graph for this function:
Here is the caller graph for this function: