LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
real function clantp ( character  NORM,
character  UPLO,
character  DIAG,
integer  N,
complex, dimension( * )  AP,
real, dimension( * )  WORK 
)

CLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular matrix supplied in packed form.

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

Purpose:
 CLANTP  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the  element of  largest absolute value  of a
 triangular matrix A, supplied in packed form.
Returns
CLANTP
    CLANTP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
             (
             ( norm1(A),         NORM = '1', 'O' or 'o'
             (
             ( normI(A),         NORM = 'I' or 'i'
             (
             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'

 where  norm1  denotes the  one norm of a matrix (maximum column sum),
 normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
 normF  denotes the  Frobenius norm of a matrix (square root of sum of
 squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
Parameters
[in]NORM
          NORM is CHARACTER*1
          Specifies the value to be returned in CLANTP as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the matrix A is upper or lower triangular.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]DIAG
          DIAG is CHARACTER*1
          Specifies whether or not the matrix A is unit triangular.
          = 'N':  Non-unit triangular
          = 'U':  Unit triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, CLANTP is
          set to zero.
[in]AP
          AP is COMPLEX array, dimension (N*(N+1)/2)
          The upper or lower triangular matrix A, packed columnwise in
          a linear array.  The j-th column of A is stored in the array
          AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
          Note that when DIAG = 'U', the elements of the array AP
          corresponding to the diagonal elements of the matrix A are
          not referenced, but are assumed to be one.
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I'; otherwise, WORK is not
          referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 127 of file clantp.f.

127 *
128 * -- LAPACK auxiliary routine (version 3.4.2) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * September 2012
132 *
133 * .. Scalar Arguments ..
134  CHARACTER diag, norm, uplo
135  INTEGER n
136 * ..
137 * .. Array Arguments ..
138  REAL work( * )
139  COMPLEX ap( * )
140 * ..
141 *
142 * =====================================================================
143 *
144 * .. Parameters ..
145  REAL one, zero
146  parameter ( one = 1.0e+0, zero = 0.0e+0 )
147 * ..
148 * .. Local Scalars ..
149  LOGICAL udiag
150  INTEGER i, j, k
151  REAL scale, sum, value
152 * ..
153 * .. External Functions ..
154  LOGICAL lsame, sisnan
155  EXTERNAL lsame, sisnan
156 * ..
157 * .. External Subroutines ..
158  EXTERNAL classq
159 * ..
160 * .. Intrinsic Functions ..
161  INTRINSIC abs, sqrt
162 * ..
163 * .. Executable Statements ..
164 *
165  IF( n.EQ.0 ) THEN
166  VALUE = zero
167  ELSE IF( lsame( norm, 'M' ) ) THEN
168 *
169 * Find max(abs(A(i,j))).
170 *
171  k = 1
172  IF( lsame( diag, 'U' ) ) THEN
173  VALUE = one
174  IF( lsame( uplo, 'U' ) ) THEN
175  DO 20 j = 1, n
176  DO 10 i = k, k + j - 2
177  sum = abs( ap( i ) )
178  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
179  10 CONTINUE
180  k = k + j
181  20 CONTINUE
182  ELSE
183  DO 40 j = 1, n
184  DO 30 i = k + 1, k + n - j
185  sum = abs( ap( i ) )
186  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
187  30 CONTINUE
188  k = k + n - j + 1
189  40 CONTINUE
190  END IF
191  ELSE
192  VALUE = zero
193  IF( lsame( uplo, 'U' ) ) THEN
194  DO 60 j = 1, n
195  DO 50 i = k, k + j - 1
196  sum = abs( ap( i ) )
197  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
198  50 CONTINUE
199  k = k + j
200  60 CONTINUE
201  ELSE
202  DO 80 j = 1, n
203  DO 70 i = k, k + n - j
204  sum = abs( ap( i ) )
205  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
206  70 CONTINUE
207  k = k + n - j + 1
208  80 CONTINUE
209  END IF
210  END IF
211  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
212 *
213 * Find norm1(A).
214 *
215  VALUE = zero
216  k = 1
217  udiag = lsame( diag, 'U' )
218  IF( lsame( uplo, 'U' ) ) THEN
219  DO 110 j = 1, n
220  IF( udiag ) THEN
221  sum = one
222  DO 90 i = k, k + j - 2
223  sum = sum + abs( ap( i ) )
224  90 CONTINUE
225  ELSE
226  sum = zero
227  DO 100 i = k, k + j - 1
228  sum = sum + abs( ap( i ) )
229  100 CONTINUE
230  END IF
231  k = k + j
232  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
233  110 CONTINUE
234  ELSE
235  DO 140 j = 1, n
236  IF( udiag ) THEN
237  sum = one
238  DO 120 i = k + 1, k + n - j
239  sum = sum + abs( ap( i ) )
240  120 CONTINUE
241  ELSE
242  sum = zero
243  DO 130 i = k, k + n - j
244  sum = sum + abs( ap( i ) )
245  130 CONTINUE
246  END IF
247  k = k + n - j + 1
248  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
249  140 CONTINUE
250  END IF
251  ELSE IF( lsame( norm, 'I' ) ) THEN
252 *
253 * Find normI(A).
254 *
255  k = 1
256  IF( lsame( uplo, 'U' ) ) THEN
257  IF( lsame( diag, 'U' ) ) THEN
258  DO 150 i = 1, n
259  work( i ) = one
260  150 CONTINUE
261  DO 170 j = 1, n
262  DO 160 i = 1, j - 1
263  work( i ) = work( i ) + abs( ap( k ) )
264  k = k + 1
265  160 CONTINUE
266  k = k + 1
267  170 CONTINUE
268  ELSE
269  DO 180 i = 1, n
270  work( i ) = zero
271  180 CONTINUE
272  DO 200 j = 1, n
273  DO 190 i = 1, j
274  work( i ) = work( i ) + abs( ap( k ) )
275  k = k + 1
276  190 CONTINUE
277  200 CONTINUE
278  END IF
279  ELSE
280  IF( lsame( diag, 'U' ) ) THEN
281  DO 210 i = 1, n
282  work( i ) = one
283  210 CONTINUE
284  DO 230 j = 1, n
285  k = k + 1
286  DO 220 i = j + 1, n
287  work( i ) = work( i ) + abs( ap( k ) )
288  k = k + 1
289  220 CONTINUE
290  230 CONTINUE
291  ELSE
292  DO 240 i = 1, n
293  work( i ) = zero
294  240 CONTINUE
295  DO 260 j = 1, n
296  DO 250 i = j, n
297  work( i ) = work( i ) + abs( ap( k ) )
298  k = k + 1
299  250 CONTINUE
300  260 CONTINUE
301  END IF
302  END IF
303  VALUE = zero
304  DO 270 i = 1, n
305  sum = work( i )
306  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
307  270 CONTINUE
308  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
309 *
310 * Find normF(A).
311 *
312  IF( lsame( uplo, 'U' ) ) THEN
313  IF( lsame( diag, 'U' ) ) THEN
314  scale = one
315  sum = n
316  k = 2
317  DO 280 j = 2, n
318  CALL classq( j-1, ap( k ), 1, scale, sum )
319  k = k + j
320  280 CONTINUE
321  ELSE
322  scale = zero
323  sum = one
324  k = 1
325  DO 290 j = 1, n
326  CALL classq( j, ap( k ), 1, scale, sum )
327  k = k + j
328  290 CONTINUE
329  END IF
330  ELSE
331  IF( lsame( diag, 'U' ) ) THEN
332  scale = one
333  sum = n
334  k = 2
335  DO 300 j = 1, n - 1
336  CALL classq( n-j, ap( k ), 1, scale, sum )
337  k = k + n - j + 1
338  300 CONTINUE
339  ELSE
340  scale = zero
341  sum = one
342  k = 1
343  DO 310 j = 1, n
344  CALL classq( n-j+1, ap( k ), 1, scale, sum )
345  k = k + n - j + 1
346  310 CONTINUE
347  END IF
348  END IF
349  VALUE = scale*sqrt( sum )
350  END IF
351 *
352  clantp = VALUE
353  RETURN
354 *
355 * End of CLANTP
356 *
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
real function clantp(NORM, UPLO, DIAG, N, AP, WORK)
CLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular matrix supplied in packed form.
Definition: clantp.f:127
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function: