dscal.c: GSL CBLAS real double-precision scaling (in place)
- Thin wrapper that instantiates the generic kernel
source_scal_r.hat typedouble. Verified inLAProof.C.cblas.verif_dscalagainst the functional modelLAProof.C.cblas.scal_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_dscal's body (only INDEX from "cblas.h" is needed; the loop
uses no libc math). */
/* #include <gsl/gsl_math.h> */
/* #include <gsl/gsl_cblas.h> */
#include "cblas.h"
void
cblas_dscal (const int N, const double alpha, double *X, const int incX)
{
#define BASE double
#include "source_scal_r.h"
#undef BASE
}Scaling kernel (source_scal_r.h)
- An in-place elementwise update
X[ix] *= alphawith no accumulation. TheincX <= 0guard returns early for nonpositive stride; with unit stride (incX = 1) it is dead andixadvances one element per iteration.
{
INDEX i;
INDEX ix = 0;
if (incX <= 0) {
return;
}
for (i = 0; i < N; i++) {
X[ix] *= alpha;
ix += incX;
}
}