LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ clansp()

 real function clansp ( character NORM, character UPLO, integer N, complex, dimension( * ) AP, real, dimension( * ) WORK )

CLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.

Purpose:
``` CLANSP  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,  supplied in packed form.```
Returns
CLANSP
```    CLANSP = ( 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 CLANSP as described above.``` [in] UPLO ``` UPLO is CHARACTER*1 Specifies whether the upper or lower triangular part of the symmetric matrix A is supplied. = 'U': Upper triangular part of A is supplied = 'L': Lower triangular part of A is supplied``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0. When N = 0, CLANSP is set to zero.``` [in] AP ``` AP is COMPLEX array, dimension (N*(N+1)/2) The upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows: if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.``` [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.```

Definition at line 114 of file clansp.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, UPLO
123  INTEGER N
124 * ..
125 * .. Array Arguments ..
126  REAL WORK( * )
127  COMPLEX AP( * )
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, K
138  REAL ABSA, SUM, VALUE
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, aimag, real, sqrt
152 * ..
153 * .. Executable Statements ..
154 *
155  IF( 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  IF( lsame( uplo, 'U' ) ) THEN
163  k = 1
164  DO 20 j = 1, n
165  DO 10 i = k, k + j - 1
166  sum = abs( ap( i ) )
167  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
168  10 CONTINUE
169  k = k + j
170  20 CONTINUE
171  ELSE
172  k = 1
173  DO 40 j = 1, n
174  DO 30 i = k, k + n - j
175  sum = abs( ap( i ) )
176  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
177  30 CONTINUE
178  k = k + n - j + 1
179  40 CONTINUE
180  END IF
181  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
182  \$ ( norm.EQ.'1' ) ) THEN
183 *
184 * Find normI(A) ( = norm1(A), since A is symmetric).
185 *
186  VALUE = zero
187  k = 1
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( ap( k ) )
193  sum = sum + absa
194  work( i ) = work( i ) + absa
195  k = k + 1
196  50 CONTINUE
197  work( j ) = sum + abs( ap( k ) )
198  k = k + 1
199  60 CONTINUE
200  DO 70 i = 1, n
201  sum = work( i )
202  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
203  70 CONTINUE
204  ELSE
205  DO 80 i = 1, n
206  work( i ) = zero
207  80 CONTINUE
208  DO 100 j = 1, n
209  sum = work( j ) + abs( ap( k ) )
210  k = k + 1
211  DO 90 i = j + 1, n
212  absa = abs( ap( k ) )
213  sum = sum + absa
214  work( i ) = work( i ) + absa
215  k = k + 1
216  90 CONTINUE
217  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
218  100 CONTINUE
219  END IF
220  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
221 *
222 * Find normF(A).
223 * SSQ(1) is scale
224 * SSQ(2) is sum-of-squares
225 * For better accuracy, sum each column separately.
226 *
227  ssq( 1 ) = zero
228  ssq( 2 ) = one
229 *
230 * Sum off-diagonals
231 *
232  k = 2
233  IF( lsame( uplo, 'U' ) ) THEN
234  DO 110 j = 2, n
235  colssq( 1 ) = zero
236  colssq( 2 ) = one
237  CALL classq( j-1, ap( k ), 1, colssq( 1 ), colssq( 2 ) )
238  CALL scombssq( ssq, colssq )
239  k = k + j
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, ap( k ), 1, colssq( 1 ), colssq( 2 ) )
246  CALL scombssq( ssq, colssq )
247  k = k + n - j + 1
248  120 CONTINUE
249  END IF
250  ssq( 2 ) = 2*ssq( 2 )
251 *
252 * Sum diagonal
253 *
254  k = 1
255  colssq( 1 ) = zero
256  colssq( 2 ) = one
257  DO 130 i = 1, n
258  IF( real( ap( k ) ).NE.zero ) THEN
259  absa = abs( real( ap( k ) ) )
260  IF( colssq( 1 ).LT.absa ) THEN
261  colssq( 2 ) = one + colssq(2)*( colssq(1) / absa )**2
262  colssq( 1 ) = absa
263  ELSE
264  colssq( 2 ) = colssq( 2 ) + ( absa / colssq( 1 ) )**2
265  END IF
266  END IF
267  IF( aimag( ap( k ) ).NE.zero ) THEN
268  absa = abs( aimag( ap( k ) ) )
269  IF( colssq( 1 ).LT.absa ) THEN
270  colssq( 2 ) = one + colssq(2)*( colssq(1) / absa )**2
271  colssq( 1 ) = absa
272  ELSE
273  colssq( 2 ) = colssq( 2 ) + ( absa / colssq( 1 ) )**2
274  END IF
275  END IF
276  IF( lsame( uplo, 'U' ) ) THEN
277  k = k + i + 1
278  ELSE
279  k = k + n - i + 1
280  END IF
281  130 CONTINUE
282  CALL scombssq( ssq, colssq )
283  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
284  END IF
285 *
286  clansp = VALUE
287  RETURN
288 *
289 * End of CLANSP
290 *
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 clansp(NORM, UPLO, N, AP, WORK)
CLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clansp.f:115
Here is the call graph for this function: