Skip to content

Commit

Permalink
rnorm <-> r_norm convention
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrzewa committed Nov 23, 2023
1 parent 300a01a commit 4d49c86
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
14 changes: 7 additions & 7 deletions P_M_eta.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
#include "X_psi.h"
#include "gamma.h"

double rnorm=-1;
double r_norm=-1;

/* |R>=rnorm^2 Q^2 |S> */
/* |R>=r_norm^2 Q^2 |S> */
void norm_X_sqr_psi(spinor * const R, spinor * const S,
double const mstar);

/* |R>=rnorm Q|S> */
/* |R>=r_norm Q|S> */
void norm_X_n_psi(spinor * const R, spinor * const S,
const int n, double const mstar);

Expand Down Expand Up @@ -214,7 +214,7 @@ void norm_X_sqr_psi(spinor * const R, spinor * const S, double const mstar) {
printf("using X_psiSquare.\n");
X_psiSquare(R, S, mstar);
}
mul_r(R, rnorm*rnorm, R, VOLUME);
mul_r(R, r_norm*r_norm, R, VOLUME);


free(aux_);
Expand All @@ -241,7 +241,7 @@ void norm_X_n_psi(spinor * const R, spinor * const S,
/* Here is where we have to include our operator which in this case is
X = 1 - (2M^2)/(D_m^dagger*D_m + M^2) */
X_psi(R, aux, mstar);
npar *= rnorm;
npar *= r_norm;
}
mul_r(R, npar, R, VOLUME);

Expand Down Expand Up @@ -312,7 +312,7 @@ void X_over_sqrt_X_sqr(spinor * const R, double * const c,
assign(R, aux, VOLUME);//=0
}
else{
/*|R>=rnorm^2 X^2|aux> -> since aux=d -> |R>=rnorm^2 Q^2|d>*/
/*|R>=r_norm^2 X^2|aux> -> since aux=d -> |R>=r_norm^2 Q^2|d>*/
norm_X_sqr_psi(R, aux, mstar);//WARNING: - maybe we have to pass this point only when j=n-2, because R is not manipulated in the loop body.
// - seems to setup d_n-1=0
}
Expand All @@ -333,7 +333,7 @@ void X_over_sqrt_X_sqr(spinor * const R, double * const c,
if(0) assign_sub_lowest_eigenvalues(R, d, no_eigenvalues-1, VOLUME);
else assign(R, d, VOLUME);

/*|aux>=rnorm^2 Q^2|R> */
/*|aux>=r_norm^2 Q^2|R> */
norm_X_sqr_psi(aux, R, mstar);
temp1=-1.0;
temp2=c[0]/2.;
Expand Down
44 changes: 22 additions & 22 deletions operator/Dov_psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@
#include "solver/dirac_operator_eigenvectors.h"

void addproj_q_invsqrt(spinor * const Q, spinor * const P, const int n, const int N);
/* |R>=rnorm^2 Q^2 |S> */
/* |R>=r_norm^2 Q^2 |S> */
void norm_Q_sqr_psi(spinor * const R, spinor * const S,
const double rnorm);
/* void norm_Q_n_psi(spinor *R, spinor *S, double m, int n, double rnorm) */
const double r_norm);
/* void norm_Q_n_psi(spinor *R, spinor *S, double m, int n, double r_norm) */
/* norm_Q_n_psi makes multiplication of any power of */
/* Q== gamma5*D_W, initial vector S, final R, finally the */
/* vector R is multiplied by a factor rnorm^n */
/* |R>=rnorm^n Q^n |S> where m is a mass */
/* vector R is multiplied by a factor r_norm^n */
/* |R>=r_norm^n Q^n |S> where m is a mass */
void norm_Q_n_psi(spinor * const R, spinor * const S,
const int n, const double rnorm);
const int n, const double r_norm);
/* this is Q/sqrt(Q^2) */
void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
const int n, spinor * const S,
const double rnorm, const double minev);
const double r_norm, const double minev);

double ov_s = 0.6;
double m_ov = 0.;
Expand Down Expand Up @@ -287,9 +287,9 @@ void addproj_q_invsqrt(spinor * const Q, spinor * const P, const int n, const in
}


/* |R>=rnorm^2 Q^2 |S> */
/* |R>=r_norm^2 Q^2 |S> */
void norm_Q_sqr_psi(spinor * const R, spinor * const S,
const double rnorm) {
const double r_norm) {

spinor *aux;
aux=lock_Dov_WS_spinor(1);
Expand All @@ -301,19 +301,19 @@ void norm_Q_sqr_psi(spinor * const R, spinor * const S,
gamma5(aux, R, VOLUME);
D_psi(R, aux);
gamma5(R, R, VOLUME);
mul_r(R, rnorm*rnorm, R, VOLUME);
mul_r(R, r_norm*r_norm, R, VOLUME);

unlock_Dov_WS_spinor(1);
return;
}

/* void norm_Q_n_psi(spinor *R, spinor *S, double m, int n, double rnorm) */
/* void norm_Q_n_psi(spinor *R, spinor *S, double m, int n, double r_norm) */
/* norm_Q_n_psi makes multiplication of any power of */
/* Q== gamma5*D_W, initial vector S, final R, finally the */
/* vector R is multiplied by a factor rnorm^n */
/* |R>=rnorm^n Q^n |S> */
/* vector R is multiplied by a factor r_norm^n */
/* |R>=r_norm^n Q^n |S> */
void norm_Q_n_psi(spinor * const R, spinor * const S,
const int n, const double rnorm) {
const int n, const double r_norm) {

int i;
double npar = 1.;
Expand All @@ -328,7 +328,7 @@ void norm_Q_n_psi(spinor * const R, spinor * const S,
D_psi(R, aux);
/* Term -1-s is done in D_psi! does this comment make sense for HMC? */
gamma5(aux, R, VOLUME);
npar *= rnorm;
npar *= r_norm;
}
mul_r(R, npar, aux, VOLUME);
unlock_Dov_WS_spinor(1);
Expand All @@ -337,7 +337,7 @@ void norm_Q_n_psi(spinor * const R, spinor * const S,

void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
const int n, spinor * const S,
const double rnorm, const double minev) {
const double r_norm, const double minev) {

int j;
double fact1, fact2, temp1, temp2, temp3, temp4, maxev, tnorm;
Expand Down Expand Up @@ -380,7 +380,7 @@ void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
assign(aux, d, VOLUME);
}

norm_Q_sqr_psi(R, aux, rnorm);
norm_Q_sqr_psi(R, aux, r_norm);
temp1=-1.0;
temp2=c[j];
assign_mul_add_mul_add_mul_add_mul_r(d, R, dd, aux3, fact2, fact1, temp1, temp2, VOLUME);
Expand All @@ -390,13 +390,13 @@ void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
if(1) assign_sub_lowest_eigenvalues(R, d, no_eigenvalues-1, VOLUME);
else assign(R, d, VOLUME);

norm_Q_sqr_psi(aux, R, rnorm);
norm_Q_sqr_psi(aux, R, r_norm);
temp1=-1.0;
temp2=c[0]/2.;
temp3=fact1/2.;
temp4=fact2/2.;
assign_mul_add_mul_add_mul_add_mul_r(aux, d, dd, aux3, temp3, temp4, temp1, temp2, VOLUME);
norm_Q_n_psi(R, aux, 1, rnorm);
norm_Q_n_psi(R, aux, 1, r_norm);
}
else {
/* Use the adaptive precision version using the forward recursion
Expand All @@ -406,7 +406,7 @@ void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
/* d = T_0(Q^2) */
assign(d, aux3, VOLUME);
/* dd = T_1(Q^2) */
norm_Q_sqr_psi(dd, d, rnorm);
norm_Q_sqr_psi(dd, d, r_norm);
temp3 = fact1/2.;
temp4 = fact2/2.;
assign_mul_add_mul_r(dd, d, temp3, temp4, VOLUME);
Expand All @@ -418,7 +418,7 @@ void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
temp1=-1.0;
for (j = 2; j <= n-1; j++) {
/* aux = T_j(Q^2) = 2 Q^2 T_{j-1}(Q^2) - T_{j-2}(Q^2) */
norm_Q_sqr_psi(aux, dd, rnorm);
norm_Q_sqr_psi(aux, dd, r_norm);
assign_mul_add_mul_add_mul_r(aux, dd, d, fact1, fact2, temp1, VOLUME);
/* r = r + c_j T_j(Q^2) */
temp2 = c[j];
Expand All @@ -444,7 +444,7 @@ void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,

/* r = Q r */
assign(aux, R, VOLUME);
norm_Q_n_psi(R, aux, 1, rnorm);
norm_Q_n_psi(R, aux, 1, r_norm);

}
/* add in piece from projected subspace */
Expand Down
2 changes: 1 addition & 1 deletion operator/Dov_psi.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Qov_sq_psi_prec(spinor * const P, spinor * const S);

void Q_over_sqrt_Q_sqr(spinor * const R, double * const c,
const int n, spinor * const S,
const double rnorm, const double minev);
const double r_norm, const double minev);

void calculateOverlapPolynomial();

Expand Down
14 changes: 7 additions & 7 deletions solver/mode_number.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#include "X_psi.h"
#include "gamma.h"

double rnorm=-1;
double r_norm=-1;

/* |R>=rnorm^2 Q^2 |S> */
/* |R>=r_norm^2 Q^2 |S> */
void norm_X_sqr_psi(spinor * const R, spinor * const S,
double const mstar);

/* |R>=rnorm Q|S> */
/* |R>=r_norm Q|S> */
void norm_X_n_psi(spinor * const R, spinor * const S,
const int n, double const mstar);

Expand Down Expand Up @@ -122,7 +122,7 @@ void norm_X_sqr_psi(spinor * const R, spinor * const S, double const mstar) {

X_psi(aux, S, mstar);
X_psi(R, aux, mstar);
mul_r(R, rnorm*rnorm, R, VOLUME);
mul_r(R, r_norm*r_norm, R, VOLUME);

free(aux_);
return;
Expand All @@ -148,7 +148,7 @@ void norm_X_n_psi(spinor * const R, spinor * const S,
/* Here is where we have to include our operator which in this case is
X = 1 - (2M^2)/(D_m^dagger*D_m + M^2) */
X_psi(R, aux, mstar);
npar *= rnorm;
npar *= r_norm;
}
mul_r(R, npar, R, VOLUME);

Expand Down Expand Up @@ -219,7 +219,7 @@ void X_over_sqrt_X_sqr(spinor * const R, double * const c,
assign(R, aux, VOLUME);
}
else{
/*|R>=rnorm^2 X^2|aux> -> since aux=d -> |R>=rnorm^2 Q^2|d>*/
/*|R>=r_norm^2 X^2|aux> -> since aux=d -> |R>=r_norm^2 Q^2|d>*/
norm_X_sqr_psi(R, aux, mstar);
}
temp1=-1.0;
Expand All @@ -239,7 +239,7 @@ void X_over_sqrt_X_sqr(spinor * const R, double * const c,
if(0) assign_sub_lowest_eigenvalues(R, d, no_eigenvalues-1, VOLUME);
else assign(R, d, VOLUME);

/*|aux>=rnorm^2 Q^2|R> */
/*|aux>=r_norm^2 Q^2|R> */
norm_X_sqr_psi(aux, R, mstar);
temp1=-1.0;
temp2=c[0]/2.;
Expand Down
4 changes: 2 additions & 2 deletions solver/poly_precon.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void poly_precon(spinor * const R, spinor * const S, const double prec, const in
/* dd = T_1(Q^2) */
Q_pm_psi(&dd[0], &d[0]);
/* mul_r(dd, invmaxev, dd, N); */
/* norm_Q_sqr_psi(&dd[0], &d[0], g_m_D_psi, rnorm); */
/* norm_Q_sqr_psi(&dd[0], &d[0], g_m_D_psi, r_norm); */
temp3 = fact1/2;
temp4 = fact2/2;
assign_mul_add_mul_r(&dd[0], &d[0], temp3, temp4, N);
Expand All @@ -143,7 +143,7 @@ void poly_precon(spinor * const R, spinor * const S, const double prec, const in
/* aux = T_j(Q^2) = 2 Q^2 T_{j-1}(Q^2) - T_{j-2}(Q^2) */
Q_pm_psi(&aux[0], &dd[0]);
/* mul_r(aux, invmaxev, aux, N); */
/* norm_Q_sqr_psi(&aux[0], &dd[0], g_m_D_psi, rnorm); */
/* norm_Q_sqr_psi(&aux[0], &dd[0], g_m_D_psi, r_norm); */
assign_mul_add_mul_add_mul_r(&aux[0],&dd[0],&d[0],fact1,fact2,temp1, N);
/* r = r + c_j T_j(Q^2) */
temp2=c[j];
Expand Down

0 comments on commit 4d49c86

Please sign in to comment.