SASUM/DASUM/IASUM/SCASUM/DZASUM | Sum of magnitudes | |
|
| Indexing Conventions” in the introduction to this |
|
| chapter. |
Output | s | If n ≤ 0, then s = 0. Otherwise, s is the sum of |
|
| magnitudes of the elements of x. |
Fortran | REAL*4 FUNCTION SASUM (N, X,INCX) | |
Equivalent | REAL*4 X(*) |
SASUM = 0.0
IF ( N .LE. 0 ) RETURN
IX = 1
INCXA = ABS ( INCX )
DO 10 I = 1, N
SASUM = SASUM + ABS ( X(IX) )
IX = IX + INCXA
10CONTINUE RETURN END
Example Compute the sum of magnitudes of the elements of a REAL*8 vector x, where x is a vector 10 elements long stored in a
INTEGER*4 | N,INCX | |
REAL*8 | S,DASUM,X(20) | |
N = | 10 |
|
INCX = 1 |
| |
S = | DASUM | (N,X,INCX) |
64HP MLIB User’s Guide