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

◆ slanst()

real function slanst ( character norm,
integer n,
real, dimension( * ) d,
real, dimension( * ) e )

SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix.

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

Purpose:
!>
!> SLANST  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 tridiagonal matrix A.
!> 
Returns
SLANST
!>
!>    SLANST = ( 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 SLANST as described
!>          above.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.  When N = 0, SLANST is
!>          set to zero.
!> 
[in]D
!>          D is REAL array, dimension (N)
!>          The diagonal elements of A.
!> 
[in]E
!>          E is REAL array, dimension (N-1)
!>          The (n-1) sub-diagonal or super-diagonal elements of A.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 97 of file slanst.f.

98*
99* -- LAPACK auxiliary routine --
100* -- LAPACK is a software package provided by Univ. of Tennessee, --
101* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
102*
103* .. Scalar Arguments ..
104 CHARACTER NORM
105 INTEGER N
106* ..
107* .. Array Arguments ..
108 REAL D( * ), E( * )
109* ..
110*
111* =====================================================================
112*
113* .. Parameters ..
114 REAL ONE, ZERO
115 parameter( one = 1.0e+0, zero = 0.0e+0 )
116* ..
117* .. Local Scalars ..
118 INTEGER I
119 REAL ANORM, SCALE, SUM
120* ..
121* .. External Functions ..
122 LOGICAL LSAME, SISNAN
123 EXTERNAL lsame, sisnan
124* ..
125* .. External Subroutines ..
126 EXTERNAL slassq
127* ..
128* .. Intrinsic Functions ..
129 INTRINSIC abs, sqrt
130* ..
131* .. Executable Statements ..
132*
133 IF( n.LE.0 ) THEN
134 anorm = zero
135 ELSE IF( lsame( norm, 'M' ) ) THEN
136*
137* Find max(abs(A(i,j))).
138*
139 anorm = abs( d( n ) )
140 DO 10 i = 1, n - 1
141 sum = abs( d( i ) )
142 IF( anorm .LT. sum .OR. sisnan( sum ) ) anorm = sum
143 sum = abs( e( i ) )
144 IF( anorm .LT. sum .OR. sisnan( sum ) ) anorm = sum
145 10 CONTINUE
146 ELSE IF( lsame( norm, 'O' ) .OR. norm.EQ.'1' .OR.
147 $ lsame( norm, 'I' ) ) THEN
148*
149* Find norm1(A).
150*
151 IF( n.EQ.1 ) THEN
152 anorm = abs( d( 1 ) )
153 ELSE
154 anorm = abs( d( 1 ) )+abs( e( 1 ) )
155 sum = abs( e( n-1 ) )+abs( d( n ) )
156 IF( anorm .LT. sum .OR. sisnan( sum ) ) anorm = sum
157 DO 20 i = 2, n - 1
158 sum = abs( d( i ) )+abs( e( i ) )+abs( e( i-1 ) )
159 IF( anorm .LT. sum .OR. sisnan( sum ) ) anorm = sum
160 20 CONTINUE
161 END IF
162 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
163 $ ( lsame( norm, 'E' ) ) ) THEN
164*
165* Find normF(A).
166*
167 scale = zero
168 sum = one
169 IF( n.GT.1 ) THEN
170 CALL slassq( n-1, e, 1, scale, sum )
171 sum = 2*sum
172 END IF
173 CALL slassq( n, d, 1, scale, sum )
174 anorm = scale*sqrt( sum )
175 END IF
176*
177 slanst = anorm
178 RETURN
179*
180* End of SLANST
181*
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:57
real function slanst(norm, n, d, e)
SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition slanst.f:98
subroutine slassq(n, x, incx, scale, sumsq)
SLASSQ updates a sum of squares represented in scaled form.
Definition slassq.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: