LAPACK  3.8.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.
Date
December 2016

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