dcomplex attempt() { auto k = config->perturbation_order(); if (k <= 0) return 0; // Config is empty, trying to remove makes no sense int p = rng(k); // Choose one of the operators for removal auto det_ratio = config->Mmatrices[up].try_remove(p, p) * config->Mmatrices[down].try_remove(p, p); return -k / (beta * U) * det_ratio; // The Metropolis ratio }
dcomplex attempt() { // Insert an interaction vertex at time tau with aux spin s double tau = rng(beta); int s = rng(2); auto k = config->perturbation_order(); auto det_ratio = config->Mmatrices[up].try_insert(k, k, {tau, s}, {tau, s}) * config->Mmatrices[down].try_insert(k, k, {tau, s}, {tau, s}); return -beta * U / (k + 1) * det_ratio; // The Metropolis ratio }