LAPACK  3.10.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.

Definition at line 114 of file clange.f.

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