LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ 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.

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.```

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