Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix Tabular C++ class when len(x) == len(p) + 1
  • Loading branch information
paulromano committed Jan 31, 2025
commit db041b8bd07775a22b3f3caa458e2aac5909d0b8
6 changes: 5 additions & 1 deletion src/distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,12 @@ Tabular::Tabular(pugi::xml_node node)
interp_ = Interpolation::histogram;
}

// Read and initialize tabular distribution
// Read and initialize tabular distribution. If number of parameters is odd,
// add an extra zero for the 'p' array.
auto params = get_node_array<double>(node, "parameters");
if (params.size() % 2 != 0) {
params.push_back(0.0);
}
std::size_t n = params.size() / 2;
const double* x = params.data();
const double* p = x + n;
Expand Down