CHROMA
ord_norm2x_cdotxy_kernel_generic.h
Go to the documentation of this file.
1 inline
2 void ord_norm2x_cdotxy_kernel(int lo, int hi, int my_id, ord_norm2x_cdotxy_arg* a)
3 {
4  int atom = a->atom;
5  int low = atom*lo;
6  int len = atom*(hi-lo);
7 
8  REAL32* x_ptr = &(a->x_ptr[low]);
9  REAL32* y_ptr = &(a->y_ptr[low]);
10  REAL64 norm_array[3] = {0,0,0};
11 
12  if( atom % 4 == 0) {
13  for(int count = 0; count < len; count+=4) {
14  // norm
15  norm_array[0] += x_ptr[count]*x_ptr[count];
16  norm_array[0] += x_ptr[count+1]*x_ptr[count+1];
17  norm_array[0] += x_ptr[count+2]*x_ptr[count+2];
18  norm_array[0] += x_ptr[count+3]*x_ptr[count+3];
19 
20  // cdot re
21  norm_array[1] += x_ptr[count]*y_ptr[count];
22  norm_array[1] += x_ptr[count+1]*y_ptr[count+1];
23  norm_array[1] += x_ptr[count+2]*y_ptr[count+2];
24  norm_array[1] += x_ptr[count+3]*y_ptr[count+3];
25 
26  // cdot im
27  norm_array[2] += x_ptr[count]*y_ptr[count+1];
28  norm_array[2] -= x_ptr[count+1]*y_ptr[count];
29  norm_array[2] += x_ptr[count+2]*y_ptr[count+3];
30  norm_array[2] -= x_ptr[count+3]*y_ptr[count+2];
31 
32  }
33  a->norm_space[3*my_id]=norm_array[0];
34  a->norm_space[3*my_id+1]=norm_array[1];
35  a->norm_space[3*my_id+2]=norm_array[2];
36  }
37  else {
38  QDPIO::cout << "ord_norm2x_cdotxy_kernel_generic.h: len not divisible by 4" << std::endl;
39  QDP_abort(1);
40  }
41 }
Complex a
Definition: invbicg.cc:95
int count
Definition: octave.h:14
void ord_norm2x_cdotxy_kernel(int lo, int hi, int my_id, ord_norm2x_cdotxy_arg *a)