LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ 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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
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 74 of file sasum.f.

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