QDP++
generic_blas_local_vcdot_real.h
Go to the documentation of this file.
1// $Id: generic_blas_local_vcdot_real.h,v 1.6 2009-09-15 20:48:41 bjoo Exp $
2
7
8#ifndef QDP_GENERIC_BLAS_LOCAL_VCDOT_REAL
9#define QDP_GENERIC_BLAS_LOCAL_VCDOT_REAL
10
11
12namespace QDP {
13
14// Out = Re (< V1, V2 >) = Re(V1^{dagger} V2)
15// Out REAL
16// V1 V2 are complex vectors of length 3*n_3vec
17// volatile
18inline
19void l_vcdot_real(DOUBLE *Out, REAL *V1, REAL *V2, int n_3vec)
20{
21
22 // routine cleaned up and threaded by Jacques
23 double result=0;
24
25 double v1_r;
26 double v1_i;
27 double v2_r;
28 double v2_i;
29
30 int counter;
31
32 if( n_3vec > 0 )
33 {
34 int len = 24*n_3vec; // 12*(re,im)
35
36#pragma omp parallel for reduction(+:result) private(v1_r,v1_i,v2_r,v2_i)
37 for(counter=0; counter < len; counter+=2)
38 {
39 v1_r = (DOUBLE)V1[counter];
40 v1_i = (DOUBLE)V1[counter+1];
41 v2_r = (DOUBLE)V2[counter];
42 v2_i = (DOUBLE)V2[counter+1];
43
44 result += v1_r*v2_r + v1_i*v2_i;
45 }
46 }
47
48 *Out=(DOUBLE)result;
49}
50
51
52} // namespace QDP;
53
54#endif // guard
REAL32 REAL
REAL64 DOUBLE
Yet another random number generator.
void l_vcdot_real(DOUBLE *Out, REAL *V1, REAL *V2, int n_3vec)