dasum.c: GSL CBLAS real double-precision sum of absolute values
- Thin wrapper that instantiates the generic kernel
source_asum_r.hat typedouble. Verified inLAProof.C.cblas.verif_dasumagainst the functional modelLAProof.C.cblas.asum_model.
/* The following GSL headers are commented out for clightgen: they are
unresolvable here (GSL's gsl/ symlink dir is not generated) and contribute
nothing to cblas_dasum's body beyond the libc fabs, which we obtain directly
from <math.h> (as the other LAProof C sources do, e.g. densemat.c). */
/* #include <gsl/gsl_math.h> */
/* #include <gsl/gsl_cblas.h> */
#include <math.h>
#include "cblas.h"
double
cblas_dasum (const int N, const double *X, const int incX)
{
#define BASE double
#include "source_asum_r.h"
#undef BASE
}Accumulation kernel (source_asum_r.h)
- A forward, left-to-right accumulation of
fabs(X[ix])intor, starting from+0.0. TheincX <= 0guard returns0for nonpositive stride; with unit stride (incX = 1) it is dead andixadvances one element per iteration.
{
BASE r = 0.0;
INDEX i;
INDEX ix = 0;
if (incX <= 0) {
return 0;
}
for (i = 0; i < N; i++) {
r += fabs(X[ix]);
ix += incX;
}
return r;
}