-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsu3_proj.c
51 lines (45 loc) · 1.29 KB
/
su3_proj.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/***************** su3_proj.c (in su3.a) ******************************
* *
* void su3_projector( su3_vector *a, su3_vector *b, su3_matrix *c ) *
* C <- outer product of A and B *
* C_ij = A_i * B_adjoint_j *
*/
#include "../include/config.h"
#include "../include/complex.h"
#include "../include/su3.h"
#ifndef FAST
void su3_projector( su3_vector *a, su3_vector *b, su3_matrix *c ){
register int i,j;
for(i=0;i<3;i++)for(j=0;j<3;j++){
CMUL_J( a->c[i], b->c[j], c->e[i][j] );
}
}
#else
#ifdef NATIVEDOUBLE /* RS6000 version */
void su3_projector( su3_vector *a, su3_vector *b, su3_matrix *c ){
register int i,j;
register double ar,ai,br,bi;
for(i=0;i<3;i++){
ar=a->c[i].real; ai=a->c[i].imag;
for(j=0;j<3;j++){
br=b->c[j].real; bi=b->c[j].imag;
c->e[i][j].real = ar*br + ai*bi;
c->e[i][j].imag = ai*br - ar*bi;
}
}
}
#else
void su3_projector( su3_vector *a, su3_vector *b, su3_matrix *c ){
register int i,j;
register Real tmp,tmp2;
for(i=0;i<3;i++)for(j=0;j<3;j++){
tmp2 = a->c[i].real * b->c[j].real;
tmp = a->c[i].imag * b->c[j].imag;
c->e[i][j].real = tmp + tmp2;
tmp2 = a->c[i].real * b->c[j].imag;
tmp = a->c[i].imag * b->c[j].real;
c->e[i][j].imag = tmp - tmp2;
}
}
#endif /* End of "#ifdef NATIVEDOUBLE" */
#endif /* end ifdef FAST */