Skip to contents

We have a set of weight bins with boundaries w_bin_boundaries and need an efficient way to integrate a probability density to determine a probability for each bin. The probability density is available at the set of weights given in the vector w. We want to use linear interpolation for the density between these values. Because the values in w do not align with the values in w_bin_boundaries we need to split each bin into segments. In this function we want to precompute the weights with which we need to add up the density values to approximate the integral over each bin.

Usage

precompute_weights(w_bin_boundaries, w)

Details

#' @return A list with vectors bin_index, f_index, coeff_fj, and coeff_fj1 used for efficient linear interpolation of density values over bins.