LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ clantp()

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.

Definition at line 124 of file clantp.f.

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