
Compute rebinning weight matrix
rebin_matrix.RdReturns an M x N matrix W where W[i,j] is the fraction of source bin j
that falls within destination bin i. Applying W %*% src_counts gives
the same result as rebin_counts(src_edges, src_counts, dest_edges).
Details
Precomputing W is efficient when the same bin edges are reused for many observations (e.g., all weight composition observations share the same length-to-weight bin mapping).
Examples
src_edges <- 0:4
dest_edges <- c(0, 2, 4)
W <- rebin_matrix(src_edges, dest_edges)
# W %*% c(10, 20, 15, 5) gives the coarsened counts