slantp.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 310 行 · 第 1/2 页
HTML
310 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>slantp.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="SLANTP.1"></a><a href="slantp.f.html#SLANTP.1">SLANTP</a>( NORM, UPLO, DIAG, N, AP, 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 DIAG, NORM, UPLO
INTEGER N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL AP( * ), 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="SLANTP.18"></a><a href="slantp.f.html#SLANTP.1">SLANTP</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 a
</span><span class="comment">*</span><span class="comment"> triangular matrix A, supplied in packed form.
</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="SLANTP.25"></a><a href="slantp.f.html#SLANTP.1">SLANTP</a> returns the value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLANTP.27"></a><a href="slantp.f.html#SLANTP.1">SLANTP</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="SLANTP.44"></a><a href="slantp.f.html#SLANTP.1">SLANTP</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"> UPLO (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether the matrix A is upper or lower triangular.
</span><span class="comment">*</span><span class="comment"> = 'U': Upper triangular
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangular
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DIAG (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether or not the matrix A is unit triangular.
</span><span class="comment">*</span><span class="comment"> = 'N': Non-unit triangular
</span><span class="comment">*</span><span class="comment"> = 'U': Unit triangular
</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="SLANTP.58"></a><a href="slantp.f.html#SLANTP.1">SLANTP</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"> AP (input) REAL array, dimension (N*(N+1)/2)
</span><span class="comment">*</span><span class="comment"> The upper or lower triangular matrix A, packed columnwise in
</span><span class="comment">*</span><span class="comment"> a linear array. The j-th column of A is stored in the array
</span><span class="comment">*</span><span class="comment"> AP as follows:
</span><span class="comment">*</span><span class="comment"> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
</span><span class="comment">*</span><span class="comment"> Note that when DIAG = 'U', the elements of the array AP
</span><span class="comment">*</span><span class="comment"> corresponding to the diagonal elements of the matrix A are
</span><span class="comment">*</span><span class="comment"> not referenced, but are assumed to be one.
</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"> .. 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> LOGICAL UDIAG
INTEGER I, J, K
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.87"></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.90"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.91"></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, 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.100"></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> K = 1
IF( <a name="LSAME.105"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIAG, <span class="string">'U'</span> ) ) THEN
VALUE = ONE
IF( <a name="LSAME.107"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) ) THEN
DO 20 J = 1, N
DO 10 I = K, K + J - 2
VALUE = MAX( VALUE, ABS( AP( I ) ) )
10 CONTINUE
K = K + J
20 CONTINUE
ELSE
DO 40 J = 1, N
DO 30 I = K + 1, K + N - J
VALUE = MAX( VALUE, ABS( AP( I ) ) )
30 CONTINUE
K = K + N - J + 1
40 CONTINUE
END IF
ELSE
VALUE = ZERO
IF( <a name="LSAME.124"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) ) THEN
DO 60 J = 1, N
DO 50 I = K, K + J - 1
VALUE = MAX( VALUE, ABS( AP( I ) ) )
50 CONTINUE
K = K + J
60 CONTINUE
ELSE
DO 80 J = 1, N
DO 70 I = K, K + N - J
VALUE = MAX( VALUE, ABS( AP( I ) ) )
70 CONTINUE
K = K + N - J + 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?