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

◆ zlacn2()

subroutine zlacn2 ( integer  n,
complex*16, dimension( * )  v,
complex*16, dimension( * )  x,
double precision  est,
integer  kase,
integer, dimension( 3 )  isave 
)

ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vector products.

Download ZLACN2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 ZLACN2 estimates the 1-norm of a square, complex matrix A.
 Reverse communication is used for evaluating matrix-vector products.
Parameters
[in]N
          N is INTEGER
         The order of the matrix.  N >= 1.
[out]V
          V is COMPLEX*16 array, dimension (N)
         On the final return, V = A*W,  where  EST = norm(V)/norm(W)
         (W is not returned).
[in,out]X
          X is COMPLEX*16 array, dimension (N)
         On an intermediate return, X should be overwritten by
               A * X,   if KASE=1,
               A**H * X,  if KASE=2,
         where A**H is the conjugate transpose of A, and ZLACN2 must be
         re-called with all the other parameters unchanged.
[in,out]EST
          EST is DOUBLE PRECISION
         On entry with KASE = 1 or 2 and ISAVE(1) = 3, EST should be
         unchanged from the previous call to ZLACN2.
         On exit, EST is an estimate (a lower bound) for norm(A).
[in,out]KASE
          KASE is INTEGER
         On the initial call to ZLACN2, KASE should be 0.
         On an intermediate return, KASE will be 1 or 2, indicating
         whether X should be overwritten by A * X  or A**H * X.
         On the final return from ZLACN2, KASE will again be 0.
[in,out]ISAVE
          ISAVE is INTEGER array, dimension (3)
         ISAVE is used to save variables between calls to ZLACN2
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
  Originally named CONEST, dated March 16, 1988.

  Last modified:  April, 1999

  This is a thread safe version of ZLACON, which uses the array ISAVE
  in place of a SAVE statement, as follows:

     ZLACON     ZLACN2
      JUMP     ISAVE(1)
      J        ISAVE(2)
      ITER     ISAVE(3)
Contributors:
Nick Higham, University of Manchester
References:
N.J. Higham, "FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation", ACM Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, December 1988.

Definition at line 132 of file zlacn2.f.

133*
134* -- LAPACK auxiliary routine --
135* -- LAPACK is a software package provided by Univ. of Tennessee, --
136* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137*
138* .. Scalar Arguments ..
139 INTEGER KASE, N
140 DOUBLE PRECISION EST
141* ..
142* .. Array Arguments ..
143 INTEGER ISAVE( 3 )
144 COMPLEX*16 V( * ), X( * )
145* ..
146*
147* =====================================================================
148*
149* .. Parameters ..
150 INTEGER ITMAX
151 parameter( itmax = 5 )
152 DOUBLE PRECISION ONE, TWO
153 parameter( one = 1.0d0, two = 2.0d0 )
154 COMPLEX*16 CZERO, CONE
155 parameter( czero = ( 0.0d0, 0.0d0 ),
156 $ cone = ( 1.0d0, 0.0d0 ) )
157* ..
158* .. Local Scalars ..
159 INTEGER I, JLAST
160 DOUBLE PRECISION ABSXI, ALTSGN, ESTOLD, SAFMIN, TEMP
161* ..
162* .. External Functions ..
163 INTEGER IZMAX1
164 DOUBLE PRECISION DLAMCH, DZSUM1
165 EXTERNAL izmax1, dlamch, dzsum1
166* ..
167* .. External Subroutines ..
168 EXTERNAL zcopy
169* ..
170* .. Intrinsic Functions ..
171 INTRINSIC abs, dble, dcmplx, dimag
172* ..
173* .. Executable Statements ..
174*
175 safmin = dlamch( 'Safe minimum' )
176 IF( kase.EQ.0 ) THEN
177 DO 10 i = 1, n
178 x( i ) = dcmplx( one / dble( n ) )
179 10 CONTINUE
180 kase = 1
181 isave( 1 ) = 1
182 RETURN
183 END IF
184*
185 GO TO ( 20, 40, 70, 90, 120 )isave( 1 )
186*
187* ................ ENTRY (ISAVE( 1 ) = 1)
188* FIRST ITERATION. X HAS BEEN OVERWRITTEN BY A*X.
189*
190 20 CONTINUE
191 IF( n.EQ.1 ) THEN
192 v( 1 ) = x( 1 )
193 est = abs( v( 1 ) )
194* ... QUIT
195 GO TO 130
196 END IF
197 est = dzsum1( n, x, 1 )
198*
199 DO 30 i = 1, n
200 absxi = abs( x( i ) )
201 IF( absxi.GT.safmin ) THEN
202 x( i ) = dcmplx( dble( x( i ) ) / absxi,
203 $ dimag( x( i ) ) / absxi )
204 ELSE
205 x( i ) = cone
206 END IF
207 30 CONTINUE
208 kase = 2
209 isave( 1 ) = 2
210 RETURN
211*
212* ................ ENTRY (ISAVE( 1 ) = 2)
213* FIRST ITERATION. X HAS BEEN OVERWRITTEN BY CTRANS(A)*X.
214*
215 40 CONTINUE
216 isave( 2 ) = izmax1( n, x, 1 )
217 isave( 3 ) = 2
218*
219* MAIN LOOP - ITERATIONS 2,3,...,ITMAX.
220*
221 50 CONTINUE
222 DO 60 i = 1, n
223 x( i ) = czero
224 60 CONTINUE
225 x( isave( 2 ) ) = cone
226 kase = 1
227 isave( 1 ) = 3
228 RETURN
229*
230* ................ ENTRY (ISAVE( 1 ) = 3)
231* X HAS BEEN OVERWRITTEN BY A*X.
232*
233 70 CONTINUE
234 CALL zcopy( n, x, 1, v, 1 )
235 estold = est
236 est = dzsum1( n, v, 1 )
237*
238* TEST FOR CYCLING.
239 IF( est.LE.estold )
240 $ GO TO 100
241*
242 DO 80 i = 1, n
243 absxi = abs( x( i ) )
244 IF( absxi.GT.safmin ) THEN
245 x( i ) = dcmplx( dble( x( i ) ) / absxi,
246 $ dimag( x( i ) ) / absxi )
247 ELSE
248 x( i ) = cone
249 END IF
250 80 CONTINUE
251 kase = 2
252 isave( 1 ) = 4
253 RETURN
254*
255* ................ ENTRY (ISAVE( 1 ) = 4)
256* X HAS BEEN OVERWRITTEN BY CTRANS(A)*X.
257*
258 90 CONTINUE
259 jlast = isave( 2 )
260 isave( 2 ) = izmax1( n, x, 1 )
261 IF( ( abs( x( jlast ) ).NE.abs( x( isave( 2 ) ) ) ) .AND.
262 $ ( isave( 3 ).LT.itmax ) ) THEN
263 isave( 3 ) = isave( 3 ) + 1
264 GO TO 50
265 END IF
266*
267* ITERATION COMPLETE. FINAL STAGE.
268*
269 100 CONTINUE
270 altsgn = one
271 DO 110 i = 1, n
272 x( i ) = dcmplx( altsgn*( one+dble( i-1 ) / dble( n-1 ) ) )
273 altsgn = -altsgn
274 110 CONTINUE
275 kase = 1
276 isave( 1 ) = 5
277 RETURN
278*
279* ................ ENTRY (ISAVE( 1 ) = 5)
280* X HAS BEEN OVERWRITTEN BY A*X.
281*
282 120 CONTINUE
283 temp = two*( dzsum1( n, x, 1 ) / dble( 3*n ) )
284 IF( temp.GT.est ) THEN
285 CALL zcopy( n, x, 1, v, 1 )
286 est = temp
287 END IF
288*
289 130 CONTINUE
290 kase = 0
291 RETURN
292*
293* End of ZLACN2
294*
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
Definition zcopy.f:81
integer function izmax1(n, zx, incx)
IZMAX1 finds the index of the first vector element of maximum absolute value.
Definition izmax1.f:81
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dzsum1(n, cx, incx)
DZSUM1 forms the 1-norm of the complex vector using the true absolute value.
Definition dzsum1.f:81
Here is the call graph for this function:
Here is the caller graph for this function: