LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dppt01()

subroutine dppt01 ( character  uplo,
integer  n,
double precision, dimension( * )  a,
double precision, dimension( * )  afac,
double precision, dimension( * )  rwork,
double precision  resid 
)

DPPT01

Purpose:
 DPPT01 reconstructs a symmetric positive definite packed matrix A
 from its L*L' or U'*U factorization and computes the residual
    norm( L*L' - A ) / ( N * norm(A) * EPS ) or
    norm( U'*U - A ) / ( N * norm(A) * EPS ),
 where EPS is the machine epsilon.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The number of rows and columns of the matrix A.  N >= 0.
[in]A
          A is DOUBLE PRECISION array, dimension (N*(N+1)/2)
          The original symmetric matrix A, stored as a packed
          triangular matrix.
[in,out]AFAC
          AFAC is DOUBLE PRECISION array, dimension (N*(N+1)/2)
          On entry, the factor L or U from the L*L' or U'*U
          factorization of A, stored as a packed triangular matrix.
          Overwritten with the reconstructed matrix, and then with the
          difference L*L' - A (or U'*U - A).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          If UPLO = 'L', norm(L*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U'*U - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 92 of file dppt01.f.

93*
94* -- LAPACK test routine --
95* -- LAPACK is a software package provided by Univ. of Tennessee, --
96* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
97*
98* .. Scalar Arguments ..
99 CHARACTER UPLO
100 INTEGER N
101 DOUBLE PRECISION RESID
102* ..
103* .. Array Arguments ..
104 DOUBLE PRECISION A( * ), AFAC( * ), RWORK( * )
105* ..
106*
107* =====================================================================
108*
109* .. Parameters ..
110 DOUBLE PRECISION ZERO, ONE
111 parameter( zero = 0.0d+0, one = 1.0d+0 )
112* ..
113* .. Local Scalars ..
114 INTEGER I, K, KC, NPP
115 DOUBLE PRECISION ANORM, EPS, T
116* ..
117* .. External Functions ..
118 LOGICAL LSAME
119 DOUBLE PRECISION DDOT, DLAMCH, DLANSP
120 EXTERNAL lsame, ddot, dlamch, dlansp
121* ..
122* .. External Subroutines ..
123 EXTERNAL dscal, dspr, dtpmv
124* ..
125* .. Intrinsic Functions ..
126 INTRINSIC dble
127* ..
128* .. Executable Statements ..
129*
130* Quick exit if N = 0
131*
132 IF( n.LE.0 ) THEN
133 resid = zero
134 RETURN
135 END IF
136*
137* Exit with RESID = 1/EPS if ANORM = 0.
138*
139 eps = dlamch( 'Epsilon' )
140 anorm = dlansp( '1', uplo, n, a, rwork )
141 IF( anorm.LE.zero ) THEN
142 resid = one / eps
143 RETURN
144 END IF
145*
146* Compute the product U'*U, overwriting U.
147*
148 IF( lsame( uplo, 'U' ) ) THEN
149 kc = ( n*( n-1 ) ) / 2 + 1
150 DO 10 k = n, 1, -1
151*
152* Compute the (K,K) element of the result.
153*
154 t = ddot( k, afac( kc ), 1, afac( kc ), 1 )
155 afac( kc+k-1 ) = t
156*
157* Compute the rest of column K.
158*
159 IF( k.GT.1 ) THEN
160 CALL dtpmv( 'Upper', 'Transpose', 'Non-unit', k-1, afac,
161 $ afac( kc ), 1 )
162 kc = kc - ( k-1 )
163 END IF
164 10 CONTINUE
165*
166* Compute the product L*L', overwriting L.
167*
168 ELSE
169 kc = ( n*( n+1 ) ) / 2
170 DO 20 k = n, 1, -1
171*
172* Add a multiple of column K of the factor L to each of
173* columns K+1 through N.
174*
175 IF( k.LT.n )
176 $ CALL dspr( 'Lower', n-k, one, afac( kc+1 ), 1,
177 $ afac( kc+n-k+1 ) )
178*
179* Scale column K by the diagonal element.
180*
181 t = afac( kc )
182 CALL dscal( n-k+1, t, afac( kc ), 1 )
183*
184 kc = kc - ( n-k+2 )
185 20 CONTINUE
186 END IF
187*
188* Compute the difference L*L' - A (or U'*U - A).
189*
190 npp = n*( n+1 ) / 2
191 DO 30 i = 1, npp
192 afac( i ) = afac( i ) - a( i )
193 30 CONTINUE
194*
195* Compute norm( L*U - A ) / ( N * norm(A) * EPS )
196*
197 resid = dlansp( '1', uplo, n, afac, rwork )
198*
199 resid = ( ( resid / dble( n ) ) / anorm ) / eps
200*
201 RETURN
202*
203* End of DPPT01
204*
double precision function ddot(n, dx, incx, dy, incy)
DDOT
Definition ddot.f:82
subroutine dspr(uplo, n, alpha, x, incx, ap)
DSPR
Definition dspr.f:127
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlansp(norm, uplo, n, ap, work)
DLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlansp.f:114
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dtpmv(uplo, trans, diag, n, ap, x, incx)
DTPMV
Definition dtpmv.f:142
Here is the call graph for this function:
Here is the caller graph for this function: