Skip to content

Commit

Permalink
Try debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Apr 22, 2024
1 parent 0da53bb commit 4058509
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions output/output_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace std;

std::string print_time(time_t seconds);

void loopFunction(int start, int end, vector<double>& xvec, vector<double>& Qvec, ApproximateCoefficientFunction* app, double **res_c, double **res_h, double **res_l, double m, int nf, double mufrac);
void loopFunction(int start, int end, vector<double>& xvec, vector<double>& Qvec, ApproximateCoefficientFunction& app, double **res_c, double **res_h, double **res_l, double m, int nf, double mufrac);

int main(int argc, char **argv) {

Expand Down Expand Up @@ -160,7 +160,7 @@ int main(int argc, char **argv) {
ApproximateCoefficientFunction Approx =
ApproximateCoefficientFunction(3, kind, channel, true, hs_version);

const int iterationsPerThread = rows / numThreads;
int iterationsPerThread = rows / numThreads;

std::vector<std::thread> threads;

Expand All @@ -169,7 +169,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < numThreads; ++i) {
int start = i * iterationsPerThread;
int end = (i == numThreads - 1) ? rows : (i + 1) * iterationsPerThread;
threads.emplace_back(loopFunction, start, end, ref(x), ref(Q), &Approx, res_c, res_h, res_l, m, nf, mufrac);
threads.emplace_back(loopFunction, start, end, ref(x), ref(Q), ref(Approx), res_c, res_h, res_l, m, nf, mufrac);
}

for (std::thread& thread : threads) {
Expand Down Expand Up @@ -213,8 +213,8 @@ int main(int argc, char **argv) {
cout << "Saving lower grid in " << filename + "_lower.dat" << endl;
}

for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
for (int j = 0; j < cols; j++) {
for (int i = 0; i < rows; i++) {
output_c << res_c[i][j] << " ";
output_h << res_h[i][j] << " ";
output_l << res_l[i][j] << " ";
Expand Down Expand Up @@ -247,7 +247,7 @@ std::string print_time(time_t seconds) {
return ss.str();
}

void loopFunction(int start, int end, vector<double>& xvec, vector<double>& Qvec, ApproximateCoefficientFunction* app, double **res_c, double **res_h, double **res_l, double m, int nf, double mufrac) {
void loopFunction(int start, int end, vector<double>& xvec, vector<double>& Qvec, ApproximateCoefficientFunction& app, double **res_c, double **res_h, double **res_l, double m, int nf, double mufrac) {
double x, Q, m2Q2, mu, m2mu2;
for (int i = start; i < end; i++) {
for (int j = 0; j < int(Qvec.size()); j++) {
Expand All @@ -256,10 +256,11 @@ void loopFunction(int start, int end, vector<double>& xvec, vector<double>& Qvec
mu = mufrac * Q;
m2Q2 = m * m / (Q * Q);
m2mu2 = m * m / (mu * mu);
Value res = app -> fxBand(x, m2Q2, m2mu2, nf);
Value res = app.fxBand(x, m2Q2, m2mu2, nf);
res_c[i][j] = res.GetCentral();
res_h[i][j] = res.GetHigher();
res_l[i][j] = res.GetLower();
// std::cout << "Thread ID: " << std::this_thread::get_id() <<" x="<< x << " Q=" << Q << " mu=" << mu << " nf" << nf << " res_c=" << res_c[i][j] << endl;
}
}
}
5 changes: 2 additions & 3 deletions src/ExactCoefficientFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ double
//==========================================================================================//
// OBSERVATION: in the O(as^2) exact coefficeint functions the
// mu-independent part is an interpolation in a certain grid. When this
// function is called for a (x,Q) value outside this grid, the value 0 is
// returned. The mu-dependent part is defined everywhere. This means that
// outside the grid one contribution is set to zero while the other is not.
// function is called for a (x,Q) value outside this grid, te returned value is the
// appropriate limit.
//------------------------------------------------------------------------------------------//

/// @cond UNNECESSARY
Expand Down

0 comments on commit 4058509

Please sign in to comment.