 LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine sppt01 ( character UPLO, integer N, real, dimension( * ) A, real, dimension( * ) AFAC, real, dimension( * ) RWORK, real RESID )

SPPT01

Purpose:
``` SPPT01 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 REAL array, dimension (N*(N+1)/2) The original symmetric matrix A, stored as a packed triangular matrix.``` [in,out] AFAC ``` AFAC is REAL 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 REAL array, dimension (N)` [out] RESID ``` RESID is REAL If UPLO = 'L', norm(L*L' - A) / ( N * norm(A) * EPS ) If UPLO = 'U', norm(U'*U - A) / ( N * norm(A) * EPS )```
Date
November 2011

Definition at line 95 of file sppt01.f.

95 *
96 * -- LAPACK test routine (version 3.4.0) --
97 * -- LAPACK is a software package provided by Univ. of Tennessee, --
98 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
99 * November 2011
100 *
101 * .. Scalar Arguments ..
102  CHARACTER uplo
103  INTEGER n
104  REAL resid
105 * ..
106 * .. Array Arguments ..
107  REAL a( * ), afac( * ), rwork( * )
108 * ..
109 *
110 * =====================================================================
111 *
112 * .. Parameters ..
113  REAL zero, one
114  parameter ( zero = 0.0e+0, one = 1.0e+0 )
115 * ..
116 * .. Local Scalars ..
117  INTEGER i, k, kc, npp
118  REAL anorm, eps, t
119 * ..
120 * .. External Functions ..
121  LOGICAL lsame
122  REAL sdot, slamch, slansp
123  EXTERNAL lsame, sdot, slamch, slansp
124 * ..
125 * .. External Subroutines ..
126  EXTERNAL sscal, sspr, stpmv
127 * ..
128 * .. Intrinsic Functions ..
129  INTRINSIC real
130 * ..
131 * .. Executable Statements ..
132 *
133 * Quick exit if N = 0
134 *
135  IF( n.LE.0 ) THEN
136  resid = zero
137  RETURN
138  END IF
139 *
140 * Exit with RESID = 1/EPS if ANORM = 0.
141 *
142  eps = slamch( 'Epsilon' )
143  anorm = slansp( '1', uplo, n, a, rwork )
144  IF( anorm.LE.zero ) THEN
145  resid = one / eps
146  RETURN
147  END IF
148 *
149 * Compute the product U'*U, overwriting U.
150 *
151  IF( lsame( uplo, 'U' ) ) THEN
152  kc = ( n*( n-1 ) ) / 2 + 1
153  DO 10 k = n, 1, -1
154 *
155 * Compute the (K,K) element of the result.
156 *
157  t = sdot( k, afac( kc ), 1, afac( kc ), 1 )
158  afac( kc+k-1 ) = t
159 *
160 * Compute the rest of column K.
161 *
162  IF( k.GT.1 ) THEN
163  CALL stpmv( 'Upper', 'Transpose', 'Non-unit', k-1, afac,
164  \$ afac( kc ), 1 )
165  kc = kc - ( k-1 )
166  END IF
167  10 CONTINUE
168 *
169 * Compute the product L*L', overwriting L.
170 *
171  ELSE
172  kc = ( n*( n+1 ) ) / 2
173  DO 20 k = n, 1, -1
174 *
175 * Add a multiple of column K of the factor L to each of
176 * columns K+1 through N.
177 *
178  IF( k.LT.n )
179  \$ CALL sspr( 'Lower', n-k, one, afac( kc+1 ), 1,
180  \$ afac( kc+n-k+1 ) )
181 *
182 * Scale column K by the diagonal element.
183 *
184  t = afac( kc )
185  CALL sscal( n-k+1, t, afac( kc ), 1 )
186 *
187  kc = kc - ( n-k+2 )
188  20 CONTINUE
189  END IF
190 *
191 * Compute the difference L*L' - A (or U'*U - A).
192 *
193  npp = n*( n+1 ) / 2
194  DO 30 i = 1, npp
195  afac( i ) = afac( i ) - a( i )
196  30 CONTINUE
197 *
198 * Compute norm( L*U - A ) / ( N * norm(A) * EPS )
199 *
200  resid = slansp( '1', uplo, n, afac, rwork )
201 *
202  resid = ( ( resid / REAL( N ) ) / anorm ) / eps
203 *
204  RETURN
205 *
206 * End of SPPT01
207 *
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:53
subroutine stpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
STPMV
Definition: stpmv.f:144
real function slansp(NORM, UPLO, N, AP, WORK)
SLANSP 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: slansp.f:116
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine sspr(UPLO, N, ALPHA, X, INCX, AP)
SSPR
Definition: sspr.f:129
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: