LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
double precision function dlansy ( character  NORM,
character  UPLO,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  WORK 
)

DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.

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

Purpose:
 DLANSY  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.
Returns
DLANSY
    DLANSY = ( 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 DLANSY as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is to be referenced.
          = 'U':  Upper triangular part of A is referenced
          = 'L':  Lower triangular part of A is referenced
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, DLANSY is
          set to zero.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          The symmetric matrix A.  If UPLO = 'U', the leading n by n
          upper triangular part of A contains the upper triangular part
          of the matrix A, and the strictly lower triangular part of A
          is not referenced.  If UPLO = 'L', the leading n by n lower
          triangular part of A contains the lower triangular part of
          the matrix A, and the strictly upper triangular part of A is
          not referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(N,1).
[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
November 2015

Definition at line 124 of file dlansy.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: