LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
double precision function dlansp ( character  NORM,
character  UPLO,
integer  N,
double precision, dimension( * )  AP,
double precision, dimension( * )  WORK 
)

DLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.

Download DLANSP + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLANSP  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the  element of  largest absolute value  of a
 real symmetric matrix A,  supplied in packed form.
Returns
DLANSP
    DLANSP = ( 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 DLANSP as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is supplied.
          = 'U':  Upper triangular part of A is supplied
          = 'L':  Lower triangular part of A is supplied
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, DLANSP is
          set to zero.
[in]AP
          AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
          The upper or lower triangle of the symmetric 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.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
          WORK is not referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 116 of file dlansp.f.

116 *
117 * -- LAPACK auxiliary routine (version 3.4.2) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * September 2012
121 *
122 * .. Scalar Arguments ..
123  CHARACTER norm, uplo
124  INTEGER n
125 * ..
126 * .. Array Arguments ..
127  DOUBLE PRECISION ap( * ), work( * )
128 * ..
129 *
130 * =====================================================================
131 *
132 * .. Parameters ..
133  DOUBLE PRECISION one, zero
134  parameter ( one = 1.0d+0, zero = 0.0d+0 )
135 * ..
136 * .. Local Scalars ..
137  INTEGER i, j, k
138  DOUBLE PRECISION absa, scale, sum, value
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL dlassq
142 * ..
143 * .. External Functions ..
144  LOGICAL lsame, disnan
145  EXTERNAL lsame, disnan
146 * ..
147 * .. Intrinsic Functions ..
148  INTRINSIC abs, sqrt
149 * ..
150 * .. Executable Statements ..
151 *
152  IF( n.EQ.0 ) THEN
153  VALUE = zero
154  ELSE IF( lsame( norm, 'M' ) ) THEN
155 *
156 * Find max(abs(A(i,j))).
157 *
158  VALUE = zero
159  IF( lsame( uplo, 'U' ) ) THEN
160  k = 1
161  DO 20 j = 1, n
162  DO 10 i = k, k + j - 1
163  sum = abs( ap( i ) )
164  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
165  10 CONTINUE
166  k = k + j
167  20 CONTINUE
168  ELSE
169  k = 1
170  DO 40 j = 1, n
171  DO 30 i = k, k + n - j
172  sum = abs( ap( i ) )
173  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
174  30 CONTINUE
175  k = k + n - j + 1
176  40 CONTINUE
177  END IF
178  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
179  $ ( norm.EQ.'1' ) ) THEN
180 *
181 * Find normI(A) ( = norm1(A), since A is symmetric).
182 *
183  VALUE = zero
184  k = 1
185  IF( lsame( uplo, 'U' ) ) THEN
186  DO 60 j = 1, n
187  sum = zero
188  DO 50 i = 1, j - 1
189  absa = abs( ap( k ) )
190  sum = sum + absa
191  work( i ) = work( i ) + absa
192  k = k + 1
193  50 CONTINUE
194  work( j ) = sum + abs( ap( k ) )
195  k = k + 1
196  60 CONTINUE
197  DO 70 i = 1, n
198  sum = work( i )
199  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
200  70 CONTINUE
201  ELSE
202  DO 80 i = 1, n
203  work( i ) = zero
204  80 CONTINUE
205  DO 100 j = 1, n
206  sum = work( j ) + abs( ap( k ) )
207  k = k + 1
208  DO 90 i = j + 1, n
209  absa = abs( ap( k ) )
210  sum = sum + absa
211  work( i ) = work( i ) + absa
212  k = k + 1
213  90 CONTINUE
214  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
215  100 CONTINUE
216  END IF
217  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
218 *
219 * Find normF(A).
220 *
221  scale = zero
222  sum = one
223  k = 2
224  IF( lsame( uplo, 'U' ) ) THEN
225  DO 110 j = 2, n
226  CALL dlassq( j-1, ap( k ), 1, scale, sum )
227  k = k + j
228  110 CONTINUE
229  ELSE
230  DO 120 j = 1, n - 1
231  CALL dlassq( n-j, ap( k ), 1, scale, sum )
232  k = k + n - j + 1
233  120 CONTINUE
234  END IF
235  sum = 2*sum
236  k = 1
237  DO 130 i = 1, n
238  IF( ap( k ).NE.zero ) THEN
239  absa = abs( ap( k ) )
240  IF( scale.LT.absa ) THEN
241  sum = one + sum*( scale / absa )**2
242  scale = absa
243  ELSE
244  sum = sum + ( absa / scale )**2
245  END IF
246  END IF
247  IF( lsame( uplo, 'U' ) ) THEN
248  k = k + i + 1
249  ELSE
250  k = k + n - i + 1
251  END IF
252  130 CONTINUE
253  VALUE = scale*sqrt( sum )
254  END IF
255 *
256  dlansp = VALUE
257  RETURN
258 *
259 * End of DLANSP
260 *
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:61
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
DLASSQ updates a sum of squares represented in scaled form.
Definition: dlassq.f:105
double precision function dlansp(NORM, UPLO, N, AP, WORK)
DLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.
Definition: dlansp.f:116
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function: