LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ clansy()

real function clansy ( character  NORM,
character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  WORK 
)

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

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

Purpose:
 CLANSY  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the  element of  largest absolute value  of a
 complex symmetric matrix A.
Returns
CLANSY
    CLANSY = ( 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 CLANSY 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, CLANSY is
          set to zero.
[in]A
          A is COMPLEX 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 REAL 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
December 2016

Definition at line 125 of file clansy.f.

125 *
126 * -- LAPACK auxiliary routine (version 3.7.0) --
127 * -- LAPACK is a software package provided by Univ. of Tennessee, --
128 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129 * December 2016
130 *
131  IMPLICIT NONE
132 * .. Scalar Arguments ..
133  CHARACTER NORM, UPLO
134  INTEGER LDA, N
135 * ..
136 * .. Array Arguments ..
137  REAL WORK( * )
138  COMPLEX A( LDA, * )
139 * ..
140 *
141 * =====================================================================
142 *
143 * .. Parameters ..
144  REAL ONE, ZERO
145  parameter( one = 1.0e+0, zero = 0.0e+0 )
146 * ..
147 * .. Local Scalars ..
148  INTEGER I, J
149  REAL ABSA, SUM, VALUE
150 * ..
151 * .. Local Arrays ..
152  REAL SSQ( 2 ), COLSSQ( 2 )
153 * ..
154 * .. External Functions ..
155  LOGICAL LSAME, SISNAN
156  EXTERNAL lsame, sisnan
157 * ..
158 * .. External Subroutines ..
159  EXTERNAL classq, scombssq
160 * ..
161 * .. Intrinsic Functions ..
162  INTRINSIC abs, sqrt
163 * ..
164 * .. Executable Statements ..
165 *
166  IF( n.EQ.0 ) THEN
167  VALUE = zero
168  ELSE IF( lsame( norm, 'M' ) ) THEN
169 *
170 * Find max(abs(A(i,j))).
171 *
172  VALUE = zero
173  IF( lsame( uplo, 'U' ) ) THEN
174  DO 20 j = 1, n
175  DO 10 i = 1, j
176  sum = abs( a( i, j ) )
177  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
178  10 CONTINUE
179  20 CONTINUE
180  ELSE
181  DO 40 j = 1, n
182  DO 30 i = j, n
183  sum = abs( a( i, j ) )
184  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
185  30 CONTINUE
186  40 CONTINUE
187  END IF
188  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
189  $ ( norm.EQ.'1' ) ) THEN
190 *
191 * Find normI(A) ( = norm1(A), since A is symmetric).
192 *
193  VALUE = zero
194  IF( lsame( uplo, 'U' ) ) THEN
195  DO 60 j = 1, n
196  sum = zero
197  DO 50 i = 1, j - 1
198  absa = abs( a( i, j ) )
199  sum = sum + absa
200  work( i ) = work( i ) + absa
201  50 CONTINUE
202  work( j ) = sum + abs( a( j, j ) )
203  60 CONTINUE
204  DO 70 i = 1, n
205  sum = work( i )
206  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
207  70 CONTINUE
208  ELSE
209  DO 80 i = 1, n
210  work( i ) = zero
211  80 CONTINUE
212  DO 100 j = 1, n
213  sum = work( j ) + abs( a( j, j ) )
214  DO 90 i = j + 1, n
215  absa = abs( a( i, j ) )
216  sum = sum + absa
217  work( i ) = work( i ) + absa
218  90 CONTINUE
219  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
220  100 CONTINUE
221  END IF
222  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
223 *
224 * Find normF(A).
225 * SSQ(1) is scale
226 * SSQ(2) is sum-of-squares
227 * For better accuracy, sum each column separately.
228 *
229  ssq( 1 ) = zero
230  ssq( 2 ) = one
231 *
232 * Sum off-diagonals
233 *
234  IF( lsame( uplo, 'U' ) ) THEN
235  DO 110 j = 2, n
236  colssq( 1 ) = zero
237  colssq( 2 ) = one
238  CALL classq( j-1, a( 1, j ), 1, colssq(1), colssq(2) )
239  CALL scombssq( ssq, colssq )
240  110 CONTINUE
241  ELSE
242  DO 120 j = 1, n - 1
243  colssq( 1 ) = zero
244  colssq( 2 ) = one
245  CALL classq( n-j, a( j+1, j ), 1, colssq(1), colssq(2) )
246  CALL scombssq( ssq, colssq )
247  120 CONTINUE
248  END IF
249  ssq( 2 ) = 2*ssq( 2 )
250 *
251 * Sum diagonal
252 *
253  colssq( 1 ) = zero
254  colssq( 2 ) = one
255  CALL classq( n, a, lda+1, colssq( 1 ), colssq( 2 ) )
256  CALL scombssq( ssq, colssq )
257  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
258  END IF
259 *
260  clansy = VALUE
261  RETURN
262 *
263 * End of CLANSY
264 *
Here is the call graph for this function:
Here is the caller graph for this function:
clansy
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clansy.f:125
classq
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
sisnan
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
scombssq
subroutine scombssq(V1, V2)
SCOMBSSQ adds two scaled sum of squares quantities
Definition: scombssq.f:62