Struct Bracket

Struct Documentation

struct Bracket

A bracketing pair of grid indices, plus an interpolation weight.

lo_ and hi_ are the indices of the grid points immediately below and above (or equal to) a query value, and t_ is the fractional distance of the query value between them, so that (1 - t_) * grid[lo_] + t_ * grid[hi_] recovers the query value. For a grid of size 1 (a degenerate/singular axis with no actual extent – e.g. a yield model tabulated at only one [Fe/H]), lo_ == hi_ == 0 and t_ == 0, so a caller that always applies this same (1 - t_) * grid[lo_] + t_ * grid[hi_] weighting handles that case correctly with no special-casing of its own.

Public Members

std::size_t lo_

Index of the grid point at or below the query value

std::size_t hi_

Index of the grid point at or above the query value

double t_

Fractional distance of the query value between grid[lo_] and grid[hi_]