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

## ◆ sasum()

 real function sasum ( integer N, real, dimension(*) SX, integer INCX )

SASUM

Purpose:
```    SASUM takes the sum of the absolute values.
uses unrolled loops for increment equal to one.```
Parameters
 [in] N ``` N is INTEGER number of elements in input vector(s)``` [in] SX ` SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )` [in] INCX ``` INCX is INTEGER storage spacing between elements of SX```
Further Details:
```     jack dongarra, linpack, 3/11/78.
modified 3/93 to return if incx .le. 0.
modified 12/3/93, array(1) declarations changed to array(*)```

Definition at line 71 of file sasum.f.

72*
73* -- Reference BLAS level1 routine --
74* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
75* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
76*
77* .. Scalar Arguments ..
78 INTEGER INCX,N
79* ..
80* .. Array Arguments ..
81 REAL SX(*)
82* ..
83*
84* =====================================================================
85*
86* .. Local Scalars ..
87 REAL STEMP
88 INTEGER I,M,MP1,NINCX
89* ..
90* .. Intrinsic Functions ..
91 INTRINSIC abs,mod
92* ..
93 sasum = 0.0e0
94 stemp = 0.0e0
95 IF (n.LE.0 .OR. incx.LE.0) RETURN
96 IF (incx.EQ.1) THEN
97* code for increment equal to 1
98*
99*
100* clean-up loop
101*
102 m = mod(n,6)
103 IF (m.NE.0) THEN
104 DO i = 1,m
105 stemp = stemp + abs(sx(i))
106 END DO
107 IF (n.LT.6) THEN
108 sasum = stemp
109 RETURN
110 END IF
111 END IF
112 mp1 = m + 1
113 DO i = mp1,n,6
114 stemp = stemp + abs(sx(i)) + abs(sx(i+1)) +
115 \$ abs(sx(i+2)) + abs(sx(i+3)) +
116 \$ abs(sx(i+4)) + abs(sx(i+5))
117 END DO
118 ELSE
119*
120* code for increment not equal to 1
121*
122 nincx = n*incx
123 DO i = 1,nincx,incx
124 stemp = stemp + abs(sx(i))
125 END DO
126 END IF
127 sasum = stemp
128 RETURN
129*
130* End of SASUM
131*
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:72
Here is the call graph for this function:
Here is the caller graph for this function: