 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ slansp()

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

SLANSP 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:
``` SLANSP  returns the value of the one norm,  or the Frobenius norm, or
the  infinity norm,  or the  element of  largest absolute value  of a
real symmetric matrix A,  supplied in packed form.```
Returns
SLANSP
```    SLANSP = ( 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 SLANSP 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, SLANSP is set to zero.``` [in] AP ``` AP is REAL 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 113 of file slansp.f.

114*
115* -- LAPACK auxiliary routine --
116* -- LAPACK is a software package provided by Univ. of Tennessee, --
117* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
118*
119* .. Scalar Arguments ..
120 CHARACTER NORM, UPLO
121 INTEGER N
122* ..
123* .. Array Arguments ..
124 REAL AP( * ), WORK( * )
125* ..
126*
127* =====================================================================
128*
129* .. Parameters ..
130 REAL ONE, ZERO
131 parameter( one = 1.0e+0, zero = 0.0e+0 )
132* ..
133* .. Local Scalars ..
134 INTEGER I, J, K
135 REAL ABSA, SCALE, SUM, VALUE
136* ..
137* .. External Subroutines ..
138 EXTERNAL slassq
139* ..
140* .. External Functions ..
141 LOGICAL LSAME, SISNAN
142 EXTERNAL lsame, sisnan
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC abs, 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. sisnan( 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. sisnan( 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. ( lsame( norm, 'O' ) ) .OR.
176 \$ ( norm.EQ.'1' ) ) THEN
177*
178* Find normI(A) ( = norm1(A), since A is symmetric).
179*
180 VALUE = zero
181 k = 1
182 IF( lsame( uplo, 'U' ) ) THEN
183 DO 60 j = 1, n
184 sum = zero
185 DO 50 i = 1, j - 1
186 absa = abs( ap( k ) )
187 sum = sum + absa
188 work( i ) = work( i ) + absa
189 k = k + 1
190 50 CONTINUE
191 work( j ) = sum + abs( ap( k ) )
192 k = k + 1
193 60 CONTINUE
194 DO 70 i = 1, n
195 sum = work( i )
196 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
197 70 CONTINUE
198 ELSE
199 DO 80 i = 1, n
200 work( i ) = zero
201 80 CONTINUE
202 DO 100 j = 1, n
203 sum = work( j ) + abs( ap( k ) )
204 k = k + 1
205 DO 90 i = j + 1, n
206 absa = abs( ap( k ) )
207 sum = sum + absa
208 work( i ) = work( i ) + absa
209 k = k + 1
210 90 CONTINUE
211 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
212 100 CONTINUE
213 END IF
214 ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
215*
216* Find normF(A).
217*
218 scale = zero
219 sum = one
220 k = 2
221 IF( lsame( uplo, 'U' ) ) THEN
222 DO 110 j = 2, n
223 CALL slassq( j-1, ap( k ), 1, scale, sum )
224 k = k + j
225 110 CONTINUE
226 ELSE
227 DO 120 j = 1, n - 1
228 CALL slassq( n-j, ap( k ), 1, scale, sum )
229 k = k + n - j + 1
230 120 CONTINUE
231 END IF
232 sum = 2*sum
233 k = 1
234 DO 130 i = 1, n
235 IF( ap( k ).NE.zero ) THEN
236 absa = abs( ap( k ) )
237 IF( scale.LT.absa ) THEN
238 sum = one + sum*( scale / absa )**2
239 scale = absa
240 ELSE
241 sum = sum + ( absa / scale )**2
242 END IF
243 END IF
244 IF( lsame( uplo, 'U' ) ) THEN
245 k = k + i + 1
246 ELSE
247 k = k + n - i + 1
248 END IF
249 130 CONTINUE
250 VALUE = scale*sqrt( sum )
251 END IF
252*
253 slansp = VALUE
254 RETURN
255*
256* End of SLANSP
257*
subroutine slassq(n, x, incx, scl, sumsq)
SLASSQ updates a sum of squares represented in scaled form.
Definition: slassq.f90:137
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 slansp(NORM, UPLO, N, AP, WORK)
SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: slansp.f:114
Here is the call graph for this function:
Here is the caller graph for this function: