Skip to content

Commit 7ec83ca

Browse files
committed
Short-circuit stochastic-source inversions if requested
1 parent 58ac776 commit 7ec83ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

2dSYM/susy/d_bilinear.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ void bilinsrc(Twist_Fermion *g_rand, Twist_Fermion *src, int N) {
7171
// sum_a tr(eta Ubar_a psi_a) - tr(eta)/N tr(Ubar_a psi_a)
7272
// Return total number of iterations
7373
int d_bilinear() {
74+
if (nsrc < 1) // Only run if there are inversions to do
75+
return 0;
7476
register int i;
7577
register site *s;
7678
int mu, isrc, iters, tot_iters = 0;
@@ -87,7 +89,7 @@ int d_bilinear() {
8789
Norder = 1;
8890
psim = malloc(sizeof(**psim));
8991
psim[0] = malloc(sites_on_node * sizeof(Twist_Fermion));
90-
shift[0] = 0;
92+
shift[0] = 0; // Reset in update or grsource
9193

9294
// Normalization: sum over NUMLINK but divide by volume
9395
// and divide by 2kappa as discussed on 15--17 December 2013
@@ -157,6 +159,8 @@ int d_bilinear() {
157159
// - sum_a tr(eta Ubar_a psi_a)
158160
// Return total number of iterations
159161
int d_susyTrans() {
162+
if (nsrc < 1) // Only run if there are inversions to do
163+
return 0;
160164
register int i;
161165
register site *s;
162166
int mu, isrc, iters, tot_iters = 0;

4dSYM/susy/d_bilinear.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ void bilinsrc(Twist_Fermion *g_rand, Twist_Fermion *src, int N) {
7171
// sum_a tr(eta Ubar_a psi_a) - tr(eta)/N tr(Ubar_a psi_a)
7272
// Return total number of iterations
7373
int d_bilinear() {
74+
if (nsrc < 1) // Only run if there are inversions to do
75+
return 0;
7476
register int i;
7577
register site *s;
7678
int mu, isrc, iters, tot_iters = 0;
@@ -157,6 +159,8 @@ int d_bilinear() {
157159
// - sum_a tr(eta Ubar_a psi_a)
158160
// Return total number of iterations
159161
int d_susyTrans() {
162+
if (nsrc < 1) // Only run if there are inversions to do
163+
return 0;
160164
register int i;
161165
register site *s;
162166
int mu, isrc, iters, tot_iters = 0;

0 commit comments

Comments
 (0)