QDP++
include
scalarsite_generic
generic_blas_local_vcdot.h
Go to the documentation of this file.
1
// $Id: generic_blas_local_vcdot.h,v 1.6 2009-09-15 20:48:41 bjoo Exp $
2
7
8
#ifndef QDP_GENERIC_BLAS_LOCAL_VCDOT
9
#define QDP_GENERIC_BLAS_LOCAL_VCDOT
10
11
12
namespace
QDP
{
13
14
// Out = < V1, V2 > = V1^{dagger} V2
15
// Out is complex: Out_re, Out_im
16
// V1 V2 are complex vectors of length 3*n_3vec
17
//volatile
18
19
inline
20
void
l_vcdot
(
DOUBLE
*Out_re,
DOUBLE
*Out_im,
REAL
*V1,
REAL
*V2,
int
n_3vec)
21
{
22
23
double
result_re=0;
24
double
result_im=0;
25
26
double
v1_r;
27
double
v1_i;
28
double
v2_r;
29
double
v2_i;
30
31
int
counter;
32
33
if
( n_3vec > 0 ) {
34
35
int
len = 24*n_3vec;
// 12*(re,im)
36
37
#pragma omp parallel for reduction(+:result_re,result_im) private(v1_r,v1_i,v2_r,v2_i)
38
for
(counter=0; counter < len; counter+=2) {
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
result_re += v1_r*v2_r + v1_i*v2_i;
44
result_im += v1_r*v2_i - v1_i*v2_r;
45
}
46
}
47
48
*Out_re=(
DOUBLE
)result_re;
49
*Out_im=(
DOUBLE
)result_im;
50
}
51
52
}
// namespace QDP;
53
54
#endif
// guard
QDP::REAL
REAL32 REAL
Definition
qdp_scalarsite_defs.h:28
QDP::DOUBLE
REAL64 DOUBLE
Definition
qdp_scalarsite_defs.h:29
QDP
Yet another random number generator.
Definition
qdp_bgq_threadbind.cc:16
QDP::l_vcdot
void l_vcdot(DOUBLE *Out_re, DOUBLE *Out_im, REAL *V1, REAL *V2, int n_3vec)
Definition
generic_blas_local_vcdot.h:20
Generated by
1.16.1