QDP++
generic_blas_local_sumsq.h
Go to the documentation of this file.
1// $Id: generic_blas_local_sumsq.h,v 1.3 2009-09-15 20:48:41 bjoo Exp $
2
7
8#ifndef QDP_GENERIC_BLAS_LOCAL_SUMSQ
9#define QDP_GENERIC_BLAS_LOCAL_SUMSQ
10
11
12namespace QDP {
13
14// (Double) (*out) = || (Vector) In ||^2 (local to node)
15inline
16void local_sumsq(DOUBLE *Out, REAL *In, int n_3vec)
17{
18
19 double result;
20 double i1;
21
22 int len = 24*n_3vec;
23
24 // QDPIO::cout << "Len = " << len << endl;
25 int counter;
26 result = 0;
27
28 if( n_3vec > 0 ) {
29#pragma omp parallel for reduction(+:result) private(i1)
30 for(counter=0; counter < len; counter++) {
31 i1 = (double)In[counter];
32 result += i1*i1;
33 }
34 }
35
36 *Out=(DOUBLE)result;
37}
38
39
40} // namespace QDP;
41
42#endif // guard
REAL32 REAL
REAL64 DOUBLE
Yet another random number generator.
void local_sumsq(DOUBLE *Out, REAL *In, int n_3vec)