Skip to content

Commit

Permalink
Fix add value
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Mar 18, 2024
1 parent c6c199f commit 5362b1a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ on: push

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
os: [ubunt-lastest, macos-14]
runs-on: ${{matrix.os}}
container:
image: ghcr.io/nnpdf/lhapdf:v2.2.8
# image: ghcr.io/catthehacker/ubuntu:full-latest
Expand Down
10 changes: 10 additions & 0 deletions pywrap/pywrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ PYBIND11_MODULE(_core, m) {
.def("MuDependentTermsBand", &ApproximateCoefficientFunction::MuDependentTermsBand)
.def("fxBand", &ApproximateCoefficientFunction::fxBand);

// ApproximateCoefficientFunctionKLMV
py::class_<ApproximateCoefficientFunctionKLMV>(m, "ApproximateCoefficientFunctionKLMV")
.def(py::init<const int&, const char&, const char&, const bool&, const double&, const double&, const int&, const int&, const int&>())
.def("MuIndependentTerms", &ApproximateCoefficientFunctionKLMV::MuIndependentTerms)
.def("MuDependentTerms", &ApproximateCoefficientFunctionKLMV::MuDependentTerms)
.def("fx", &ApproximateCoefficientFunctionKLMV::fx)
.def("MuIndependentTermsBand", &ApproximateCoefficientFunctionKLMV::MuIndependentTermsBand)
.def("MuDependentTermsBand", &ApproximateCoefficientFunctionKLMV::MuDependentTermsBand)
.def("fxBand", &ApproximateCoefficientFunctionKLMV::fxBand);

// AsymptoticCoefficientFunction
py::class_<AsymptoticCoefficientFunction>(m, "AsymptoticCoefficientFunction")
.def(py::init<const int&, const char&, const char&, const bool&, const bool&, const bool&>())
Expand Down
4 changes: 2 additions & 2 deletions src/ApproximateCoefficientFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ double AbstractApproximate::MuIndependentTerms(double x, double m2Q2, int nf) co

Value AbstractApproximate::fxBand(double x, double m2Q2, double m2mu2, int nf) const {
double x_max = 1. / (1. + 4 * m2Q2);
if (x >= x_max || x < 0)
if (x >= x_max || x <= 0)
return 0;

return MuIndependentTermsBand(x, m2Q2, nf) + MuDependentTerms(x, m2Q2, m2mu2, nf);
Expand Down Expand Up @@ -111,7 +111,7 @@ Value ApproximateCoefficientFunction::MuIndependentTermsBand(double x, double m2
double Amax = fact * A, Amin = A / fact, Bmax = B * fact, Bmin = B / fact;
double Cmax = (1. + var) * C, Cmin = (1. - var) * C, Dmax = (1. + var) * D, Dmin = (1. - var) * D;

double Avec[3] = { A, Amin, Amax };
double Avec[3] = { A, Amax, Amin };
double Bvec[3] = { B, Bmax, Bmin };
double Cvec[3] = { C, Cmax, Cmin };
double Dvec[3] = { D, Dmax, Dmin };
Expand Down
16 changes: 1 addition & 15 deletions src/CoefficientFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,7 @@ vector<double> Value::ToVect() const {
}

Value Value::operator+(const Value& rhs) const {
double res_central = central_ + rhs.central_;
double res_higher = res_central, res_lower = res_central;

double vec_lhs[3] = {central_, higher_, lower_};
double vec_rhs[3] = {rhs.central_, rhs.higher_, rhs.lower_};

double tmp;
for (int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
tmp = vec_lhs[i] + vec_rhs[j];
if (tmp > res_higher) res_higher = tmp;
if (tmp < res_lower) res_higher = tmp;
}
}
return Value(res_central, res_higher, res_lower);
return Value(central_ + rhs.central_, higher_ + rhs.higher_, lower_ + rhs.lower_);
}

// Value Value::operator-(const Value& rhs) const {
Expand Down

0 comments on commit 5362b1a

Please sign in to comment.