53
53
#include "su3adj.h"
54
54
#include "expo.h"
55
55
#include "float.h"
56
+ #include "global.h"
56
57
57
58
static double imag_det (const su3adj * p ) {
58
59
double d ,tos3 ,o3 ,os3 ;
@@ -76,6 +77,25 @@ static void mul_su3alg(su3adj* p,double d) {
76
77
(* p ).d8 *=d ;
77
78
}
78
79
80
+ void init_exposu3 () {
81
+ int k ;
82
+ double fctr = 1.0 ;
83
+ g_exposu3_no_c = 0 ;
84
+
85
+ while (fctr > DBL_EPSILON ) {
86
+ g_exposu3_no_c ++ ;
87
+ fctr /=(double )(g_exposu3_no_c );
88
+ }
89
+ g_exposu3_no_c += 7 ;
90
+ g_exposu3_no_c += (g_exposu3_no_c %2 );
91
+
92
+ g_exposu3_c = malloc ((g_exposu3_no_c + 1 )* sizeof (* g_exposu3_c ));
93
+
94
+ g_exposu3_c [0 ]= 1.0 ;
95
+ for (k = 0 ; k < g_exposu3_no_c ; k ++ )
96
+ g_exposu3_c [k + 1 ]= g_exposu3_c [k ]/(double )(k + 1 );
97
+ }
98
+
79
99
void exposu3 (su3 * const vr , const su3adj * const p ) {
80
100
int n ,m ,mm ;
81
101
su3 ALIGN v ,v2 ,vt ;
@@ -84,29 +104,6 @@ void exposu3(su3* const vr, const su3adj* const p) {
84
104
_Complex double t ;
85
105
_Complex double ALIGN p0 ,p1 ,p2 ;
86
106
_Complex double ALIGN q0 ,q1 ,q2 ;
87
- static int init_flag = 0 , no_c ;
88
- static double * c ;
89
-
90
- if (init_flag == 0 ) {
91
- int k ;
92
- double fctr = 1.0 ;
93
- no_c = 0 ;
94
-
95
- while (fctr > DBL_EPSILON ) {
96
- no_c ++ ;
97
- fctr /=(double )(no_c );
98
- }
99
- no_c += 7 ;
100
- no_c += (no_c %2 );
101
-
102
- c = malloc ((no_c + 1 )* sizeof (* c ));
103
-
104
- c [0 ]= 1.0 ;
105
- for (k = 0 ; k < no_c ; k ++ )
106
- c [k + 1 ]= c [k ]/(double )(k + 1 );
107
-
108
- init_flag = 1 ;
109
- }
110
107
111
108
_make_su3 (v ,* p );
112
109
_su3_times_su3 (v2 ,v ,v );
@@ -139,19 +136,19 @@ void exposu3(su3* const vr, const su3adj* const p) {
139
136
/* printf(" d= %.16f and t=%.16f + 1i %.16f \n",d,creal(t),cimag(t));*/
140
137
141
138
if (fabs (d )> (1.000001 * (1.000002 - fabs (t ))))
142
- printf ("The norm of X is larger than 1 and N = %d \n" , no_c );
139
+ printf ("The norm of X is larger than 1 and N = %d \n" , g_exposu3_no_c );
143
140
144
141
145
- p0 = c [ no_c ];
142
+ p0 = g_exposu3_c [ g_exposu3_no_c ];
146
143
p1 = 0.0 ;
147
144
p2 = 0.0 ;
148
145
149
- for (n = (no_c - 1 );n >=0 ;n -- ) {
146
+ for (n = (g_exposu3_no_c - 1 );n >=0 ;n -- ) {
150
147
q0 = p0 ;
151
148
q1 = p1 ;
152
149
q2 = p2 ;
153
150
154
- p0 = c [n ]- I * d * q2 ;
151
+ p0 = g_exposu3_c [n ]- I * d * q2 ;
155
152
p1 = q0 - t * q2 ;
156
153
p2 = q1 ;
157
154
}
0 commit comments