PdfGrid

struct PdfGrid

A parton-density grid in the LHAPDF format, loaded from a file.

madspace carries a built-in PDF interpolator compatible with the LHAPDF grid format so it needs no external PDF library [1, 2]. This struct holds the loaded grid; PartonDensity does the interpolation. initialize_globals uploads the grid to a Context.

Public Functions

PdfGrid(const std::string &file)

Load an LHAPDF-format grid.

Parameters:

file – Path to the grid file.

std::size_t grid_point_count() const

Total number of (x, q) grid points.

std::size_t q_count() const

Number of scale knots.

void initialize_coefficients(Tensor tensor) const

Fill tensor with the interpolation coefficients.

void initialize_logx(Tensor tensor) const

Fill tensor with the log(x) knots.

void initialize_logq2(Tensor tensor) const

Fill tensor with the log(q^2) knots.

std::vector<std::size_t> coefficients_shape(bool batch_dim = false) const

Shape of the coefficient tensor, optionally with a leading batch axis.

std::vector<std::size_t> logx_shape(bool batch_dim = false) const

Shape of the log(x) tensor.

std::vector<std::size_t> logq2_shape(bool batch_dim = false) const

Shape of the log(q^2) tensor.

void initialize_globals(ContextPtr context, const std::string &prefix = "") const

Upload the grid to context as compute-graph globals under prefix.

Public Members

std::vector<double> x

Momentum-fraction grid knots.

std::vector<double> logx

log(x) grid knots.

std::vector<double> q

Scale grid knots.

std::vector<double> logq2

log(q^2) grid knots.

std::vector<int> pids

PDG ids of the flavours in the grid.

std::vector<std::vector<double>> values

Grid values, indexed by flavour then by (x, q) knot.

std::vector<std::size_t> region_sizes

Knot counts of the sub-grid regions.