LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dlantp()

double precision function dlantp ( character  NORM,
character  UPLO,
character  DIAG,
integer  N,
double precision, dimension( * )  AP,
double precision, dimension( * )  WORK 
)

DLANTP 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 DLANTP + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLANTP  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
DLANTP
    DLANTP = ( 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 DLANTP 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, DLANTP is
          set to zero.
[in]AP
          AP is DOUBLE PRECISION 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 DOUBLE PRECISION 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
December 2016

Definition at line 126 of file dlantp.f.

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