sasum.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 82 行
HTML
82 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sasum.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.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="SASUM.1"></a><a href="sasum.f.html#SASUM.1">SASUM</a>(N,SX,INCX)
<span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> INTEGER INCX,N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL SX(*)
<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"> takes the sum of the absolute values.
</span><span class="comment">*</span><span class="comment"> uses unrolled loops for increment equal to one.
</span><span class="comment">*</span><span class="comment"> jack dongarra, linpack, 3/11/78.
</span><span class="comment">*</span><span class="comment"> modified 3/93 to return if incx .le. 0.
</span><span class="comment">*</span><span class="comment"> modified 12/3/93, array(1) declarations changed to array(*)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span>
<span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> REAL STEMP
INTEGER I,M,MP1,NINCX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS,MOD
<span class="comment">*</span><span class="comment"> ..
</span> <a name="SASUM.27"></a><a href="sasum.f.html#SASUM.1">SASUM</a> = 0.0e0
STEMP = 0.0e0
IF (N.LE.0 .OR. INCX.LE.0) RETURN
IF (INCX.EQ.1) GO TO 20
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> code for increment not equal to 1
</span><span class="comment">*</span><span class="comment">
</span> NINCX = N*INCX
DO 10 I = 1,NINCX,INCX
STEMP = STEMP + ABS(SX(I))
10 CONTINUE
<a name="SASUM.38"></a><a href="sasum.f.html#SASUM.1">SASUM</a> = STEMP
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> code for increment equal to 1
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> clean-up loop
</span><span class="comment">*</span><span class="comment">
</span> 20 M = MOD(N,6)
IF (M.EQ.0) GO TO 40
DO 30 I = 1,M
STEMP = STEMP + ABS(SX(I))
30 CONTINUE
IF (N.LT.6) GO TO 60
40 MP1 = M + 1
DO 50 I = MP1,N,6
STEMP = STEMP + ABS(SX(I)) + ABS(SX(I+1)) + ABS(SX(I+2)) +
+ ABS(SX(I+3)) + ABS(SX(I+4)) + ABS(SX(I+5))
50 CONTINUE
60 <a name="SASUM.57"></a><a href="sasum.f.html#SASUM.1">SASUM</a> = STEMP
RETURN
END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?