Permalink
Browse files

some renaming and introducing phmc.h

  • Loading branch information...
1 parent 59cdbbd commit f3e225cf1b5813e2aee005e698055fe80f205a63 @urbach urbach committed Feb 1, 2007
Showing with 242 additions and 247 deletions.
  1. +18 −19 Nondegenerate_Matrix.c
  2. +29 −28 Ptilde_nd.c
  3. +25 −23 chebyshev_polynomial_nd.c
  4. +3 −0 clenshaw_coef.c
  5. +2 −1 eigenvalues_bi.c
  6. +1 −14 global.h
  7. +13 −13 hybrid_nondegenerate_update.c
  8. +6 −0 io.c
  9. +2 −1 max_eigenvalues_bi.c
  10. +77 −79 phmc_tm.c
  11. +5 −4 reweighting_factor_nd.c
  12. +0 −13 update_tm.c
  13. +61 −52 update_tm_nd.c
View
@@ -21,11 +21,10 @@
#include "global.h"
#include "su3.h"
#include "Hopping_Matrix.h"
-/* #include "sse.h" */
+#include "phmc.h"
#include "gamma.h"
/* in piu` */
#include "linsolve.h"
-
#include "linalg_eo.h"
#include "Nondegenerate_Matrix.h"
@@ -99,8 +98,8 @@ void QNon_degenerate(spinor * const l_strange, spinor * const l_charm,
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
- mul_r(l_strange, invmaxev, l_strange, VOLUME/2);
- mul_r(l_charm, invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
+ mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
}
/******************************************
@@ -158,8 +157,8 @@ void QdaggerNon_degenerate(spinor * const l_strange, spinor * const l_charm,
gamma5(l_strange, l_strange, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
- mul_r(l_charm, invmaxev, l_charm, VOLUME/2);
- mul_r(l_strange, invmaxev, l_strange, VOLUME/2);
+ mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
}
@@ -262,9 +261,9 @@ void Q_Qdagger_ND(spinor * const l_strange, spinor * const l_charm,
/* At the end, the normalisation by the max. eigenvalue */
- /* Twice invmaxev since we consider here D Ddag !!! */
- mul_r(l_charm, invmaxev*invmaxev, l_charm, VOLUME/2);
- mul_r(l_strange, invmaxev*invmaxev, l_strange, VOLUME/2);
+ /* Twice phmc_invmaxev since we consider here D Ddag !!! */
+ mul_r(l_charm, phmc_invmaxev*phmc_invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev*phmc_invmaxev, l_strange, VOLUME/2);
}
@@ -346,8 +345,8 @@ void L_POLY_MIN_CCONST(spinor * const l_strange, spinor * const l_charm,
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
- mul_r(l_strange, invmaxev, l_strange, VOLUME/2);
- mul_r(l_charm, invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
+ mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
/*
printf(" IN UP: %f %f \n", l_strange[0].s2.c1.re, l_strange[0].s2.c1.im);
@@ -390,11 +389,11 @@ void L_POLY_MIN_CCONST(spinor * const l_strange, spinor * const l_charm,
printf(" IN 2 DN: %f %f \n", l_charm[0].s2.c1.re, l_charm[0].s2.c1.im);
*/
- /* Finally, we multiply by the constant Cpol */
+ /* Finally, we multiply by the constant phmc_Cpol */
/* which renders the polynomial in monomials */
/* identical to the polynomial a la clenshaw */;
- mul_r(l_strange, Cpol, l_strange, VOLUME/2);
- mul_r(l_charm, Cpol, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_Cpol, l_strange, VOLUME/2);
+ mul_r(l_charm, phmc_Cpol, l_charm, VOLUME/2);
}
@@ -529,9 +528,9 @@ void Q_Qdagger_ND_BI(bispinor * const bisp_l, bispinor * const bisp_k){
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
- /* Twice invmaxev since we consider here D Ddag !!! */
- mul_r(l_charm, invmaxev*invmaxev, l_charm, VOLUME/2);
- mul_r(l_strange, invmaxev*invmaxev, l_strange, VOLUME/2);
+ /* Twice phmc_invmaxev since we consider here D Ddag !!! */
+ mul_r(l_charm, phmc_invmaxev*phmc_invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev*phmc_invmaxev, l_strange, VOLUME/2);
/* !!! I HAVE REPLACED THE ABOVE LINES BY ASSIGNMENTS !!! */
@@ -618,8 +617,8 @@ void Q_test_epsilon(spinor * const l_strange, spinor * const l_charm,
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
- mul_r(l_charm, invmaxev, l_charm, VOLUME/2);
- mul_r(l_strange, invmaxev, l_strange, VOLUME/2);
+ mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
+ mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
}
View
@@ -13,6 +13,7 @@
#include "tm_operators.h"
#include "Nondegenerate_Matrix.h"
#include "chebyshev_polynomial_nd.h"
+#include "phmc.h"
#include "Ptilde_nd.h"
@@ -26,16 +27,16 @@ double func_tilde(double u, double exponent){
int j;
double res=0.0;
- z = (2.0*u - cheb_evmin - cheb_evmax)/(double)(cheb_evmax - cheb_evmin);
+ z = (2.0*u - phmc_cheb_evmin - phmc_cheb_evmax)/(double)(phmc_cheb_evmax - phmc_cheb_evmin);
z2 = 2.0*z;
- for(j=dop_n_cheby-1; j>=1; j--){
+ for(j=phmc_dop_n_cheby-1; j>=1; j--){
sv = d;
- d = z2*d - ddd + dop_cheby_coef[j];
+ d = z2*d - ddd + phmc_dop_cheby_coef[j];
ddd = sv;
}
- res = z*d - ddd + 0.5*dop_cheby_coef[0];
+ res = z*d - ddd + 0.5*phmc_dop_cheby_coef[0];
ff = (double)(res * sqrt(u));
@@ -148,8 +149,8 @@ void Poly_tilde_ND(spinor *R_s, spinor *R_c, double *dd, int n,
#endif
- fact1=4/(cheb_evmax-cheb_evmin);
- fact2=-2*(cheb_evmax+cheb_evmin)/(cheb_evmax-cheb_evmin);
+ fact1=4/(phmc_cheb_evmax-phmc_cheb_evmin);
+ fact2=-2*(phmc_cheb_evmax+phmc_cheb_evmin)/(phmc_cheb_evmax-phmc_cheb_evmin);
zero_spinor_field(&ds[0],VOLUME/2);
zero_spinor_field(&dds[0],VOLUME/2);
@@ -233,7 +234,7 @@ double chebtilde_eval(int M, double *dd, double s){
double d=0,ddd=0, sv, z, z2, res;
int j;
- z = (2.0*s - cheb_evmin - cheb_evmax)/(double)(cheb_evmax - cheb_evmin);
+ z = (2.0*s - phmc_cheb_evmin - phmc_cheb_evmax)/(double)(phmc_cheb_evmax - phmc_cheb_evmin);
z2 = 2.0*z;
for(j=M-1; j>=1; j--){
@@ -273,7 +274,7 @@ void degree_of_Ptilde(){
spinor *aux2s=NULL, *aux2s_=NULL, *aux2c=NULL, *aux2c_=NULL;
if(ini==0){
- ptilde_cheby_coef = calloc(NTILDE_CHEBYMAX,sizeof(double));
+ phmc_ptilde_cheby_coef = calloc(NTILDE_CHEBYMAX,sizeof(double));
ini=1;
}
@@ -302,36 +303,36 @@ void degree_of_Ptilde(){
#endif
- Ptilde_cheb_coefs(cheb_evmin, cheb_evmax, ptilde_cheby_coef, NTILDE_CHEBYMAX, -1.0);
+ Ptilde_cheb_coefs(phmc_cheb_evmin, phmc_cheb_evmax, phmc_ptilde_cheby_coef, NTILDE_CHEBYMAX, -1.0);
random_spinor_field(ss,VOLUME/2, 1);
random_spinor_field(sc,VOLUME/2, 1);
if(g_proc_id == g_stdio_proc){
- printf(" \n In Ptilde: EVmin = %f EVmax = %f\n", cheb_evmin, cheb_evmax);
+ printf(" \n In Ptilde: EVmin = %f EVmax = %f\n", phmc_cheb_evmin, phmc_cheb_evmax);
printf("\n determine the degree of the polynomial : Stop=%e \n", g_acc_Ptilde);
fflush(stdout);
}
- ptilde_n_cheby = dop_n_cheby;
+ phmc_ptilde_n_cheby = phmc_dop_n_cheby;
for(i = 0;i < 100 ; i++){
- if (ptilde_n_cheby > NTILDE_CHEBYMAX) {
+ if (phmc_ptilde_n_cheby > NTILDE_CHEBYMAX) {
if(g_proc_id == g_stdio_proc){
- printf("Error: n_cheby=%d > NTILDE_CHEBYMAX=%d\n",ptilde_n_cheby,NTILDE_CHEBYMAX);
+ printf("Error: n_cheby=%d > NTILDE_CHEBYMAX=%d\n",phmc_ptilde_n_cheby,NTILDE_CHEBYMAX);
printf("Increase n_chebymax\n");
}
errorhandler(35,"degree_of_polynomial");
}
/* Ptilde P S P Ptilde X - X */
- Poly_tilde_ND(&auxs[0], &auxc[0], ptilde_cheby_coef, ptilde_n_cheby, &ss[0], &sc[0]);
- QdaggerQ_poly(&aux2s[0], &aux2c[0], dop_cheby_coef, dop_n_cheby, &auxs[0], &auxc[0]);
+ Poly_tilde_ND(&auxs[0], &auxc[0], phmc_ptilde_cheby_coef, phmc_ptilde_n_cheby, &ss[0], &sc[0]);
+ QdaggerQ_poly(&aux2s[0], &aux2c[0], phmc_dop_cheby_coef, phmc_dop_n_cheby, &auxs[0], &auxc[0]);
Q_Qdagger_ND(&auxs[0], &auxc[0], &aux2s[0], &aux2c[0]);
- QdaggerQ_poly(&aux2s[0], &aux2c[0], dop_cheby_coef, dop_n_cheby, &auxs[0], &auxc[0]);
- Poly_tilde_ND(&auxs[0], &auxc[0], ptilde_cheby_coef, ptilde_n_cheby, &aux2s[0], &aux2c[0]);
+ QdaggerQ_poly(&aux2s[0], &aux2c[0], phmc_dop_cheby_coef, phmc_dop_n_cheby, &auxs[0], &auxc[0]);
+ Poly_tilde_ND(&auxs[0], &auxc[0], phmc_ptilde_cheby_coef, phmc_ptilde_n_cheby, &aux2s[0], &aux2c[0]);
diff(&aux2s[0],&auxs[0],&ss[0],VOLUME/2);
@@ -344,13 +345,13 @@ void degree_of_Ptilde(){
temp2 = 0.0;
}
if(g_proc_id == g_stdio_proc) {
- printf("At n=%d || differences ||^2 : UP=%e DN=%e \n", ptilde_n_cheby, temp, temp2);
+ printf("At n=%d || differences ||^2 : UP=%e DN=%e \n", phmc_ptilde_n_cheby, temp, temp2);
}
sum=0;
- for(j=ptilde_n_cheby; j<NTILDE_CHEBYMAX; j++){
- sum += fabs(ptilde_cheby_coef[j]);
+ for(j=phmc_ptilde_n_cheby; j<NTILDE_CHEBYMAX; j++){
+ sum += fabs(phmc_ptilde_cheby_coef[j]);
}
if(g_proc_id == g_stdio_proc) printf(" Sum remaining | d_n | = %e\n", sum);
@@ -363,20 +364,20 @@ void degree_of_Ptilde(){
printf(" RND: || (Ptilde P S P Ptilde - 1)X ||^2 / || 2X ||^2 : UP=%e DN=%e \n",temp, temp2);
}
- temp = chebtilde_eval(ptilde_n_cheby, ptilde_cheby_coef, cheb_evmin);
- temp *= cheb_eval(dop_n_cheby, dop_cheby_coef, cheb_evmin);
- temp *= cheb_evmin;
- temp *= cheb_eval(dop_n_cheby, dop_cheby_coef, cheb_evmin);
- temp *= chebtilde_eval(ptilde_n_cheby, ptilde_cheby_coef, cheb_evmin);
+ temp = chebtilde_eval(phmc_ptilde_n_cheby, phmc_ptilde_cheby_coef, phmc_cheb_evmin);
+ temp *= cheb_eval(phmc_dop_n_cheby, phmc_dop_cheby_coef, phmc_cheb_evmin);
+ temp *= phmc_cheb_evmin;
+ temp *= cheb_eval(phmc_dop_n_cheby, phmc_dop_cheby_coef, phmc_cheb_evmin);
+ temp *= chebtilde_eval(phmc_ptilde_n_cheby, phmc_ptilde_cheby_coef, phmc_cheb_evmin);
temp = 0.5*fabs(temp - 1);
if(g_proc_id == g_stdio_proc){
- printf(" Delta_IR at s=%f: | Ptilde P s_low P Ptilde - 1 |/2 = %e \n", cheb_evmin, temp);
- printf("\n Latest (TILDE) polynomial degree = %d\n\n", ptilde_n_cheby);
+ printf(" Delta_IR at s=%f: | Ptilde P s_low P Ptilde - 1 |/2 = %e \n", phmc_cheb_evmin, temp);
+ printf("\n Latest (TILDE) polynomial degree = %d\n\n", phmc_ptilde_n_cheby);
}
break;
}
- ptilde_n_cheby+=1;
+ phmc_ptilde_n_cheby+=1;
}
View
@@ -11,8 +11,10 @@
#include "linalg_eo.h"
#include "start.h"
#include "tm_operators.h"
-#include "chebyshev_polynomial_nd.h"
#include "Nondegenerate_Matrix.h"
+#include "phmc.h"
+#include "chebyshev_polynomial_nd.h"
+
#define PI 3.141592653589793
@@ -30,7 +32,7 @@ void chebyshev_coefs(double aa, double bb, double c[], int n, double exponent){
inv_n=1./(double)n;
f=calloc(n,sizeof(double));/*vector(0,n-1);*/
- if(g_proc_id == g_stdio_proc){
+ if((g_proc_id == g_stdio_proc) && (g_debug_level > 2)) {
printf("\n hello in chebyshev_polynomial\n");
printf("n= %d inv_n=%e \n",n,inv_n);
printf("allocation !!!\n");
@@ -132,8 +134,8 @@ void QdaggerQ_poly(spinor *R_s, spinor *R_c, double *c, int n,
#endif
- fact1=4/(cheb_evmax-cheb_evmin);
- fact2=-2*(cheb_evmax+cheb_evmin)/(cheb_evmax-cheb_evmin);
+ fact1=4/(phmc_cheb_evmax-phmc_cheb_evmin);
+ fact2=-2*(phmc_cheb_evmax+phmc_cheb_evmin)/(phmc_cheb_evmax-phmc_cheb_evmin);
zero_spinor_field(&ds[0],VOLUME/2);
zero_spinor_field(&dds[0],VOLUME/2);
@@ -219,7 +221,7 @@ double cheb_eval(int M, double *c, double s){
double d=0,dd=0, sv, z, z2, res;
int j;
- z = (2.0*s - cheb_evmin - cheb_evmax)/(double)(cheb_evmax - cheb_evmin);
+ z = (2.0*s - phmc_cheb_evmin - phmc_cheb_evmax)/(double)(phmc_cheb_evmax - phmc_cheb_evmin);
z2 = 2.0*z;
for(j=M-1; j>=1; j--){
@@ -262,7 +264,7 @@ void degree_of_polynomial_nd(){
if(ini==0){
- dop_cheby_coef = calloc(N_CHEBYMAX,sizeof(double));
+ phmc_dop_cheby_coef = calloc(N_CHEBYMAX,sizeof(double));
ini=1;
}
@@ -292,39 +294,39 @@ void degree_of_polynomial_nd(){
#endif
- chebyshev_coefs(cheb_evmin, cheb_evmax, dop_cheby_coef, N_CHEBYMAX, -0.5);
+ chebyshev_coefs(phmc_cheb_evmin, phmc_cheb_evmax, phmc_dop_cheby_coef, N_CHEBYMAX, -0.5);
/*
printf(" \n NchebyMAX = %d \n ", N_CHEBYMAX);
for(j=0; j<49; j++){
- printf(" At %d Coef=%20.18f \n", j, dop_cheby_coef[j]);
+ printf(" At %d Coef=%20.18f \n", j, phmc_dop_cheby_coef[j]);
}
*/
random_spinor_field(ss,VOLUME/2, 1);
random_spinor_field(sc,VOLUME/2, 1);
if(g_proc_id == g_stdio_proc){
- printf(" \n In P: EVmin = %f EVmax = %f \n", cheb_evmin, cheb_evmax);
+ printf(" \n In P: EVmin = %f EVmax = %f \n", phmc_cheb_evmin, phmc_cheb_evmax);
printf("\n determine the degree of the polynomial : Stop=%e \n", g_acc_Pfirst);
fflush(stdout);
}
- dop_n_cheby=49;
+ phmc_dop_n_cheby=49;
for(i = 0;i < 100 ; i++){
- if (dop_n_cheby > N_CHEBYMAX) {
+ if (phmc_dop_n_cheby > N_CHEBYMAX) {
if(g_proc_id == g_stdio_proc){
- printf("Error: n_cheby=%d > N_CHEBYMAX=%d\n",dop_n_cheby,N_CHEBYMAX);
+ printf("Error: n_cheby=%d > N_CHEBYMAX=%d\n",phmc_dop_n_cheby,N_CHEBYMAX);
printf("Increase n_chebymax\n");
}
/* errorhandler(35,"degree_of_polynomial"); */
}
- QdaggerQ_poly(&auxs[0], &auxc[0], dop_cheby_coef, dop_n_cheby, &ss[0], &sc[0]);
+ QdaggerQ_poly(&auxs[0], &auxc[0], phmc_dop_cheby_coef, phmc_dop_n_cheby, &ss[0], &sc[0]);
Q_Qdagger_ND(&aux2s[0], &aux2c[0], &auxs[0], &auxc[0]);
- QdaggerQ_poly(&auxs[0], &auxc[0], dop_cheby_coef, dop_n_cheby, &aux2s[0], &aux2c[0]);
+ QdaggerQ_poly(&auxs[0], &auxc[0], phmc_dop_cheby_coef, phmc_dop_n_cheby, &aux2s[0], &aux2c[0]);
diff(&aux2s[0],&auxs[0],&ss[0],VOLUME/2);
@@ -337,14 +339,14 @@ void degree_of_polynomial_nd(){
temp2 = 0.0;
}
if(g_proc_id == g_stdio_proc) {
- printf("At n=%d || differences ||^2 : UP=%e DN=%e \n",dop_n_cheby, temp, temp2);
+ printf("At n=%d || differences ||^2 : UP=%e DN=%e \n",phmc_dop_n_cheby, temp, temp2);
fflush(stdout);
}
sum=0;
- for(j=dop_n_cheby; j<N_CHEBYMAX; j++){
- sum += fabs(dop_cheby_coef[j]);
+ for(j=phmc_dop_n_cheby; j<N_CHEBYMAX; j++){
+ sum += fabs(phmc_dop_cheby_coef[j]);
}
if(g_proc_id == g_stdio_proc) {
printf(" Sum remaining | c_n |=%e \n", sum);
@@ -357,19 +359,19 @@ void degree_of_polynomial_nd(){
printf(" RND: || (P S P - 1)X ||^2 /|| 2X ||^2 : UP=%e DN=%e \n",temp, temp2);
}
- temp = cheb_eval(dop_n_cheby, dop_cheby_coef, cheb_evmin);
- temp *= cheb_evmin;
- temp *= cheb_eval(dop_n_cheby, dop_cheby_coef, cheb_evmin);
+ temp = cheb_eval(phmc_dop_n_cheby, phmc_dop_cheby_coef, phmc_cheb_evmin);
+ temp *= phmc_cheb_evmin;
+ temp *= cheb_eval(phmc_dop_n_cheby, phmc_dop_cheby_coef, phmc_cheb_evmin);
temp = 0.5*fabs(temp - 1);
if(g_proc_id == g_stdio_proc){
- printf(" Delta_IR at s=%f: | P s_low P - 1 |/2 = %e \n", cheb_evmin, temp);
- printf("\n Latest (FIRST) polynomial degree = %d \n \n", dop_n_cheby);
+ printf(" Delta_IR at s=%f: | P s_low P - 1 |/2 = %e \n", phmc_cheb_evmin, temp);
+ printf("\n Latest (FIRST) polynomial degree = %d \n \n", phmc_dop_n_cheby);
}
break;
}
/* RECALL THAT WE NEED AN EVEN DEGREE !!!! */
- dop_n_cheby+=2;
+ phmc_dop_n_cheby+=2;
}
View
@@ -1,6 +1,9 @@
+/* $Id$ */
+
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
+#include "phmc.h"
#include "clenshaw_coef.h"
#define Pi 3.141592653589793
Oops, something went wrong.

0 comments on commit f3e225c

Please sign in to comment.