You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
269 B

#include <omp.h>
#ifdef __cplusplus
extern "C"
#endif
void
scalprod(int n, double* x, double* y, double* res)
{
int i;
double res_v = 0.;
#pragma omp parallel for reduction(+ : res_v)
for (i = 0; i < n; ++i) {
res_v += x[i] * y[i];
}
*res = res_v;
}