LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlansy()

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.

Definition at line 121 of file dlansy.f.

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