LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ slantp()

real function slantp ( character  NORM,
character  UPLO,
character  DIAG,
integer  N,
real, dimension( * )  AP,
real, dimension( * )  WORK 
)

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

Purpose:
 SLANTP  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
SLANTP
    SLANTP = ( 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 SLANTP 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, SLANTP is
          set to zero.
[in]AP
          AP is REAL 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 123 of file slantp.f.

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