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

◆ zlansp()

double precision function zlansp ( character norm,
character uplo,
integer n,
complex*16, dimension( * ) ap,
double precision, dimension( * ) work )

ZLANSP 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.

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

Purpose:
!>
!> ZLANSP  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
ZLANSP
!>
!>    ZLANSP = ( 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 ZLANSP 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, ZLANSP is
!>          set to zero.
!> 
[in]AP
!>          AP is COMPLEX*16 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 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 112 of file zlansp.f.

113*
114* -- LAPACK auxiliary routine --
115* -- LAPACK is a software package provided by Univ. of Tennessee, --
116* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117*
118* .. Scalar Arguments ..
119 CHARACTER NORM, UPLO
120 INTEGER N
121* ..
122* .. Array Arguments ..
123 DOUBLE PRECISION WORK( * )
124 COMPLEX*16 AP( * )
125* ..
126*
127* =====================================================================
128*
129* .. Parameters ..
130 DOUBLE PRECISION ONE, ZERO
131 parameter( one = 1.0d+0, zero = 0.0d+0 )
132* ..
133* .. Local Scalars ..
134 INTEGER I, J, K
135 DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
136* ..
137* .. External Functions ..
138 LOGICAL LSAME, DISNAN
139 EXTERNAL lsame, disnan
140* ..
141* .. External Subroutines ..
142 EXTERNAL zlassq
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC abs, dble, dimag, sqrt
146* ..
147* .. Executable Statements ..
148*
149 IF( n.EQ.0 ) THEN
150 VALUE = zero
151 ELSE IF( lsame( norm, 'M' ) ) THEN
152*
153* Find max(abs(A(i,j))).
154*
155 VALUE = zero
156 IF( lsame( uplo, 'U' ) ) THEN
157 k = 1
158 DO 20 j = 1, n
159 DO 10 i = k, k + j - 1
160 sum = abs( ap( i ) )
161 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
162 10 CONTINUE
163 k = k + j
164 20 CONTINUE
165 ELSE
166 k = 1
167 DO 40 j = 1, n
168 DO 30 i = k, k + n - j
169 sum = abs( ap( i ) )
170 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
171 30 CONTINUE
172 k = k + n - j + 1
173 40 CONTINUE
174 END IF
175 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
176 $ ( lsame( norm, 'O' ) ) .OR.
177 $ ( norm.EQ.'1' ) ) THEN
178*
179* Find normI(A) ( = norm1(A), since A is symmetric).
180*
181 VALUE = zero
182 k = 1
183 IF( lsame( uplo, 'U' ) ) THEN
184 DO 60 j = 1, n
185 sum = zero
186 DO 50 i = 1, j - 1
187 absa = abs( ap( k ) )
188 sum = sum + absa
189 work( i ) = work( i ) + absa
190 k = k + 1
191 50 CONTINUE
192 work( j ) = sum + abs( ap( k ) )
193 k = k + 1
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( ap( k ) )
205 k = k + 1
206 DO 90 i = j + 1, n
207 absa = abs( ap( k ) )
208 sum = sum + absa
209 work( i ) = work( i ) + absa
210 k = k + 1
211 90 CONTINUE
212 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
213 100 CONTINUE
214 END IF
215 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
216 $ ( lsame( norm, 'E' ) ) ) THEN
217*
218* Find normF(A).
219*
220 scale = zero
221 sum = one
222 k = 2
223 IF( lsame( uplo, 'U' ) ) THEN
224 DO 110 j = 2, n
225 CALL zlassq( j-1, ap( k ), 1, scale, sum )
226 k = k + j
227 110 CONTINUE
228 ELSE
229 DO 120 j = 1, n - 1
230 CALL zlassq( n-j, ap( k ), 1, scale, sum )
231 k = k + n - j + 1
232 120 CONTINUE
233 END IF
234 sum = 2*sum
235 k = 1
236 DO 130 i = 1, n
237 IF( dble( ap( k ) ).NE.zero ) THEN
238 absa = abs( dble( ap( k ) ) )
239 IF( scale.LT.absa ) THEN
240 sum = one + sum*( scale / absa )**2
241 scale = absa
242 ELSE
243 sum = sum + ( absa / scale )**2
244 END IF
245 END IF
246 IF( dimag( ap( k ) ).NE.zero ) THEN
247 absa = abs( dimag( ap( k ) ) )
248 IF( scale.LT.absa ) THEN
249 sum = one + sum*( scale / absa )**2
250 scale = absa
251 ELSE
252 sum = sum + ( absa / scale )**2
253 END IF
254 END IF
255 IF( lsame( uplo, 'U' ) ) THEN
256 k = k + i + 1
257 ELSE
258 k = k + n - i + 1
259 END IF
260 130 CONTINUE
261 VALUE = scale*sqrt( sum )
262 END IF
263*
264 zlansp = VALUE
265 RETURN
266*
267* End of ZLANSP
268*
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlansp(norm, uplo, n, ap, work)
ZLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlansp.f:113
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:122
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: