slangb.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 179 行
HTML
179 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>slangb.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
REAL FUNCTION <a name="SLANGB.1"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a>( NORM, N, KL, KU, AB, LDAB,
$ WORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER NORM
INTEGER KL, KU, LDAB, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL AB( LDAB, * ), WORK( * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLANGB.19"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> returns the value of the one norm, or the Frobenius norm, or
</span><span class="comment">*</span><span class="comment"> the infinity norm, or the element of largest absolute value of an
</span><span class="comment">*</span><span class="comment"> n by n band matrix A, with kl sub-diagonals and ku super-diagonals.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Description
</span><span class="comment">*</span><span class="comment"> ===========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLANGB.26"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> returns the value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLANGB.28"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> = ( max(abs(A(i,j))), NORM = 'M' or 'm'
</span><span class="comment">*</span><span class="comment"> (
</span><span class="comment">*</span><span class="comment"> ( norm1(A), NORM = '1', 'O' or 'o'
</span><span class="comment">*</span><span class="comment"> (
</span><span class="comment">*</span><span class="comment"> ( normI(A), NORM = 'I' or 'i'
</span><span class="comment">*</span><span class="comment"> (
</span><span class="comment">*</span><span class="comment"> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where norm1 denotes the one norm of a matrix (maximum column sum),
</span><span class="comment">*</span><span class="comment"> normI denotes the infinity norm of a matrix (maximum row sum) and
</span><span class="comment">*</span><span class="comment"> normF denotes the Frobenius norm of a matrix (square root of sum of
</span><span class="comment">*</span><span class="comment"> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> NORM (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies the value to be returned in <a name="SLANGB.45"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> as described
</span><span class="comment">*</span><span class="comment"> above.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The order of the matrix A. N >= 0. When N = 0, <a name="SLANGB.49"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> is
</span><span class="comment">*</span><span class="comment"> set to zero.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> KL (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of sub-diagonals of the matrix A. KL >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> KU (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of super-diagonals of the matrix A. KU >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AB (input) REAL array, dimension (LDAB,N)
</span><span class="comment">*</span><span class="comment"> The band matrix A, stored in rows 1 to KL+KU+1. The j-th
</span><span class="comment">*</span><span class="comment"> column of A is stored in the j-th column of the array AB as
</span><span class="comment">*</span><span class="comment"> follows:
</span><span class="comment">*</span><span class="comment"> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDAB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array AB. LDAB >= KL+KU+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) REAL array, dimension (MAX(1,LWORK)),
</span><span class="comment">*</span><span class="comment"> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
</span><span class="comment">*</span><span class="comment"> referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> REAL ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I, J, K, L
REAL SCALE, SUM, VALUE
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="SLASSQ.83"></a><a href="slassq.f.html#SLASSQ.1">SLASSQ</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.86"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.87"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, MIN, SQRT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> IF( N.EQ.0 ) THEN
VALUE = ZERO
ELSE IF( <a name="LSAME.96"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'M'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find max(abs(A(i,j))).
</span><span class="comment">*</span><span class="comment">
</span> VALUE = ZERO
DO 20 J = 1, N
DO 10 I = MAX( KU+2-J, 1 ), MIN( N+KU+1-J, KL+KU+1 )
VALUE = MAX( VALUE, ABS( AB( I, J ) ) )
10 CONTINUE
20 CONTINUE
ELSE IF( ( <a name="LSAME.106"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'O'</span> ) ) .OR. ( NORM.EQ.<span class="string">'1'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find norm1(A).
</span><span class="comment">*</span><span class="comment">
</span> VALUE = ZERO
DO 40 J = 1, N
SUM = ZERO
DO 30 I = MAX( KU+2-J, 1 ), MIN( N+KU+1-J, KL+KU+1 )
SUM = SUM + ABS( AB( I, J ) )
30 CONTINUE
VALUE = MAX( VALUE, SUM )
40 CONTINUE
ELSE IF( <a name="LSAME.118"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'I'</span> ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find normI(A).
</span><span class="comment">*</span><span class="comment">
</span> DO 50 I = 1, N
WORK( I ) = ZERO
50 CONTINUE
DO 70 J = 1, N
K = KU + 1 - J
DO 60 I = MAX( 1, J-KU ), MIN( N, J+KL )
WORK( I ) = WORK( I ) + ABS( AB( K+I, J ) )
60 CONTINUE
70 CONTINUE
VALUE = ZERO
DO 80 I = 1, N
VALUE = MAX( VALUE, WORK( I ) )
80 CONTINUE
ELSE IF( ( <a name="LSAME.135"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'F'</span> ) ) .OR. ( <a name="LSAME.135"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'E'</span> ) ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find normF(A).
</span><span class="comment">*</span><span class="comment">
</span> SCALE = ZERO
SUM = ONE
DO 90 J = 1, N
L = MAX( 1, J-KU )
K = KU + 1 - J + L
CALL <a name="SLASSQ.144"></a><a href="slassq.f.html#SLASSQ.1">SLASSQ</a>( MIN( N, J+KL )-L+1, AB( K, J ), 1, SCALE, SUM )
90 CONTINUE
VALUE = SCALE*SQRT( SUM )
END IF
<span class="comment">*</span><span class="comment">
</span> <a name="SLANGB.149"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a> = VALUE
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SLANGB.152"></a><a href="slangb.f.html#SLANGB.1">SLANGB</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?