?asum
Sum up the absolute values of vector elements. For the complex numbers, the absolute values of the real part and imaginary part are summed.
Interface Definition
C interface:
float cblas_sasum(const BLASINT n, const float *x, const BLASINT incx);
double cblas_dasum(const BLASINT n, const double *x, const BLASINT incx);
float cblas_scasum(const BLASINT n, const void *x, const BLASINT incx);
double cblas_dzasum(const BLASINT n, const void *x, const BLASINT incx);
Fortran interface:
RES = SASUM(N, X, INCX)
RES = DASUM(N, X, INCX)
RES = SCASUM(N, X, INCX)
RES = DZASUM(N, X, INCX)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
n |
Integer |
Number of elements in vector x |
Input |
x |
|
Vector x. The vector size is at least (1+(n-1)*abs(incx)). |
Input |
incx |
Integer |
Increment for the elements of vector x |
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 5, incx = 1, incy = 1;
/*
* Input X: 0.340188, -0.105617, 0.283099, 0.298440, 0.411647
*/
float x[5] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647};
float res = cblas_sasum(n, x, incx);
/*
* Output : 1.438991
*/
Fortran interface:
INTEGER :: N=5
INTEGER :: INCX=1
REAL(4) X(5)
DATA X /0.340188, -0.105617, 0.283099, 0.298440, 0.411647/
RES=SASUM(N,X,INCX)
* Output : 1.438991