LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ clange()

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

CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a general rectangular matrix.

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

Purpose:
 CLANGE  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 matrix A.
Returns
CLANGE
    CLANGE = ( 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 CLANGE as described
          above.
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.  When M = 0,
          CLANGE is set to zero.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.  When N = 0,
          CLANGE is set to zero.
[in]A
          A is COMPLEX array, dimension (LDA,N)
          The m by n matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(M,1).
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK)),
          where LWORK >= M 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 117 of file clange.f.

117 *
118 * -- LAPACK auxiliary routine (version 3.7.0) --
119 * -- LAPACK is a software package provided by Univ. of Tennessee, --
120 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * December 2016
122 *
123  IMPLICIT NONE
124 * .. Scalar Arguments ..
125  CHARACTER NORM
126  INTEGER LDA, M, N
127 * ..
128 * .. Array Arguments ..
129  REAL WORK( * )
130  COMPLEX A( LDA, * )
131 * ..
132 *
133 * =====================================================================
134 *
135 * .. Parameters ..
136  REAL ONE, ZERO
137  parameter( one = 1.0e+0, zero = 0.0e+0 )
138 * ..
139 * .. Local Scalars ..
140  INTEGER I, J
141  REAL SUM, VALUE, TEMP
142 * ..
143 * .. Local Arrays ..
144  REAL SSQ( 2 ), COLSSQ( 2 )
145 * ..
146 * .. External Functions ..
147  LOGICAL LSAME, SISNAN
148  EXTERNAL lsame, sisnan
149 * ..
150 * .. External Subroutines ..
151  EXTERNAL classq, scombssq
152 * ..
153 * .. Intrinsic Functions ..
154  INTRINSIC abs, min, sqrt
155 * ..
156 * .. Executable Statements ..
157 *
158  IF( min( m, n ).EQ.0 ) THEN
159  VALUE = zero
160  ELSE IF( lsame( norm, 'M' ) ) THEN
161 *
162 * Find max(abs(A(i,j))).
163 *
164  VALUE = zero
165  DO 20 j = 1, n
166  DO 10 i = 1, m
167  temp = abs( a( i, j ) )
168  IF( VALUE.LT.temp .OR. sisnan( temp ) ) VALUE = temp
169  10 CONTINUE
170  20 CONTINUE
171  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
172 *
173 * Find norm1(A).
174 *
175  VALUE = zero
176  DO 40 j = 1, n
177  sum = zero
178  DO 30 i = 1, m
179  sum = sum + abs( a( i, j ) )
180  30 CONTINUE
181  IF( VALUE.LT.sum .OR. sisnan( sum ) ) VALUE = sum
182  40 CONTINUE
183  ELSE IF( lsame( norm, 'I' ) ) THEN
184 *
185 * Find normI(A).
186 *
187  DO 50 i = 1, m
188  work( i ) = zero
189  50 CONTINUE
190  DO 70 j = 1, n
191  DO 60 i = 1, m
192  work( i ) = work( i ) + abs( a( i, j ) )
193  60 CONTINUE
194  70 CONTINUE
195  VALUE = zero
196  DO 80 i = 1, m
197  temp = work( i )
198  IF( VALUE.LT.temp .OR. sisnan( temp ) ) VALUE = temp
199  80 CONTINUE
200  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
201 *
202 * Find normF(A).
203 * SSQ(1) is scale
204 * SSQ(2) is sum-of-squares
205 * For better accuracy, sum each column separately.
206 *
207  ssq( 1 ) = zero
208  ssq( 2 ) = one
209  DO 90 j = 1, n
210  colssq( 1 ) = zero
211  colssq( 2 ) = one
212  CALL classq( m, a( 1, j ), 1, colssq( 1 ), colssq( 2 ) )
213  CALL scombssq( ssq, colssq )
214  90 CONTINUE
215  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
216  END IF
217 *
218  clange = VALUE
219  RETURN
220 *
221 * End of CLANGE
222 *
Here is the call graph for this function:
Here is the caller graph for this function:
clange
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:117
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